troubleshooting Question

PHP IP Logging Question

Avatar of wantabe2
wantabe2Flag for United States of America asked on
3 Comments1 Solution302 ViewsLast Modified:
Is there any way for me to edit this code so I can somehow log all attempts to log into this system? This code currently displays the IP address at the bottom of the login page....but is there any way I can log this somewhere or log unsuccessful & successful logons?
<body bgcolor="#03EBA6"> 



// username and password sent from Form 


$sql="SELECT id FROM admin WHERE username='$myusername' and passcode='$mypassword'";

// If result matched $myusername and $mypassword, table row must be 1 row


header("location: welcome.php");
$error="Your Login Name or Password is invalid";


<form action="" method="post">
<center> <h2>Eastern District</h2></center>
<center> <h2> Human Resource Employment Tracking System </h2> </center>
<center><label><b>USER NAME :</b></label>

<input type="text" name="username"/><br />

<label><b>PASSWORD :</b></label>

<input type="password" name="password"/><br/>

<input type="submit" value=" Login "/><br />
<center> <b> *** The IP address of your computer has already been logged *** </center>
<center> *** All unsuccessful & successful attempts to log onto this system is recorded *** </b> </center>


<center><b>Your IP Address is: </b><?php echo $_SERVER["REMOTE_ADDR"]; ?></center>

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros