/booka/newlayout

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/booka/newlayout
17 by Gustav Hartvigsson
fixxed broken code, and added a file i had forgot b4.
1
<?php 
2
/*
3
	Regular expression check for date.
4
*/
5
if($_POST[fromadd]){
6
	// check if the dates are valid:
7
	if(! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST[EndDate])){
8
		
9
		$EndDateunset = 'style="background-color: yellow;" ';
10
		
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
11
		$errorMsg = $errorMSG."the end date string must be YYYY-MM-DD .<br />";
12
		$valid = false;
17 by Gustav Hartvigsson
fixxed broken code, and added a file i had forgot b4.
13
	}
14
	
15
	if(! preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST[StartDate])){
16
		
17
		$StartDateunset = 'style="background-color: yellow;" ';
18
		
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
19
		$errorMsg = $errorMsg."the start date string must be YYYY-MM-DD .<br />";
20
		$valid = false;
17 by Gustav Hartvigsson
fixxed broken code, and added a file i had forgot b4.
21
	}
22
	//end of check if dates are valid
23
	//TODO: need more teisting.
24
	if($_POST[StartDate] > $_POST[EndDate]){
25
		
28 by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db.
26
		$errorMsg = $errorMsg."End date is smaller then startdate .";
27
		$valid = false;
17 by Gustav Hartvigsson
fixxed broken code, and added a file i had forgot b4.
28
	}
29
	//TODO: Add check for if dates are in DB.
30
	
31
}
32
33
34
?>