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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Location
    Lebanon
    Posts
    223
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Exclamation Redirecting code help

    Hello,

    I'm having a hard time creating a code on a page that if the user is coming from PAYPAL.COM he will be allowed to access it and if the user is entering the page from any other place but not paypal, his access will be denied.

    Can you please help?

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    Check the contents of the $_SERVER['HTTP_REFERER'] and ensure that it contains paypal.com

    You should also check the http request method (post, get, update..etc.) and handle the request accordingly.

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Location
    Lebanon
    Posts
    223
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Would this work?

    PHP Code:
    if (strstr($_SERVER['HTTP_REFERER'],"paypal.com")) {
        
    header ("Location: finish.php");
    } else {
        
    header ("Location: http://yahoo.com"); 


  • #4
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    I guess it does and it does not.

    it does not...because you're sending people away from your website...where you should handle their request and perhaps present an error page such as bad request or something along those lines.

  • #5
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    Quote Originally Posted by Snitz View Post
    Would this work?

    PHP Code:
    if (strstr($_SERVER['HTTP_REFERER'],"paypal.com")) {
        
    header ("Location: finish.php");
    } else {
        
    header ("Location: http://yahoo.com"); 

    PHP Code:
    if (strstr($_SERVER['HTTP_REFERER'],"paypal.com")) {
        include_once(
    finish.php);
    } else {
        
    header ("Location: http://yahoo.com"); 


  • #6
    Regular Coder
    Join Date
    Jul 2004
    Location
    Lebanon
    Posts
    223
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Could help me fix it? Please!

  • #7
    Regular Coder
    Join Date
    Aug 2006
    Location
    Richmond, CA
    Posts
    204
    Thanks
    3
    Thanked 11 Times in 10 Posts
    Just FYI...

    I've found that using the HTTP_REFERER is problematic. You don't always get it, so someone might, in fact, be coming from paypal.com and you'd still be denying them.


  •  

    Posting Permissions

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