Advertisement
iljimae

code allow ip cua hvnteam

Jun 27th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. <?php
  2. SESSION_start();
  3. //$pass = 'Vanphu113@'; // Mat khau de them ip vao file txt
  4. $file_listip = "@system/.htaccess"; // file txt co nhiem vu them ip
  5. ?>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7.  
  8. <html>
  9.  
  10. <head>
  11.  
  12. <title>Kiểm tra IP</title>
  13.  
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  15.  
  16. </head>
  17.  
  18. <body>
  19.  
  20. <?php
  21.  
  22. $fopen_ip = fopen($file_listip, "r");
  23.  
  24. while ( !feof($fopen_ip) )
  25.  
  26.     {
  27.  
  28.         $read_ip = fgets($fopen_ip,50);
  29.  
  30.         $ip = explode('allow from', $read_ip);
  31.  
  32.         $list_ip[] = $ip[1];
  33.  
  34.     }
  35.  
  36.     fclose($fopen_ip);
  37.  
  38. if ( in_array($_SERVER['REMOTE_ADDR'], $list_ip) ){
  39.  
  40.         echo "<script>alert('IP của bạn đã được cập nhập sẵn.')</script><center>IP của bạn đã được cập nhập sẵn.</center>";
  41.  
  42.     }
  43.  
  44. else {
  45.  
  46.         $new_ip = $_SERVER['REMOTE_ADDR'];
  47.  
  48.         $fp = fopen($file_listip, "a+");
  49.  
  50.         fputs ($fp, "allow from $new_ip\n");
  51.  
  52.         fclose($fp);
  53.  
  54.         echo "<meta http-equiv=refresh content='2; URL=http://hvngroups.net/@system/root/index.php'><script>alert('IP của bạn đã được cập nhập thành công.')</script><center>IP của bạn đã được cập nhập thành công.</center>";
  55.  
  56. }
  57.  
  58. ?>
  59.  
  60. </body>
  61.  
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement