Her

Home Web Programming PHP Last Modified and User's Screen Resolution Detection

Last Modified and User's Screen Resolution Detection

Author: Kyscorp.com Author's URL: www.kyscorp.com More by this author

Last Modified and User's Screen Resolution DetectionLast Modified

An easy and efficient way to write the date a file was last modified.

We call the function filemtime() that returns an integer (the number of seconds elapsed from Jan 1st, 1970 00:00 GMT)

Anyway, to make this integer viewable by human beings, we just format it using date() function.

<?
$file=$PHP_SELF; //Here's the file you wish to include. $PHP_SELF means current page
$mt=filemtime($file);
echo "This page was last modified on ".date("l F, d Y",$mt);

User's Screen resolution detection

Overview

This script allows the detection of the visitor screen resolution.

There's no PHP function that can detect the screen resolution, so the trick is to use a javascript code that reloads the page and that will capture the width and the height of the screen.

Script to be put on the top of the page

<?
if(empty($res))
{
echo '<script language="JavaScript">
<!-- debut
document.location="page.php3?res=1&w="+screen.width+"&h="+screen.height;
// end -->
</script>';
}
else
{
echo "Screen Resolution : ".$w."*".$h;
}
?>

Easy ain't it ? Carpe diem...