-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidations.php
More file actions
51 lines (44 loc) · 822 Bytes
/
validations.php
File metadata and controls
51 lines (44 loc) · 822 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
//comments
#comments
/* comments
comments
comments */
$errors = array();
function checkValid($value)
{
return isset($value) && $value !== "";
}
function checkMax($value,$max)
{
return strlen($value) <= $max;
}
function checkMin($value,$min)
{
return strlen($value) >= $min;
}
function checkExistIn($value,$set)
{
return in_array($value,$set);
}
function checkLogIn($username)
{
}
function checkErrors($errors=array())
{
$output ="";
if(!empty($errors))
{
$output.="<div class=\"errors\">";
$output.="Please fix the following Errors:";
$output.="<ul>";
foreach($errors as $key => $error)
{
$output.="<li>{$error}</li>";
}
$output.="</ul>";
$output.="</div>";
}
return $output;
}
?>