Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What type of Request is this?

    I'm a PHP PROGRAMMER & I HAVE THIS FILE IN ASP.
    I WANT TO REWRITE IT IN PHP..
    I'm TRYING TO UNDERSTAND THIS CODE

    ---------------------------------------------------

    PaymentID = Request("paymentid")
    ResultCode = Request("result")
    AuthCode = Request("auth")
    TranID = Request("tranid")
    PostDate = Request("postdate")
    TrackID = Request("trackid")

    Response.Write("REDIRECT=http://www.domain.com/receipt.php?PaymentID=" & PaymentID)

    ------------------------------------------------

    Is it GET REQUEST?
    CAN ANYONE REWRITE THIS SMALL CODE IN PHP?

    ----------------------
    THIS IS MY REWRITING BUT I DON'T KNOW IT IT IS CORRECT



    PHP Code:
    if (isset ($_GET['paymentid'])) {  $PaymentID $_GET['paymentid']; }
    if (isset (
    $_GET['result'])) {  $ResultCode $_GET['result']; }
    if (isset (
    $_GET['auth'])) {  $AuthCode $_GET['auth']; }
    if (isset (
    $_GET['tranid'])) {  $TranID $_GET['tranid']; }
    if (isset (
    $_GET['postdate'])) {  $PostDate $_GET['postdate']; }
    if (isset (
    $_GET['trackid'])) {  $TrackID $_GET['trackid']; }

    //---------------------------------------------------------------
    if (isset ($_GET['paymentid'])) {

    print 
    "<meta http-equiv='refresh' content='0; url='http://www.domain.com/receipt.php?PaymentID=$PaymentID'>";

    }
    //--------------------------------------------------------------- 

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    hello there,

    Here is a quick soltuion...and should work with both POST and GET forms

    PHP Code:
    <?php
    // variable to hold the page you want to forward to
    $forward_to "http://domainname.co.uk/page.html";
    // variable to hold a message in case of an error
    $error_message ":( error...payment id is not specified.";
    // get all values using short hand statement
    // you should do some validations by the way.
    $PaymentID = (isset($_REQUEST['paymentid']) && !empty($_REQUEST['paymentid']) )? $_REQUEST['paymentid'] : ""
    $ResultCode = (isset($_REQUEST['result']) && !empty($_REQUEST['result']) )? $_REQUEST['result'] : ""
    $AuthCode = (isset($_REQUEST['auth']) && !empty($_REQUEST['auth']) )? $_REQUEST['auth'] : "" 
    $TranID = (isset($_REQUEST['tranid']) && !empty($_REQUEST['tranid']) )? $_REQUEST['tranid']: ""
    $PostDate = (isset($_REQUEST['postdate']) && !empty($_REQUEST['postdate']))? $_REQUEST['postdate'] : ""
    $TrackID = (isset($_REQUEST['trackid']) && !empty($_REQUEST['trackid']) ) ? $_REQUEST['trackid']: ""
    // check if payment id != ""...using strcmp for absolute comparason...
    // if you use == sometimes the result is not 100% accurate.
    if( strcmp$PaymentID"" ) != ){
        
    header"location: " $forward_to );
        exit();
    } else {
        echo 
    $error_message;
    //-- ends else
    ?>
    I strongly suggest that you ensure that the data is validated.

    Cheers,
    Ess

  • #3
    New to the CF scene
    Join Date
    May 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much my friend ..


    I strongly suggest that you ensure that the data is validated.
    I need it working first than validated it.
    Now i will validated the rest of the coding


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •