/booka/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/booka/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php 
/*
	Regular expression check for date.
*/
if($_POST[fromadd]){
	// check if the dates are valid:
	if(! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST[EndDate])){
		
		$EndDateunset = 'style="background-color: yellow;" ';
		
		$errorMsg = $errorMSG."the end date string must be YYYY-MM-DD .<br />";
		$valid = false;
	}
	
	if(! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST[StartDate])){
		
		$StartDateunset = 'style="background-color: yellow;" ';
		
		$errorMsg = $errorMsg."the start date string must be YYYY-MM-DD .<br />";
		$valid = false;
	}
	//end of check if dates are valid
	//TODO: need more teisting.
	if($_POST[StartDate] > $_POST[EndDate]){
		
		$errorMsg = $errorMsg."End date is smaller then startdate .";
		$valid = false;
	}
	//TODO: Add check for if dates are in DB.
	
}


?>