troubleshooting Question

PHP Code to Log IP Address

Avatar of wantabe2
wantabe2Flag for United States of America asked on
1 Comment1 Solution240 ViewsLast Modified:
Is it possible to add some code to existing php code that will display the users IP address, netbios name, or any other information (mainly the IP address) at the bottom of the screen so the user will see it?


// 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>


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 1 Comment.
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 1 Comment.
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