Breadcrumb
Web and Database Development Environment PHP Example
Please go through the HTML Example before doing this example.
Create a sample php file
Using nano, we can create tutorial.php:
[username@l-lnx101 username]$ nano tutorial.php
Copy and paste the following code into your nano screen:
<?php
$ip=$_SERVER["REMOTE_ADDR"];
print "REMOTE_ADDR is $ip";
$userhost= gethostbyaddr($_SERVER["REMOTE_ADDR"]);
print "<br>\n";
print "Lookup of $ip is <strong>$userhost</strong>\n";
?>- Save the file and go to http://webdev.cs.uiowa.edu/webdev/COURSEID/USERNAME/tutorial.php where COURSEID and USERNAME are replaced with your course number and hawkid.
The page when viewed on l-lnx100 in the lab looks like:
REMOTE_ADDR is 128.255.44.124
Lookup of 128.255.44.124 is l-lnx100.divms.uiowa.edu