我在网站上集成paypal有问题。我想在成功交易后将数据添加到数据库。付款paypal正在工作但不向数据库添加数据。我不知道它是怎么做的。
的index.php
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top" id="division_form">
<div class="current_tier" id="ct" style="float: left; width: 45%; margin-right: 5%;">
<select id="current_tier_id" name="current_tier_id" onchange="calcBoost(division_price_matrix, discount);">
<option>Bronze</option>
<option selected = "selected">Silver</option>
<option>Gold</option>
<option>Platinum</option>
<option>Diamond</option>
</select>
</div>
<div class="current_division" id="cd" style="float: left; width: 45%;" >
<select name="current_division_number" onchange="calcBoost(division_price_matrix, discount);">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option selected = "selected" value="1">1</option>
</select>
</div>
<div class="current_lp" id="lp" style="float: left; width: 65%">
<select onchange="calcBoost(division_price_matrix, discount);">
<option>0-20 LP</option>
<option>20-40 LP</option>
<option>40-60 LP</option>
<option>60-80 LP</option>
<option>80-99 LP</option>
<option>100 LP</option>
</select>
</div>
</div>
<div class="before_tier">
<div class="current_tier_img" id="cti" style = "background-image: url(http://eloedge.com/_FILES/eloscript/images/silver_1.png)"></div>
</div>
</div>
<div id="right" style = "height: 200px; float: left;">
<div class="form_right" style = "float: left; width: 220px;">
<div class="desired_tier" id="dt" style="float: left; width: 45%; margin-right: 5%">
<select name="desired_tier_id" onchange="calcBoost(division_price_matrix, discount);">
<option>Bronze</option>
<option>Silver</option>
<option selected = "selected">Gold</option>
<option>Platinum</option>
<option>Diamond</option>
<option>Master</option>
</select>
</div>
<div class="desired_division" id="dd" style="float: left; width: 45%;">
<select name="desired_division_number" onchange="calcBoost(division_price_matrix, discount);">
<option selected = "selected" value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
</select>
</div>
<div style="float: left; width: 25%; margin-right: 5%"><label style="padding-top: 10px" for="division_region">Region:</label></div>
<div style="float: left; width: 65%">
<select name="division_region" onchange="division_info_update()">
<option value="na">North America</option>
<option value="euw">Europe West</option>
<option value="eun">Europe North & East</option>
</select>
</div>
</div>
<div class="before_tier">
<div class="desired_tier_img" id="dti" style = "background-image: url(http://eloedge.com/_FILES/eloscript/images/gold_5.png)"></div>
</div>
</div></div>
<div id="payment_details" class="div_center" style="float: none;width: 675px;margin: auto">
<div class="payment_details">
<div class="child">
<label for="division_user">Username:</label>
<span id="division_user_span" title="">
<input type="text" id="division_user" name="division_user" required="" onkeyup="division_info_update()" />
</span>
</div>
</div>
<div class="payment_details">
<div class="child">
<label for="division_password">Password:</label>
<span id="division_password_span" title="">
<input type="text" id="division_password" name="division_password" required="" onkeyup="division_info_update()" />
</span>
</div>
</div>
<div class="payment_details">
<div class="child">
<label for="division_summoner">Summoner Name:</label>
<input type="text" id="division_summoner" name="division_summoner" required="" onkeyup="division_info_update()" />
</div>
</div>
</div>
</div>
<div id="price" style="float: left; width: 100%; text-align: center;">Price: $1 EUR</div>
<input type="hidden" name="lc" value="EUR" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="maksymilianzuzel2@gmail.com" />
<input type="hidden" name="hosted_button_id" value="3AV9FWRLTZ3KL">
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="item_number" value="0-20 LP Silver 1 to Gold 5" />
<input type="hidden" name="item_name" value="Rating Boost" />
<input id="boost_amount" type="hidden" name="amount" value = "0"/>
<input type="hidden" name="notify_url" value="https://ratingboost.net/userpanel/payed.php" />
<input type="hidden" name="custom" value="" />
<input style = "" type="image" alt="PayPal - The safer, easier way to pay online!" name="submit" src="http://eloedge.com/_FILES/eloscript/images/paypal.png" />
<img src="http://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" border="0" />
</form>
payed.php
<?php
session_start();
if (!isset($_SESSION['zalogowany']))
{
header('Location: ../login.php');
exit();
}
$current_tier_id = $_POST['current_tier_id'];
$desired_tier_id = $_POST['desired_tier_id'];
$current_division_number = $_POST['current_division_number'];
$desired_division_number = $_POST['desired_division_number'];
$division_user = $_POST['division_user'];
$division_summoner = $_POST['division_summoner'];
$price = $_POST['amount'];
$today = date("m.d.Y G:i:s");
$id = $_SESSION['id'];
echo 'CURRENT: <br />';
echo 'Division: '.$current_tier_id.'<br />';
echo 'Number: '.$current_division_number.'<br /><br /><br />';
echo 'Desired: <br />';
echo 'Division: '.$desired_tier_id.'<br />';
echo 'Number: '.$desired_division_number.'<br /><br /><br />';
echo 'User: '.$division_user.'<br />';
echo 'Summoner name: '.$division_summoner.'<br />';
echo 'Price: '.$price.'<br />';
require_once "../connect.php";
$polaczenie = new mysqli($host, $db_user, $db_password, $db_name);
if ($polaczenie->query("INSERT INTO leagueoflegendsbought VALUES (NULL, '$current_tier_id', '$current_division_number', '$desired_tier_id','$desired_division_number','$division_user','$division_summoner','$price','$id')"))
{
echo 'Udało się!';
header('Location: index.php');
}
else
{
throw new Exception($polaczenie->error);
}
?>