• Problems

    This line enable URL Rewriting . It must be enabled via the RewriteEngine directive! and if your .htaccess file is going to use rewrite rules, you should always include this line. Otherwise, you can’t be sure if its enabled or not. The string “on” is case insensitive.

The only thing that you must do to run this script properly, is take all the image files and place them in a directory called "clock". That way, when the images in the script are called, they will be loaded without any problems. The images must be located in:  clock/

Upload clock.php along with the image directory to your webserver, and you will have a simple graphical clock!


 TWO STEPS TO INSTALL CLOCK :

   1.  Make directory named "clock"and save all the image
   2.  Make file named "clock . php"
 
STEP ONE: Make directory named "clock"and save all the image
0.gif
1.gif
2.gif
3.gif
4.gif
5.gif
6.gif
7.gif
8.gif
9.gif
am.gif
colon.gif
pm.gif

Folder Structure

STEP TWO: Make file named "clock . php"
<html>
<head>
<title>NanoOnline - Online Graphical PHP Clock</title>
<!--
<meta http-equiv="refresh" content="1; URL=http://www.nanohost.com/scripts/clock.php3">
-->


<?php
$hours = date("h");
$minutes = date("i");
$seconds = date("s");
$ampm = date("a");

/* The , 0, 1 means that it starts from the beginning, and retrieves the first character in the string */

$hours1= substr("$hours", 0, 1);
$hours2 = substr("$hours", 1, 1);
$minutes1 = substr("$minutes", 0, 1);
$minutes2 = substr("$minutes", 1, 1);
$seconds1 = substr("$seconds", 0, 1);
$seconds2 = substr("$seconds", 1, 1);

/* AM or PM */

if($ampm == "am")
{
$time_ampm = "am.gif";
}
else
{
$time_ampm = "pm.gif";
}



print "<b><font face=arial size=3>Hour&nbsp;&nbsp;Minute&nbsp;&nbsp;Second</b></font><br>";

/* Prints the Hours */
echo"<img src='clock/$hours1.gif'><img src=\"clock/$hours2.gif\"><img src=\"clock/colon.gif\">";

/* Prints the Minutes */
echo "<img src='clock/$minutes1.gif'><img src=\"clock/$minutes2.gif\"><img src=\"clock/colon.gif\">";

/* Prints the Seconds, and whether it's AM or PM */
echo"<img src='clock/$seconds1.gif'><img src=\"clock/$seconds2.gif\"><img src=\"clock/$time_ampm\">";





?>



No comments:

Post a Comment