$_SERVER['REMOTE_ADDR']; gethostbyaddr($remoteIP) |
Predefined variables |
<html> |
![]() |
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Parent key word to use </title> </head> <body text="#FFFF00" bgcolor="#000080"> test_php_version.php<br> <?php $V= PHP_VERSION; $R= $_SERVER['REMOTE_ADDR'] ; print ("current version is $V <br/>"); print ("current ADDRESS is $R <br/>"); ?> </body></html> |
![]() |
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Parent key word to use </title> </head> <body text="#FFFF00" bgcolor="#000080"> <?php /* Convert timestamp to desired format. */ function fileinfo($tstamp) { return date("m-d-y g:i:sa", $tstamp); } $file = "C:/Apache2/htdocs/php5/tutorials_example/functions/file_os/stat.php"; /* Open the file C:\Apache2\htdocs\php5\tutorials_example/ */ $fh = fopen($file, "r"); /* Retrieve file information */ $fileinfo = fstat($fh); /* Output some juicy information about the file. */ echo "Filename: ".basename($file)."<br />"; echo "Filesize: ".round(($fileinfo["size"]/1024), 2)." kb <br />"; echo "Last accessed: ".fileinfo($fileinfo["atime"])."<br />"; echo "Last modified: ".fileinfo($fileinfo["mtime"])."<br />"; ?> </body></html> |
![]() |
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>open read directory </title> </head> <body text="#FFFF00" bgcolor="#000080"> read_directory.php<br> <?php function directory_size($directory) { $directorySize=0; /* Open the directory and read its contents. */ if ($dh = @opendir($directory)) { /* Iterate through each directory entry. */ while (($filename = readdir ($dh))) { /* Filter out some of the unwanted directory entries. */ if ($filename != "." && $filename != "..") { // File, so determine size and add to total. if (is_file($directory."/".$filename)) $directorySize += filesize($directory."/".$filename); // New directory, so initiate recursion. */ if (is_dir($directory."/".$filename)) $directorySize += directory_size($directory."/".$filename); } } #endWHILE } #endIF @closedir($dh); return $directorySize; } #end directory_size() $directory = "C:/Apache2/htdocs/php5/tutorials_example/"; $totalSize = round((directory_size($directory) / 1024), 2); echo "Directory $directory: ".$totalSize. "kb."; ?> </body></html> |
![]() |
file size <html> |
![]() |
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>file size</title> </head> <body text="#FFFF00" bgcolor="#000080"> pathinfo.php<br> <?php $drive = "/usr"; echo round((disk_free_space($drive) / 1048576), 2); ?> <?php $pathinfo = pathinfo("//Manas5/manasonline_courses/Manas_PHP/PHP_Courses/index.htm"); //\\Manas5\manasonline_courses\Manas_PHP\PHP_Courses echo "Dir name: $pathinfo[dirname]<br />\n"; echo "Base name: $pathinfo[basename] <br />\n"; echo "Extension: $pathinfo[extension] <br />\n"; ?> </body></html> |
![]() |