Advertisement
Spyros

Untitled

Apr 24th, 2012
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <html>
  2.    
  3. <?php
  4. include "captiveportal-functions.php";
  5.  
  6. $loc1="captiveportal-location1.html";
  7. $loc2="captiveportal-location2.html";
  8.  
  9. $ip=$_SERVER['REMOTE_ADDR'];
  10. echo "Your Ip Is $ip";
  11. if(contains("20.20.20",$ip)||contains("10.5.25",$ip)){
  12.     $target=$loc1;
  13.     echo "You should be redirected";
  14. }
  15. else {
  16. $target=$loc2; 
  17. }
  18. redirectTo($target);
  19.  
  20. function contains($substring, $string) {
  21.         $pos = strpos($string, $substring);
  22.         if($pos === false) {
  23.                 // string needle NOT found in haystack
  24.                 return false;
  25.         }
  26.         else {
  27.                 // string needle found in haystack
  28.                 return true;
  29.         }
  30. }
  31. ?>
  32.    
  33.    
  34.    
  35.    
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement