Instant Notification System

Discussion in 'PHP' started by Kuna, Oct 18, 2009.

  1. #1
    I have this script for instant notification system for 2CheckOut

    payment.php
    <?php
    if(isset($_GET['submit'])){
    $name = $_GET['name'];
    $surname = $_GET['surname'];
    $email = $_GET['email'];
    
    ?>
    <div style=" margin-top:20%;">
    
    <form action="https://www.2checkout.com/checkout/purchase" method="post">
    <input type="hidden" name="sid" value="xxxxxx">
    <input type="hidden" name="quantity" value="1">
    <input type="hidden" name="product_id" value="3">
    <input type="hidden" name="demo" value="Y"/>
    <input type="hidden" name="fixed" value="Y"/>
    <input type="hidden" name="pay_method" value="PPI"/>
    
    <input type="hidden" name="x_receipt_link_url" value='http://www.mysite.com/orderconfirmation.php?email=<?php echo "$email"; ?>&name=<?php echo "$name"; ?>&surname=<?php echo "$surname"; ?>'>
    <input name="submit" type="image"  src="images/buy-button.jpg" value="Buy from 2CO">
    </form>
    </div>
    
    <?php
    } else {
    ?>
    
    
    
    
    <form action="payment.php" method="get" name="formcheck" id="formcheck" onsubmit="return (formCheck(this) && Validate(form,email));">
    
    <div class="tekst">*Name:</div><br>
    <input name="name" type="text" class="TextField" size="35">
    <br><br>
    <div class="tekst">*Surname:</div><br>
    <input name="surname" type="text" class="TextField" size="35">
    <br><br>
    
    <div class="tekst">*Email:</div><br>
    <input name="email" type="text" class="TextField" size="35"  id="email">
    <br><br>
    <input type="image" src="images/send-button.jpg" name="submit" value="submit">
    
    </form>
    <br>
    </div>
    <?php
    
    }
    ?>
    
    PHP:
    orderconfirmation.php
    <?php
    
    
    $myemail = "mail@mail.com"; //Your Email Address
    
    if(isset($_GET['email'])){
    
    $name = $_GET['name'];
    $email = $_GET['email'];
    
    $to      = "$myemail";
    $subject = 'Purchase Made';
    $message = "A Purchase has been made by $name , \r\n \r\n Here is the Information: \r\n Email: $email";
    $headers = "From: $myemail" . '\r\n' . "Reply-To: $myemail" . '\r\n' . "X-Mailer: PHP/" . phpversion();
    
    mail($to, $subject, $message, $headers);
    
    } else {
    ?>
    <font color="red"> Invalid Parameters </font>
    
    <?php
    }
    ?>
    
    PHP:
    But problem is that when I use x_receipt_link_url and when payment is done it redirects me to http://www.mysite.com/orderconfirmation.php, it should redirect to http://www.mysite.com/orderconfirmation.php?email=<?php echo "$email"; ?>&name=<?php echo "$name"; ?>&surname=<?php echo "$surname"; ?>

    I read that 2CO doesn't support GET. Can you help me to do it other way
     
    Last edited: Oct 18, 2009
    Kuna, Oct 18, 2009 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use a URL rewrite using htaccess so that the url is
    /orderconfirm/emailaddress/name/surname/

    be sure to URL encode all the data first
     
    JAY6390, Oct 18, 2009 IP
  3. Kuna

    Kuna Well-Known Member

    Messages:
    426
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    I don't know how to make htaccess rewrite rule. Can you help me
     
    Last edited: Oct 18, 2009
    Kuna, Oct 18, 2009 IP
  4. Kuna

    Kuna Well-Known Member

    Messages:
    426
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #4
    does anyone have and other idea how to make it work?

    How to convert form from GET to POST
     
    Last edited: Oct 19, 2009
    Kuna, Oct 19, 2009 IP