Reputation: 83
The title might be a bit misleading but I am unsure how to formulate it in an other way.
I am sending variables cross server using the following script:
<?php
if($_POST) {
$ch = curl_init("http://jecom.nl/bank/mods/jecom/jecom.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array('description' => $_POST['description'], 'amount' => $_POST['amount'], 'receiver'=> $_POST['receiver']));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
// set to false if you want to see what redirect header was sent
// snippet 1
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
}
?>
This works, and I get the variables to jecom.php
on the other server.
This is the receiving page:
<?php
require_once 'jecom_req.php'; //Basic requirements file
$receiver = ($_POST["receiver"]);
$amount = ($_POST["amount"]);
$description = ($_POST["description"]);
$sender = $_SESSION['username']; //their username.
$balance = get_funds($sender, $server);
?>
<h1>Confirm payment</h1>
<p>Please be carefull to confirm your payment to the other party. All transactions are logged to prevent fraud.</p>
<form name="confirmation" method="post" action="jecom_send.php">
<table width="200" border="1">
<tr>
<td>Your account name:</td>
<td><?php echo $sender; ?></td>
</tr>
<tr>
<td>Current Balance:</td>
<td><?php echo $balance; ?></td>
</tr>
</table>
<hr>
<table width="200" border="1">
<tr>
<td>Receiving party:</td>
<td><?php echo $receiver; ?></td>
</tr>
<tr>
<td>Description:</td>
<td><?php echo $description; ?></td>
</tr>
<tr>
<td>Amount:</td>
<td><?php echo $amount; ?></td>
</tr>
</table>
<hr>
<table width="500" border="1">
<tr>
<td align="center">I hereby confirm this information is correct and want to transfer the money.</td>
</tr>
<tr>
<td align="center"><input name="Submit" type="submit" value="Submit"></td>
</tr>
</table>
<input name="receiver" type="hidden" value="<?php echo $receiver; ?>" />
<input name="description" type="hidden" value="<?php echo $description; ?>" />
<input name="amount" type="hidden" value="<?php echo $amount; ?>" />
<input name="confirmation" type="hidden" value="http://jecom.nl/bank/mods/jecom/confirmation.php" />
</form>
I'm getting the values from the form (as expected) but not $sender
and $balance
, also when I press submit it doesn't send them to the correct page but expects to find jecom_find.php
on the form server. Now this doesn't surprise me and I thought of the followlocation but at the moment this doesn't work (openbase_dir
and safe_mode
are still one). Is it possible to go around this or not?
Upvotes: -1
Views: 115
Reputation: 813
If its cross-server the $_SESSION variable wont be set on the second server. So it will always be null, and so, you will never get the balance as your calling
$balance = get_funds( NULL , $server);
Upvotes: 0