Visitor's IP - PHP & MySQL tutorial
- Added: Nov 9th, 2005
- Level: Easy
- Author: Melfina
- Reads: 11,458
- Description: Show your visitor's IP with just two lines of php code.
This is more a copy-paste code than a real tutorial, but hey, anyways:
<?php $visitorip = $_SERVER['REMOTE_ADDR'];
echo "$visitorip"; ?>
What we do with this, is request the visitor's ip and assign it a name, visitorip, then we output it with an echo. Paste the code where you want the ip to show. Of course, before and after the code (or you can include it), you can give it format and add anything you want, just don't touch the code between < and > if you don't know how php works. Want an example? sure!
Your IP is 34.228.52.21
If you like this tutorial why not digg it or
add to del.icio.us?
Tutorial © Melfina. Do not reproduce in any way without previous permission from the author.