/booka/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/booka/trunk

« back to all changes in this revision

Viewing changes to inc/regex.php

  • Committer: Gustav Hartvigsson
  • Date: 2010-07-18 08:42:56 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20100718084256-yq7xoll9pjgybl19
changed copyright date.
(did not notice that it was old untill i looked true some diffs at LP.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
                
 
11
                $errorMsg = $errorMSG."the end date string must be YYYY-MM-DD .<br />";
 
12
                $valid = false;
 
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
                
 
19
                $errorMsg = $errorMsg."the start date string must be YYYY-MM-DD .<br />";
 
20
                $valid = false;
 
21
        }
 
22
        //end of check if dates are valid
 
23
        //TODO: need more teisting.
 
24
        if($_POST[StartDate] > $_POST[EndDate]){
 
25
                
 
26
                $errorMsg = $errorMsg."End date is smaller then startdate .";
 
27
                $valid = false;
 
28
        }
 
29
        //TODO: Add check for if dates are in DB.
 
30
        
 
31
}
 
32
 
 
33
 
 
34
?>