使用帖子两次错误



,因为我使用的是paypal和bluesnap,所以我有2个不同的IPN,并且在页面上都有一个问题,如果我把一个iPN拿走,那么如果我将一个ipn拿走,那么他们会工作的,那么他们真的需要这个工作花费了几个小时来弄清楚它:/

<?php
    /**
     * If the player clicks the continue
     * button, it will perform the following
     * process. The process will redirect to
     * the checkout URL as long as the player
     * has entered their username details.
     */
    if (isset($_POST['continue'])) {
        $username = trim($_POST['username']);
        $product = trim($_POST['product']);
        if ($username != "Enter Username" && $username != "") {
            header("Location: http://www.plimus.com/jsp/buynow.jsp?contractId=" . $product . "&custom1=" . $username);
            exit;
        }
    }
?>
<html>
            <form action="<?php ?>" method="POST">
                <div name="select">
                    Product:
                    <select name="product">
                    </select>
                </div>
                <div name="username">
                    Username:
                    <input type="text" maxlength="12" name="username" value="Enter Username" onblur="if(this.value=='') this.value='Enter Username';" onfocus="if(this.value=='Enter Username') this.value='';"/>
                </div>
                <?php
                    /**
                     * If the user enters their username details
                     * incorrectly, it will perform this process.
                     * This will just send a line of text asking
                     * them to enter their username. I recommend
                     * carrying over this process when you integrate
                     * it with your own website theme.
                     */
                    if (isset($_POST['continue']))
                        echo "<font color=red>Please enter your username.</font>";
                ?>
                <div name="button">
                    <button type="submit" name="continue" value="Continue">Continue</button>
                </div>
            </form>
<a href="http://www.plimus.com/ecommerce/buyers" target="_blank" title="Trusted and Secure Online Payment Processing via PLIMUS"><img src="https://www.plimus.com/images/icons_wizard/icons/cards/cards_type2_1-1.gif" border="0"></a>
            </center>
            <br>
            <br>
<center>
<?php
    if(isset($_POST['submit'])) {
        $errors = array();
        $user = trim($_POST['user']);
        $prod = trim($_POST['prod']);
        header("Location: paypal.php?username=". $user ."&prod=". $prod);
        exit;
    }
?>
    <form action="<?php echo basename($_SERVER['PHP_SELF']); ?>" method="POST">
    <tr><td><center>
        <table>
            <select name="prod">

            </select> </td></tr>
            <tr>
                <td>Username:</td>
                <td><input type="text" name="user" value="" /></td> <td colspan="2"><input type="submit" name="submit" value="Submit" /></td> 
            </tr>
            </table>
            </form>

假设您将处理的数据存储到某种形式的数据库中。
我要做的就是像往常一样存储数据,然后运行快速选择以确保没有双重提交。这也假设您已经对PostData进行了消毒/验证

$check = mysqli_query($link, "SELECT `id` FROM `ipn_data` WHERE `txn_id` = '".$_POST['txn_id']."'");
if(mysqli_num_rows($check))
    exit("You've already submitted this payment");
mysqli_query($link, "INSERT INTO `ipn_data` (`custom`, `txn_id`) VALUES (".$_POST['custom'].", '".$_POST['txn_id']."')");

与这些线一样的东西。
我可以根据要求提供我的PayPal IPN类

<form action="someaction.php" name="paypal" method="post">
<form action="someaction.php" name="plimus" method="post">
然后简单地运行检查以查看发布的表格:
if(isset($_POST['paypal']))
if(isset($_POST['plimus']))

最新更新