-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistrationdata.php
More file actions
72 lines (50 loc) · 1.64 KB
/
registrationdata.php
File metadata and controls
72 lines (50 loc) · 1.64 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
include 'connection.php';
$MobileNum = $_POST['mobilenumber'];
$Password = $_POST['password'];
//$Password = password_hash($Password, PASSWORD_DEFAULT);
$Full_Name = $_POST['name'];
$Gender = $_POST['gender'];
$City = $_POST['address'];
$Status = "OK";
$CheckSQL = mysqli_query($con,"SELECT * FROM register WHERE MobileNumber='$MobileNum'");
if(mysqli_fetch_array($CheckSQL)){
//echo 'Mobile Number Already Exist, Please Enter Another Mobile.';
$response['error'] = false;
$response['message'] = 'Mobile Number Already Exist, Please Enter Another Mobile.';
//$response['user'] = $user;
echo json_encode($response);
}
else{
$Sql_Query = "INSERT INTO register (Name,MobileNumber,Gender,Address,Password,Status) Values('$Full_Name','$MobileNum','$Gender','$City','$Password','$Status')";
if(mysqli_query($con,$Sql_Query))
{
$getSQL=mysqli_query($con,"SELECT * FROM register WHERE MobileNumber='$MobileNum'");
if(mysqli_num_rows($getSQL)>0)
{
$row=mysqli_fetch_assoc($getSQL);
$user = array(
'id'=>$row['id'],
'name'=>$row['Name'],
'mobilenumber'=>$row['MobileNumber'],
'gender'=>$row['Gender'],
'address'=>$row['Address'],
'password'=>$row['Password']
);
$response['error'] = false;
$response['message'] = 'Registration successfull';
$response['user'] = $user;
echo json_encode($response);
}
}
else
{
$response['error'] = false;
$response['message'] = 'Mobile Number Rr Password Did Not Match';
//$response['user'] = $user;
echo json_encode($response);
}
}
}
?>