View Single Post
  #7 (permalink)  
Old 10-08-06, 07:34 PM
Ruy Pedro Ruy Pedro is offline
New Member
 
Join Date: Oct 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Eureka !....

Mab :

I Want to thank You very, very much. With the alteration I make to call the page instead of only stamp the day and the month on the browser, it works perfectly.
Down I shaw all the code I use now.
In the code you give I saw that first it sends a question to the user's browser and ask the date.
The answer given is transfered by string to the adress of the page in the browser and then the server gives de page of the day of the user's computer.
My only question is: what append if the user has the javascript disabled ?
Once again, than's
Your friend
Ruy Pedro

Code:
<?php 
if (isset($_GET['umm']) AND isset($_GET['udd'])) { 
  // output the value gotten from the browser as a test 
  //echo "Your MM: {$_GET['umm']} Your DD: {$_GET['udd']}<br />\n"; 
  // set file name
$mes = $_GET['umm'];  // I'm portguese. In my language mes = month
$dia = $_GET['udd'];  //  "     "        "   "    "    dia =  day
$filename = strtolower($dia . $mes) . '2006.php';  // In portugal we use the date in this format : dd/mm/yyyy
// echo $filename; // 05oct.php 
if ((include $filename) == 'OK') { 
	include($filename); 
	echo 'OK'; 
} 
  
} else { 
// form and pass the date 
 echo "<script language='javascript'>\n"; 
 echo "var d=new Date()\n"; 
 echo "var dd=d.getDate()\n"; 
 echo "var mm=(d.getMonth() +1 ) \n"; 
 echo "location.href=\"${_SERVER['SCRIPT_NAME']}?${_SERVER['QUERY_STRING']}" 
            .  "&umm=\" + mm + \"&udd=\" + dd;\n"; 
 echo "</script>\n"; 
 exit(); 
} 
?>
Reply With Quote