Monday, June 27, 2011

Monday, June 27, 2011

Here is a class for working with time


<?php
class Date{
//purpose: implents an ECMA-style Date class for PHP
protected $time;
protected $date;

//static functions

public static function parse($date)
{
return strtotime($date);
}

public static function UTC($year, $month, $day)
{
$hours = $minutes = $seconds = 0;
$num_args = func_num_args();
if($num_args>3)
{
$hours=func_get_arg(3);
}
if($num_args>4)
{
$minutes=func_get_arg(4) + ((int)date('Z')*60);
}
if($num_args>5)
{
$seconds = func_get_arg(5);
}
return mktime($hours, $minutes, $seconds, ($month+1), $day, $year);
}

//------------
// constructor

public function __construct()
{
$num_args = func_num_args();
if($num_args > 0)
{
$args = func_get_args();
if(is_array($args[0]))
{
$args = $args[0];
$num_args = count($args);
}
}
if($num_args>1)
{
$seconds = $minutes = $hours = $day = $month = $year = 0;
}
switch($num_args)
{
case 6:
$seconds = $args[5];
case 5:
$minutes = $args[4];
case 4:
$hours = $args[3];
case 3:
$hours = $args[2];
case 2:
$hours = $args[1];
$year = $args[0];
$this->time = mktime($hours, $minutes, $seconds, ($month + 1), $day, $year);
break;
case 1:
if(is_int($args[0]))
{
$this->time = $args[0];
}
elseif(is_string($args[0]))
{
$this->time = strtotime($args[0]);
}
break;
//if no arguments are passed to the constructor, then $time is set to the default
//value returned by mktime() when called without input parameters
//aka the current system date and time
case 0:
$this->time = mktime();
break;
}
$temp = gettimeofday();
$this->offset = (int)$temp["minuteswest"];
} //end construct function

//returns day of the month
public function getDate()
{
return (int)date("j", $this->time);
}

//returns day of the week
public function getDay()
{
return (int)date("w", $this->time);
}

//returns 4 digit year
public function getFullYear()
{
return (int)date("Y", $this->time);
}

//return hours field (0-23)
public function getHours()
{
return (int)date("H", $this->time);
}

//returns mintues field
public function getMinutes()
{
return (int)date("i", $this->time);
}

//returns month
public function getMonth()
{
$temp = (int)date("n", $this->time);
return --$temp;
}

public function getSeconds()
{
return (int)date("n", $this->time);
}

//returns a complete date as elapsed seconds
//since the UNIX epoch
public function getTime()
{
return $this->time;
}

public function getTimezoneOffset()
{
return $this->offset;
}

public function setDate($date)
{
$this->time = mktime(
$this->getHours(),
$this->getMinutes(),
$this->getSeconds(),
$this->getMonth() + 1,
$date,
$this->getFullYear()
);
return $this->time;
}

public function setFullYear($year)
{
$this->time = mktime(
$this->getHours(),
$this->getMinutes(),
$this->getSeconds(),
($this->getMonth()+1),
$this->getDate(),
$year
);
return $this->time;
}

public function setHours($hours)
{
$this->time = mktime($hours,
$this->getMinutes(),
$this->getSeconds(),
$this->getMonth() + 1,
$this->getDate(),
$this->getFullYear()
);
return $this->time;
}

public function setMinutes($minutes)
{
$this->time = mktime(
$this->getHours(),
$minutes,
$this->getSeconds(),
$this->getMonth()+1,
$this->getDate(),
$this->getFullYear()
);
}

public function setMonth($month)
{
$this->time = mktime(
$this->getHours(),
$this->getMinutes(),
$this->getSeconds(),
$month,
$this->getDate(),
$this->getFullYear()
);
return $this->time;
}

public function setSeconds($seconds)
{
$this->time = mktime (
$this->getHours(),
$this->getMinutes(),
$seconds,
$this->getMonth() + 1,
$this->getDate(),
$this->getFullYear()
);
return $this->time;
}

public function toGMTString()
{
return $this->toUTCString();
}

public function toLocaleString()
{
return date('r', $this->time);
}

public function toUTCString()
{
return date("D d M Y H:i:s", ($this->time + ($this->offset * 60))) . " UTC";
}

public function valueOf()
{
return $this->time;
}

} //end class Date

//set day of month

