-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup_validation.php
38 lines (38 loc) · 1.07 KB
/
signup_validation.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
34
35
36
37
38
<?php
include 'init.php';
// initialize the var
$response = array(
'status' => 0,
'message' => ""
);
$select = $_POST["select"];
$filed = $_POST["filed"];
if (!empty($select) && !empty($filed)) {
//to check from email to signup
if ($select == 'email') {
$result = get_data(USER_CHECK, [$filed]);
if ($result != 0) {
$response['status'] = 1;
$response['message'] = lang('error_email_exist');
echo json_encode($response);
exit();
}else{
$response['status'] = 0;
echo json_encode($response);
exit();
}
}
//to check from password to signup
if ($select == 'password') {
if (!preg_match("/^(?=.*\d)(?=.*\W+)(?=.*[a-z])(?=.*[A-Z]).{6,25}$/", $filed)) {
$response['status'] = 1;
$response['message'] = lang('error_invalid_pass');
echo json_encode($response);
exit();
}else{
$response['status'] = 0;
echo json_encode($response);
exit();
}
}
}