Warning: Creating default object from empty value in /home/thescrip/public_html/jclass/load_globes.php on line 22

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/thescrip/public_html/jclass/load_globes.php:22) in /home/thescrip/public_html/jincludes/globals.php on line 43

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/thescrip/public_html/jclass/load_globes.php:22) in /home/thescrip/public_html/jincludes/globals.php on line 43

Warning: Creating default object from empty value in /home/thescrip/public_html/jclass/load_globes.php on line 22

Warning: Creating default object from empty value in /home/thescrip/public_html/jclass/db_func.php on line 61

Warning: Creating default object from empty value in /home/thescrip/public_html/jclass/db_func.php on line 61

Warning: Creating default object from empty value in /home/thescrip/public_html/jclass/db_func.php on line 61
PHP Date Script
TheScriptCenter.com


print page

PHP Date Script

PHP Customizable Date Script with daily messages!

Description: Shows the time and date where ever you insert the code into your webpage.
Features: Control font type, color, size, bold, italics, status bar on/off, and the
Background Color of the text.
Display a different message for every day of the week!
Example:


System Requirments:
PHP3 or higher.
Instructions: Copy and paste the following code into your webpage where you like it to appear.

<?php

# script written by Jason J. Russo webmaster@thescriptcenter.com
# more free scripts: http://thescriptcenter.com
#############################################################
# Month Format:
# 0 2 digits = (01)
# 1 1 digit = (1)
# 2 longtext = January
# 3 shorttext= Jan
$monthf = "2";

# Day of month format
# 0 2 digits = (01)
# 1 without leading zero = (1)
$dayf = "0";

# Day of week Format:
# 0 longtext = Monday
# 1 3 letter = Mon
$daywf = "0";

# Year Format:
# 0 4 digits = 2002
# 1 2 digits = 02
$yearf = "0";

# Separated by: Example: -, /, _, 1-2-2003 or 1/2/2003
$separator = "-";

# Show time? 0 = no 1= yes
$showtime = "1";

# Edit the following variables below.
# font face example: arial,verdana,tahoma
$fface="verdana";
# font size
$fsize="1";
# font color
$fcolor="#000080";
# bold text. Set to 1 if true 0 if false;
$b = "0";
# italics text. Set to 1 if true 0 if false;
$i = "0";
# Do you want the date to be seen in the window status bar?
# Set to 1 if true 0 if false;
$statusbaron = "1";
# Cascading Style Sheet Effects. Set to 1 if true 0 if false;
$css = "0";
# If the above is set to 1 insert the background color here.
$bgcolor = "#fffddd";

# Place a message here if you want to display a message on a certain day
$daymess = array();
# Sunday
$daymess[0]="visit <a href='http://thescriptcenter.com'>thescriptcenter.com";
# Monday
$daymess[1]="Case of the Mondays.";
# Tuesday
$daymess[2]="Tuesday's gone.";
# Wednesday
$daymess[3]="Free Scripts at: <a href='http://thescriptcenter.com'>thescriptcenter.com</a>";
# Thursday
$daymess[4]="visit <a href='http://thescriptcenter.com'>thescriptcenter</a>";
# Friday
$daymess[5]="TGIF!";
# Saturday
$daymess[6]="Working on a Saturday?";

# Do Not Edit Below This Line Unless you know what you're doing. Or even if you don't know what
#you're doing but you feel like experimenting.
#############################################################
$whatday = date("w");

if($monthf == "0") {
$month = date("d");
}
elseif($monthf == "1") {
$month = date("n");
}
elseif($monthf == "2") {
$month = date("F");
}
else {
$month = date("M");
}

if($dayf == "0") {
$day = date("d");
}
else {
$day = date("j");
}

if($yearf == "0") {
$year = date("Y");
}
else {
$year = date("y");
}

if($daywf == "0") {
$dayw = date("l");
}
else {
$dayw = date("D");
}

$ampm = date("a");
$results = "$month$separator$day$separator$year";
$stbar = $results;
if($b==1) { $bold = "<b>" $endbold = "</b>"; }
if($i==1) { $italics = "<i>" $enditalics="</i>"; }
if($css==1) { $css = " style='background-color:$bgcolor'"; } else { $css = ""; }

$results = "$bold $italics <font color="$fcolor" face="$fface" size="$fsize">$results
";

if($daymess[$whatday]){ $results .= "$daymess[$whatday]"; }

$results .= "</font> $endbold $enditalics";
if($statusbaron == 1) {
$results .= "<script>window.status = "$stbar"</script> ";
}
if($HTTP_GET_VARS["js"]) {
$results = str_replace(" ","<br />",$results);
$results = str_replace(" '", "'",$results);
echo "document.write('" . "$results</font>$endbold$enditalics" . "');";
} else {
echo "$results$endbold$enditalics"
}
?>