Advertisement
Guest User

Untitled

a guest
Jan 15th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2. //ip address array (change or add them as necessary)
  3. $IP_Array = array('173.8.241.122', '173.8.241.123');
  4.  
  5. //function to get the current pages URL
  6. function curPageURL() {
  7.     $pageURL = 'http';
  8.     if ($_SERVER["HTTPS"] == "on") {
  9.         $pageURL .= "s";
  10.     }
  11.     $pageURL .= "://";
  12.     if ($_SERVER["SERVER_PORT"] != "80") {
  13.         $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  14.     }
  15.     else {
  16.         $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  17.     }
  18.     return $pageURL;
  19. }
  20.  
  21. //set url to current page URL
  22. $url = curPageURL();
  23.  
  24. //get referrer url
  25. if (!isset($url))
  26.     $url = $_SERVER["HTTP_REFERER"];
  27.  
  28. //get the lander and image from the url
  29. $last = parse_url($url, PHP_URL_PATH);
  30.  
  31. $lander = substr($last, -16, 7);
  32. $image = substr($last, -8, 4);
  33.  
  34. //get the users ip address
  35. $IP_Address = $_SERVER["REMOTE_ADDR"];
  36.  
  37. if(in_array($IP_Address, $IP_Array)) {
  38.     //ip matches do nothing
  39. }
  40. //ip does not match send to someplace else
  41. elseif ($lander == 'lander1') {
  42.     header( 'Location: http://domain.com/base.php?c=112&key=123456789&keyword='.$image );
  43. }
  44. elseif ($lander == 'lander2') {
  45.     header( 'Location: http://domain.com/base.php?c=112&key=abcdefghi&keyword='.$image );
  46. }
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement