#native_company# #native_desc#

Authenticates User , Maintains Security and Mails Administor

By James Smith
on June 26, 2001

Version: 1

Type: Full Script

Category: Other

License: GNU General Public License

Description: This Code i have tested on Apache , here user is authenticated user username james and password smith , the program sends mail to the System Admin informing who logged in and When , Easy to use and u can modify to suit your requirements

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="james">
   <meta name="GENERATOR" content="Mozilla/4.75 [en] (Win98; U) [Netscape]">
<br>&nbsp;if(($PHP_AUTH_USER == "james") AND ($PHP_AUTH_PW == "smith"))
<br>&nbsp; print("&lt;HTML>n");
<br>&nbsp; print("&lt;HEAD>n");
<br>&nbsp; print("&lt;TITLE>Welcome to Members Area&lt;/TITLE>n");
<br>&nbsp; print("&lt;/HEAD>n");
<br>&nbsp; print("&lt;BODY>n");
<br>&nbsp; print("You have logged in successfully!&lt;BR>n");
<br>&nbsp; $username = "James Smith";
<br>&nbsp; $email = "[email protected]";
<br>&nbsp; $mailsubject = "$PHP_AUTH_USER has logged in ";
<br>&nbsp; $Fromname = "James Smith";
<br>&nbsp; $Fromaddress = "James Smith";
<br>&nbsp; $today = date("g:i a");
<br>&nbsp; $time=$today;
<br>&nbsp; $x= date("U");
<br>&nbsp; $m = date("M");
<br>&nbsp; $x1 =date(" dS, F&nbsp; Y",$x);
<br>&nbsp; $msg = "This is to inform System Administrator That $PHP_AUTH_USER
had logged in with $PHP_AUTH_PW as password on $x1 ";
<br>&nbsp; if (mail($username." &lt;".$email.">", $mailsubject, $msg, "From:
".$Fromname." &lt;".$Fromaddress.">nContent-Type: text/html; charset=iso-8859-1"))
<br>&nbsp; {
<br>&nbsp;&nbsp; print ("Mail Sent To $username&lt;br>&lt;br>");
<br>&nbsp;&nbsp; print ($msg);
<br>&nbsp; }
<br>&nbsp; else
<br>&nbsp; {
<br>&nbsp;&nbsp; print ("Mail Dead");
<br>&nbsp; }
<br>&nbsp; print("&lt;/BODY>n");
<br>&nbsp; print("&lt;/HTML>n");
<br>&nbsp; header("WWW-Authenticate: Basic realm="Protected Area Members
<br>&nbsp; header("HTTP/1.0 401 Unauthorized");
<br>&nbsp; print("This page is protected by HTTP Authentication.&lt;br>n");
<br>&nbsp; print("&lt;B>james&lt;/B> for the username, and smith is password