Advertisement
Guest User

Untitled

a guest
Jan 15th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. session_start();
  3. //get referrer url
  4. if (!isset($_SESSION["origURL"]))
  5.     $_SESSION["origURL"] = $_SERVER["HTTP_REFERER"];
  6.  
  7. $url = $_SESSION["origURL"];
  8.  
  9. //get the 123/456 from the url
  10. $last = parse_url($url, PHP_URL_PATH);
  11.  
  12. $where = substr($last, -7, 3);
  13.  
  14. //get the users ip address
  15. $IP_address = $_SERVER["REMOTE_ADDR"];
  16.  
  17. //where should we send the user?
  18. if ($IP_address == "123.456.789" || $IP_address == "987.654.321") {
  19.     header( 'Location: http://example.com/original-link' );
  20. }
  21. else {
  22.     if ($where == "123") {
  23.         header( 'Location: http://example.com/custom_string1='.$where ) ;
  24.     }
  25.     elseif ($where == "456") {
  26.         header( 'Location: http://example.com/custom_string2='.$where );
  27.     }
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement