redirection with parameter

Discussion in 'PHP' started by menoo, Aug 2, 2009.

  1. #1
    hi everybody.
    i need to make a code witch redirect user after bank on-line paying to 2 sites.
    one after paying was successful and second if not. bank after paying set url with some parameters but important is RES with values OK and FAIL.

    so i need script witch do something like this:

    if param res = ok > redirect to http://www.some.biz/success.php
    if param res = fail > redirect to http://www.some.biz/fail.php

    but i cant find the rigth way to do it..
    please help me if somebody know how to do this correct way.

    thanks a lot
     
    menoo, Aug 2, 2009 IP
  2. nishanair

    nishanair Active Member

    Messages:
    188
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    How you receive the value of the parameters. If its through GET, you can use it like this.

    
    <?php
     ob_start();
    
    if($parameter == 'OK')
    {
    header('Location: http://www.some.biz/success.php');
    }
    else
    {
    header('Location: http://www.some.biz/fail.php');
    }
    
    ob_end_flush();
    ?>
    
    PHP:
     
    nishanair, Aug 2, 2009 IP
  3. menoo

    menoo Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi nishanair,
    thanks for your reply but, this dont work for me. bank is calling site witch i want (there should be a script) and adding some parameters after this url.

    what they send to me is some like this :

    http://www.some.com/afterpaying?VS=232&RES=OK&SIGN=7676556789221

    imortant for the script is the RES with parameters OK or FAIL

    do you know how to do this?
    thanks
     
    menoo, Aug 2, 2009 IP
  4. linkinpark2014

    linkinpark2014 Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    does RES value changes?
    i mean if it was okay it will show value OK?
    and if it fails it shows failed?
     
    linkinpark2014, Aug 2, 2009 IP
  5. keaglez

    keaglez Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you can understand the above code, then you only need assign the variable first, for example
    
    if($parameter == 'OK')
    
    PHP:
    to
    
    $parameter = $_GET['RES'];
    if($parameter == 'OK')
    
    PHP:
     
    keaglez, Aug 2, 2009 IP