我想要做的是,一旦一个人点击贝宝按钮,我从会话中散列他的用户名和数据库并将其保存Transactions
并作为自定义发送到贝宝,所以当支付完成后,我可以从数据库和完成付款,但这不起作用......这是代码
<?php
session_start();
if (isset($_SESSION["logged"]))
{
require_once ("config.php");
if (isset($_POST["hsubmit"]))
{
$hashed = MD5($_SESSION["username"] . $_SESSION["db"] . time());
mysql_query('INSERT INTO `Transactions` (trans_id,username,db) VALUES ( "' . $hashed .
'" , "' . $_SESSION["username"] . '" , "' . $_SESSION["db"] . '" ) ') or die(mysql_error
());
echo '<input type="hidden" name="custom" value="' . $hashed . '" />';
}
echo '
<script type="text/javascript">
function Check(){
document.forms["_xclick"]["amount"].value = items[document.forms["_xclick"]["os0"].value];
document.forms["_xclick"]["item_name"].value = document.forms["_xclick"]["os0"].value;
document.forms["hide"].submit();
return true;
}
</script>
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="mail@gmail.com">
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="return" value="" />
<input type="hidden" name="cancel_return" value="" />
<input type="hidden" name="item_name" value="" />
<input type="hidden" name="notify_url" value="index.php?page=paypal_ipn.php" />
<table>
<tr><td><input type="hidden" name="on0" value="UG Offers">UG Offers</td></tr><tr><td><select name="os0">
<script type="text/javascript"> var items = new Array(); </script>;';
$query = mysql_query('SELECT * FROM `purchasetypes`');
while ($row = mysql_fetch_assoc($query))
{
echo '<option value="' . $row["name"] . '"> ' . $row["name"] . ' $' . $row["usd_price"] .
' USD</option>';
echo '<script type="text/javascript"> items["' . $row["name"] . '"] = "' . $row["usd_price"] .
'"; </script>';
}
echo '
</select> </td></tr>
</table>
<input type="hidden" name="amount" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" onClick="Check();">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<form id="hidden" name="hide" action="index.php?page=donate" method="post">
<input type="submit" name="hsubmit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
</form>
';
}
?>