$date = new Date(1309146256); // may 11th 1982
$month = $date->getMonth();
echo $month;
echo "
";
$date->setDate(22);
$newdate = $date->getDate();
echo $newdate;

//-----------
$today = new Date;
printf("

Current date and time: %s

\n", $today->toLocaleString());

echo "

'Get' methods:

";
printf("

Month %d.

\n", $today->getMonth());
printf("

Day of month: %d.

\n", $today->getDate());
printf("

Day of Week: %d.

\n", $today->getDay());
printf("

Year: %d.

\n", $today->getFullYear());
printf("

Hours: %d.

\n", $today->getHours());
printf("

Minutes: %d

\n", $today->getMinutes());


$newdate = "Sat, 4 April 2003 15:15:25 +1000";
$timestamp = Date::parse($newdate);
printf("

Test dateL %s; Date::parse() yields: %d.

\n", $newdate, Date::parse($newdate));
printf("

Using toUTCstring(): %s

", $today->toUTCString());
echo "Now for some 'set' methods...

";

echo "

Let's try advancing the date by one day...:";
$today->setDate($today->getDate() +1);
echo $today->toLocaleString() . "

";

echo "

Now let's try advancing the date by one year...:";
$today->setFullYear($today->getFullYear()+1);
echo $today->toLocaleString() . "

";

echo "

Now we're going to set the month for that date to 0 (January):";
$today->setMonth(0);
echo $today->toLocaleString() . "

\n";
?>



here is another tutorial that extends the above class.


<
class DateExtended extends Date
{
public static function isLeapYear($year)
{
return date('L', mktime(0, 0, 0, 1, 1, $year)) == 1 ? TRUE : FALSE;
}

//class constructor: passes whatever arguments it receives back ot the parent class constructor
public function __construct()
{
parent::__construct(func_get_args());
}

public function toLocaleString($long=FALSE)
{
$output = "";
if($long)
{
$day=$this->getDayFullName();
$date=$this->getOrdinalDate();
$month=$this->getMonthFullName();
$year=$this->getFullYear();
$time=$this->getClockTime(TRUE, TRUE, FALSE);

$output="$day, $date $month $year, $time";
} else {
$output=date('r', $this->getTime());
}
return $output;
}


public function getClockTime($twelve = TRUE, $uppercaseAMPM=TRUE, $includeSeconds=TRUE, $separator=":")
{
$am_pm="";
$hours = $this->getHours();
if($twelve)
{
$am_pm = " " . ($hours >= 12 ? "pm" : "am");
if($uppercaseAMPM)
{
$am_pm = strtoupper($am_pm);
}
if ($hours > 12)
{
$hours -= 12;
}
}
else
{
if($hours < 10)
{
$hours = "0$hours";
}
}
$minutes = $this->getMinutes();
if($minutes<10)
{
$minutes = "0$minutes";
}
$minutes = "$separator$minutes";
$seconds ="";
if($includeSeconds)
{
$seconds = $this->getSeconds();
if($seconds<10)
{
$seconds="0$seconds";
}
$seconds = "$separator$seconds";
}
return "$hours$minutes$seconds$am_pm";
}

public function getDayFullName()
{
return date('l', $this->time);
}

//return 3-letter abbreviation for day of week
//(sun, mon, etc)
public function getDayShortName()
{
return date('D', $this->time);
}

//returns number of days in current month
public function getDaysInMonth()
{
return date('t', $this->time);
}

public function getDifference(Date $date)
{
$val1 = $this->getTime();
$val2 = $date->getTime();
$sec = abs($val2 - $val1);
$units = getdate($sec);

$hours = abs($units["hours"] - (date('Z') / 3600));
$days = $units["mday"];

if($hours > 23)
{
$days++;
$hours %= 24;
}
$output = array();
$output["components"] = array("years" => $units["year"] -1970,
"months"=>--$units["mon"],
"days"=>--$days,
"hours"=>$hours,
"minutes"=>$units["minutes"],
"seconds"=>$units["seconds"]
);

$output["elapsed"] = array("years" => $sec / (365*24*60*60),
"months"=>$sec / (30*24*60*60),
"weeks"=>$sec /(7*24*60*60),
"days"=>$sec / (24*60*60),
"hours"=>$sec / (60*60),
"minutes"=>$sec / 60,
"seconds"=>$sec
);
$output["order"] = $val2 < $val1 ? -1 : 1;
return $output;
}

public function getMonthFullName()
{
return date('F', $this->time);
}

//returns 3-letter abbreviation for month
public function getMonthShortName()
{
return date('M', $this->time);
}

public function getOrdinalDate()
{
return date('jS', $this->time);
}

public function getTimeZoneName()
{
return date('T', $this-time);
}

//returns ISO week number
public function getISOWeek()
{
return (int)date('W', $this->time);
}

//returns true if current date/time is daylight-savings time
public function isDST()
{
return date('I', $this->time)==1 ? TRUE : FALSE;
}

//returns true if day is a weekday (Mon-Fri), FALSE if not
public function isWeekDay()
{
$w = $this->getDay();
return ($w > 0 && $w < 6) ? true : FALSE;
}

//returns ISO representation of date and time
public function toISOString()
{
return date('c', $this->time);
}

} //end class DateExtended

//---------
$x= new DateExtended ();
printf("

Current date and time (long toLocaleString()): %s.</p>\n", $x->toLocaleString(TRUE));
printf("

Current date and time (parent toLocaleString()): %s.</p>\n", $x->toLocaleString());
printf("

Current date and time (ISO format): %s.

\n", $x->toISOString());

printf("

Today is %s (%s).

\n", $x->getDayFullName(),$x->getDayShortName());
printf("

Today is %s %s, %d.

\n", $x->getOrdinalDate(), $x->getMonthFullName(), $x->getFullYear());
for($year=2000;$year<2015;$year++){
printf("%s is %s a leap year.<br/>\n", $year, DateExtended::isLeapYear($year) ? '' : 'not');
echo "<br/>";
}
$past = new DateExtended(1997, 6, 4, 15, 30, 45);
printf("

Past date is %s.</p>\n", $past->toLocaleString());
$diff=$x->getDifference($past);
$components = $diff["components"];
$output = array();
foreach($components as $period=>$length)
{
if($length>0){
$output[]= "$length $period";
}
}
printf("

Difference in dates is: %s.

", implode($output, ', '));
printf("

Difference in dates is: %s years.

", $diff["elapsed"]["years"]);



//set day of month

$date = new Date(1309146256); // may 11th 1982
$month = $date->getMonth();
echo $month;
echo "<br/>";
$date->setDate(22);
$newdate = $date->getDate();
echo $newdate;

Friday, June 24, 2011

Friday 6/24/2011


<?php
$date1 = '14 June 2002';
$date2 = '05 Feb 2006';

$its1 = strtotime($date1);
$its2 = strtotime($date2);

printf("

The difference between %s and %s is %d seconds.

", $date1, $date2, $its2 - $its1);
?>

Thursday, June 23, 2011

Thursday 6/23/2011


<?php
class ShopProduct {
public $title;
public $producerMainName;
public $producerFirstName;
public $price;

function __construct($title, $firstName, $mainName, $price){
$this->title = $title;
$this->producerFirstName = $firstName;
$this->producerMainName = $mainName;
$this->price = $price;
}

function getProducer(){
return "{$this->producerFirstName} . {$this->producerMainName}";
}
function getTitle(){
return $this->title;
}
function getSummaryLine(){
$base = "{$this->title} ({$this->producerMainName}, ";
$base .= "{$this->producerFirstName})";
return $base;
}

} //end class ShopProduct


abstract class ShopProductWriter{
protected $products = array();

public function addProduct(ShopProduct $shopProduct){
$this->products[]=$shopProduct;
}

abstract public function write();
}

class XmlProductWriter extends ShopProductWriter{
public function write(){
$str = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$str .= "<products>\n";
foreach($this->products as $shopProduct){
$str .= "\tgetTitle()}\">\n";
$str .= "\t\t<summary>\n";
$str .="\t\t{$shopProduct->getSummaryLine()}\n";
$str .="\t\t</summary>\n";
$str .= "\t\t</product>\n";
}
$str .= "</products>\n";
print $str;
}
}

class TextProductWriter extends ShopProductWriter{
public function write(){
$str = "PRODUCTS:\n";
foreach($this->products as $shopProduct){
$str .= $shopProduct->getSummaryLine()."\n";
}
print $str;
}
}

$dw = new shopProduct("PHP for Fun", "John", "Martin", 18.99);
$xml = new XmlProductWriter();
$xml->addProduct($dw);
$xml->write();

?>

here is a tutorial on time and getting the last modification


<?php
echo "This file was last updated on ";
echo date('l d F Y, \a\t H:i:s T', getlastmod());
echo ". ";
?>




<?php
$file = "time2.php";
echo "The file $file was last updated on ";
echo date('l d F Y, \a\t H:i:s T', filemtime("./$file"));
echo ". ";

?>


And here is the final tutorial for the day on time


<?php
$file = 'time3.php';
$data = stat($file);
$accessed = $data['atime'];
$modified = $data['mtime'];
$created = $data['ctime'];

echo "The file $file was...
\n";
echo "last accessed" . date('l d f Y, \a\t H:i:d', $accessed) . ",
\n";
echo "last modified " . date('l d F Y, \a\t H:i:s', $modified) . ",
\n";
echo "and created" . date('l d F Y, \a\t H:i:s', $created) . ". ";
?>

Tuesday, June 21, 2011


<?php

class db {
private $connect = "";

function __construct(){
if($connect=$this->connect=new mysqli("localhost", "root", "china", "phpobj")){
echo "connected";
}
}

function sayHello(){
echo "hello";
}

function query($string){
return($this->connect->query($string));
}

}
class ShopProduct {
private $id=0;
public $title;
public $producerMainName;
public $producerFirstName;
public $price;

public function setID($id){
$this->id = $id;
}

public static function getInstance($id, &$db){
$db->sayHello();
$res= $db->query("select * from products where id='$id'");
if(!$res->num_rows){
echo "nothing found";
exit;
}
if(empty($res)){
echo "empty";
}
if($res->num_rows){
$row=$res->fetch_array();
}
$var = $row['type'];
echo $var;
if($row['type']=="book"){
$product = new BookProduct($row['title'], $row['firstname'], $row['mainname'], $row['price'], $row['numpages']);
} else if ($row['type']=="cd"){
$product = new cdProduct($row['title'], $row['firstname'], $row['mainname'], $row['price'], $row['playlength']);
} else {
$product = new ShopProduct($row['title'], $row['firstname'], $row['mainname'], $row['price']);
}
$product->setId($row['id']);
return $product;
}

function __construct($title, $firstName, $mainName, $price){
$this->title=$title;
$this->producerFirstName=$firstName;
$this->producerMainName=$mainName;
$this->producerPrice=$price;
}

function getProducer(){
return "{$this->producerFirstName} . {$this->producerMainName}";
}

function getSummaryLine(){
$base = "{$this->title} ({$this->producerMainName}, ";
$base .= "{$this->producerFirstName})";
return $base;
}



} //end class ShopProduct

class CdProduct extends ShopProduct {
public $playLength;

function __construct($title, $firstName, $mainName, $price, $playLength){
parent::__construct($title, $firstName, $mainName, $price);
$this->playLength = $playLength;
}

function getPlaylength() {
return $this->playLength;
}

function getSummaryLine(){
$base = "$this-.title ($this->producerMainName, ";
$base .= "$this->producerFirstName )";
$base .= ": page count - $this->numPages";
return $base;
}
} //end class CdProduct

class BookProduct extends ShopProduct {
public $numPages;

function __construct($title, $firstName, $mainName, $price, $numPages){
parent::__construct($title, $firstName, $mainName, $price);
$this->numPages = $numPages;
}

function getNumberOfPages(){
return $this->numPages;
}

function getSummaryLine(){
$base = "$this->title ($this->producerMainName, ";
$base .= "$this->producerFirstName)";
$base .= ": page count - $this->numPages";
return $base;
}
}


$db = new db();
$obj = ShopProduct::getInstance(1, $db);
print_r($obj);
?>







<?php
function date_diff2($date1=0, $date2=0, $debug=FALSE){
$val1 = is_numeric($date1) ? $date1 : strtotime($date1);
$val2 = is_numeric($date2) ? $date2 : strtotime($date2);

$sec = abs($val2 - $val1);
// **DEBUG**
if($debug){
printf("

Date 1: %s ... Date 2 %s

", date('r', $val1), date('r', $val2));
}

$units = getdate($sec);
//**debug**
if($debug){
printf("
%s
", print_r($units, true));
}

$hours = $units["hours"] - (date('Z') / 3600);
$days = $units["mday"];
while($hours>23)
{
$days++;
$hours-=24;
}

$output = array();
$epoch = getdate(0); // the Unix epoch in the server's local time zone
$output["components"] = array("years" => $units["year"] - $epoch["year"],
"months"=>--$units["mon"],
"days"=>--$days,
"hours"=>$hours,
"minutes"=>$units["minutes"],
"seconds"=>$units["seconds"]
);
$output["elapsed"] = array("years"=>$sec / (365*24*60*60),
"months"=>$sec /(30*24*60*60),
"weeks"=>$sec / (7*24*60*60),
"days"=>$sec / (24*60*60),
"hours"=>$sec / (60*60),
"minutes"=>$sec / 60,
"seconds"=>$sec
);

$output["order"] = $val2 < $val1 ? -1 : 1;
return $output;

} //end function

$arrived = mktime(11, 30, 0, 6, 9, 2002);
$departed = mktime(17, 20, 0, 6, 22, 2002);

$holiday = date_diff2($arrived, $departed, TRUE);

//display the entire $holiday array
printf("
%s
", print_r($holiday, TRUE));

$components = $holiday["components"];

$output = array();

foreach($components as $period=>$length){
if($length>0){
$output[]="$length $period";
}
}

printf("

My holiday in Aukland began on %s, and lasted %s.

", date('l, jS F Y', $arrived), implode($output, ', '));
?>

Sunday, June 19, 2011


<?php
class ShopProduct {
public $title;
public $producerMainName;
public $producerFirstName;
public $price;

function __construct($title, $firstName, $mainName, $price){
$this->title = $title;
$this->producerFirstName = $firstName;
$this->producerMainName = $mainName;
$this->price = $price;
}

function getProducer(){
return "{$this->producerFirstName} . {$this->producerMainName}";
}

function getSummaryLine(){
$base = "{$this->title} ({$this->producerMainName}, ";
$base .= "{$this->producerFirstName})";
return $base;
}

} //end class ShopProduct

class CdProduct extends ShopProduct {
public $playLength;

function __construct($title, $firstName, $mainName, $price, $playLength){
parent::__construct($title, $firstName, $mainName, $price);
$this->playLength = $playLength;
}

function getPlaylength() {
return $this->playLength;
}

function getSummaryLine(){
$base = "$this-.title ($this->producerMainName, ";
$base .= "$this->producerFirstName )";
$base .= ": page count - $this->numPages";
return $base;
}
} //end class CdProduct

class BookProduct extends ShopProduct {
public $numPages;

function __construct($title, $firstName, $mainName, $price, $numPages){
parent::__construct($title, $firstName, $mainName, $price);
$this->numPages = $numPages;
}

function getNumberOfPages(){
return $this->numPages;
}

function getSummaryLine(){
$base = "$this->title ($this->producerMainName, ";
$base .= "$this->producerFirstName)";
$base .= ": page count - $this->numPages";
return $base;
}
}
?>

Tuesday, June 14, 2011

6/14/2001


<?php
$mydates = array('2005-01-01', '2005-06-30', '2005-12-31');

foreach($mydates as $mydate){
$ts = strtotime($mydate);
echo 'Day ' . date('d M Y: z', $ts) . "
\n";

}

?>




<?php
// takes a 2 or 4 digit year,
// returns 1 or 0
function is_leap_year($year)
{
$ts = strtotime("$year-01-01");
return date('L', $ts);
}

//test the function for a set of 11 consecutive years
for($i=2000; $i<=2010; $i++)
{
$output = "$i is ";
if( !is_leap_year($i))
{
$output .= "not ";
}
$output .= 'a leap year.
';

echo $output;
}
?>




PHP and classes


<?php
class ShopProduct{
//class body
public $title = "default product";
public $producerMainName = "main name";
public $producerFirstName = "first name";
public $price = 0;

function __construct($title, $firstName, $mainName, $price){
$this->title = $title;
$this->producerFirstName = $firstName;
$this->producerMainName = $mainName;
$this->price = $price;
}

function getProducer(){
return "{$this->producerFirstName}" . " {$this->producerMainName}";
}
}

class ShopProductWriter{
public function write($shopProduct){
$str = "{$shopProduct->title}: " . $shopProduct->getProducer() . " ({$shopProduct->price})\n";
print $str;
}
}

$product1 = new ShopProduct("My Antonia", "Willa", "Cather", 7.99);
$writer = new ShopProductWriter();
$writer->write($product1);

print "Author: {$product1->getProducer()}\n";
?>





<?php
class shopProduct {
public $numPages;
public $playLength;
public $title;
public $producerMainName;
public $producerFirstName;
public $price;

function __construct($title, $firstName, $mainName, $price, $numPages=0, $playLength=0)
{
$this->title = $title;
$this->producerFirstName = $firstName;
$this->producerMainName = $mainName;
$this->price = $price;
$this->numPages = $numPages;
$this->playLength = $playLength;
}

function getProducer(){
return "{$this->producerFirstName}" . "{$this->producerMainName}";
}

function getSummaryLine(){
$base = "{$this->title} ({$this->producerMainName},";
$base .= "{$this->producerFirstName})";
return $base;
}
}

Class CdProduct extends shopProduct {
function getPlayLength(){
return $this->playLength;
}

function getSummaryLine(){
$base = "{$this->title} ({$this->producerMainName}, ";
$base .= "{$this->producerFirstName})";
$base .=": playing time - {$this->playLength}";
return $base;
}
}



Class BookProduct extends ShopProduct {
function getNumberOfPages() {
return $this->numPages;
}

function getSummaryLine() {
$base = "{$this->title} ({$this->productMainName}, ";
$base .= "{$this->producerFirstName})";
$base .= ": page count - {$this->numPages}";
return $base;
}

}


$product2 = new CdProduct("Exile on Coldharbour Lane", "The", "Alabama 3", 10.99, null, 60.33);
print "Artist: {$product2->getProducer()}\n";

?>

Thursday, June 9, 2011


<script type="text/javascript">
function checkSearch()
{
if(!document.getElementById || !document.createTextNode){return;}

if(!document.getElementById('search')){return;}
var searchValue=document.getElementById('search').value;
if(searchValue=="")
{
alert("Please enter a search term before sending the form");
return false;
}
else if(searchValue=='JavaScript')
{
var really=confirm('"JavaScript" is a very common term. \n' + 'Do you really want to search for this?');
return really;
}
else
{
return true;
}

}
</script>



This is a php tutorial on dates


<?php
$mydates = array("now", "today", "tomorrow", "yesterday", "Thursday", "this Thursday", "last Thursday", "+2 hours", "-1 month", "+10 minutes", "30 seconds", "+2 years -1 month", "next week", 'last month", "last year', "2 weeks ago"
);
echo "<table>";
//remeber: strtotime() returns a timestamp
foreach($mydates as $mydate)
{
echo '<tr><td>' . $mydate .':' . date('r', strtotime($mydate)) . "</td></tr>\n";
}
echo "</table>";


?>




<?php
echo "Today is " . date('d M Y') . '. ';
for($i = 1; $i <= 12; $i++){
$nextmonth = date('Y-' . (date('n')+$i) . '-01');
$nextmonth_ts = strtotime($nextmonth);
$firsttue_ts = strtotime("Tuesday", $nextmonth_ts);

echo '\n
The first Tuesday in ' . date('F', $firsttue_ts) . ' is ' . date('d M Y', $firsttue_ts) . '. ';
}
?>


Friday, June 3, 2011

Javascript

Here is a quick javascript tutorial i did

<script type="text/javascript">
function checkDate()
{
if(!document.getElementById || !document.createTextNode) {return;}
if(!document.getElementById('date')){return;}
//define a regular expression to check the date format
var checkPattern = new RegExp("\\d{2}/\\d{2}/\\d{4}");
//get the value of the date entry field
var dateValue=document.getElementById('date').value;
//if there is no date entered, don't sen the form
if(datevalue='')
{
alert("Please enter a date");
return false
}
else
{
//tell the user to change the date syntax either until
// she presses cancel or entered the right syntax
while(!checkPattern.test(dateValue) && dateValue!=null)
{
dateValue=prompt("Your date was not in the right format. Please enter it as DD/MM/YYYY.", dateValue);
}
return dateValue!=null;
}
}
</script>
</head>
<body>
<h1>Events search</h1>
<form action="eventssearch.php" method="post" onsubmit="return checkDate();">
<p>
<label for="date">Date in the format DD/MM/YYYY:<br/>
<input type="text" id="date" name="date" />
<input type="submit" value="check" />
<br />(example 26/04/1975)
</p>
</form>
</body>