forked from stevenmills/bootstrapvalidator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.php
33 lines (27 loc) · 809 Bytes
/
remote.php
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
// This is a sample PHP script which demonstrates the 'remote' validator
// To make it work, point the web server to root Bootstrap Validate directory
// and open the remote.html file:
// http://domain.com/demo/remote.html
header('Content-type: application/json');
//sleep(5);
$valid = true;
$users = array(
'admin' => '[email protected]',
'administrator' => '[email protected]',
'root' => '[email protected]',
);
if (isset($_POST['username']) && array_key_exists($_POST['username'], $users)) {
$valid = false;
} else if (isset($_POST['email'])) {
$email = $_POST['email'][0];
foreach ($users as $k => $v) {
if ($email == $v) {
$valid = false;
break;
}
}
}
echo json_encode(array(
'valid' => $valid,
));