标题可能有点误导,但我不确定如何以其他方式表述它。
我正在使用以下脚本跨服务器发送变量:
<?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);
}
?>
这有效,我将变量jecom.php
放在另一台服务器上。
这是接收页面:
<?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>
我从表单中获取值(如预期的那样)但不是$sender
and $balance
,当我按下提交时,它不会将它们发送到正确的页面,而是希望jecom_find.php
在表单服务器上找到。现在这并不让我感到惊讶,我想到了跟随位置,但目前这不起作用(openbase_dir
并且safe_mode
仍然是一个)。是否有可能绕过这个?