-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample_whitelist.php
More file actions
33 lines (31 loc) · 852 Bytes
/
example_whitelist.php
File metadata and controls
33 lines (31 loc) · 852 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
<?php
if(!empty($_POST)) {
require("Validate.php");
$validate = new Validate();
$validation = $validate->check($_POST, array(
'code' => array(
'required' => true,
'whitelist' => array(
'asd9i0', 'sd90ada', 'djasdj9a8', 'adk90k292kd', 'asdoakd3', '93nassd', '9fsjfd',
'30dkas', 'asd09', 'xcv877', 'a9s0dzx', 'asd90jm', 'a9s0dz', 'olkm9a', 'a09sdj')
)
));
if($validation->passed()) {
echo 'Validation passed!';
}
else {
echo '<b>Error:</b>';
echo '<ul>';
foreach($validation->errors() as $error)
{
echo '<li>'.ucfirst($error).'</li>';
}
echo '</ul>';
}
}
?>
<form method="post">
Enter code:
<input type="text" name="code">
<input type="submit" value="Submit">
</form>