-1

标题可能有点误导,但我不确定如何以其他方式表述它。

我正在使用以下脚本跨服务器发送变量:

<?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>

我从表单中获取值(如预期的那样)但不是$senderand $balance,当我按下提交时,它不会将它们发送到正确的页面,而是希望jecom_find.php在表单服务器上找到。现在这并不让我感到惊讶,我想到了跟随位置,但目前这不起作用(openbase_dir并且safe_mode仍然是一个)。是否有可能绕过这个?

4

1 回答 1

0

如果它的跨服务器 $_SESSION 变量不会设置在第二个服务器上。所以它永远是空的,所以你永远不会得到余额作为你的电话

$balance = get_funds( NULL , $server);
于 2013-01-04T12:35:36.333 回答