-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess_reg.php
45 lines (35 loc) · 1005 Bytes
/
process_reg.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
39
40
41
42
43
44
45
<?php
// get database connection
include_once 'config/init.php';
date_default_timezone_set('Asia/Kolkata');
$database = new DatabaseAuth();
$db = $database->getConnection();
$user = new User($db);
// set user property values
$user->first_name = $_POST['first_name'];
$user->last_name = $_POST['last_name'];
$user->email = $_POST['email'];
$user->password = base64_encode($_POST['password']);
$user->city = $_POST['city'];
$user->mobile = $_POST['mobile'];
$user->created = date('Y-m-d H:i:s');
$user->ip = $user->getUserIp();
// create the user
if($user->signup()){
$user_arr=array(
"status" => true,
"message" => "Signup Successfull!",
"id" => $user->uid,
"email" => $user->email
);
redirect('login.php', $user_arr['message'], 'success');
}
else{
$user_arr=array(
"status" => false,
"message" => "Email already exists!"
);
redirect('register.php', $user_arr['message'], 'error');
}
print_r(json_encode($user_arr));
?>