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 Coder
    Join Date
    Jan 2010
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Php Referer code issue.

    hi.
    i plan to sell products and my customers should be redirected to a page when purchase is approved.And i would like this page accessible if the referrer url is the payment gateway one.I try this code but it's not working.could you help me sort that issue in the script.i'll really appreciate that.
    here below is the script i try :
    Code:
    <?php if($_SERVER['HTTP_REFERER'] = https://www.gatewayurl.com/)
    {
       echo 'Thanks For buying here!....';
    }
    else{echo'<font color=red>Ooops! You have been taken onto this page because your purchase may not have been approved. </a></font>';}
    ?>
    Last edited by costaryan; 01-17-2010 at 03:12 AM.

  • #2
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    PHP Code:
    <?php if($_SERVER['HTTP_REFERER'] = https://www.gatewayurl.com/)
    you are using the assignment operator, you want comparison:

    PHP Code:
    <?php if($_SERVER['HTTP_REFERER'] == "https://www.gatewayurl.com/")
    also don't forget to wrap the link in quotes as it's a string

  • Users who have thanked met for this post:

    costaryan (01-16-2010)

  • #3
    New Coder
    Join Date
    Jan 2010
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts
    You're all right!thanks


  •  

    Posting Permissions

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