-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
117 lines (109 loc) · 4.14 KB
/
registration.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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php //$userdata=$this->session->userdata('username'); ?>
<?php
$data = json_decode($_POST['json'],true);
$CONNECTION=mysqli_connect("localhost","root","initial1$","LifePartner");
if(!$CONNECTION)
{
echo "Database not found or There is an error in connecting to DB!! Please fix this!!!";
exit();
}else{
//isset($_GET['action'])?$_GET['action']:'';
if(isset($_GET['action'])&& $_GET['action']=="register"){
$userName = $data['userName'];
$EmailID = $data['EmailID'];
$MobileNumber = $data['MobileNumber'];
$number = preg_replace("%[^0-9]%", "", $MobileNumber );
$length = strlen($number);
$numberlength = $length == 10;
if(isset($numberlength)&&!empty($numberlength))
{
$querySearch="Select * from RegisteredUser,Profiles where RegisteredUser.MobileNumber='$MobileNumber' and RegisteredUser.registerUserID=Profiles.registerUserID";//echo $querySearch;
}
else
{
$result= array('code'=>'400','message'=>'mobile number not correct');
print_r(json_encode($result));die;
}
$query=mysqli_query($CONNECTION,$querySearch);
$count=mysqli_num_rows($query);
while($result=mysqli_fetch_assoc($query))
{
$row[]=$result;
}
if(count($row)>0)
{
$updateRegistrationInfo="UPDATE RegisteredUser SET EmailID='$EmailID',userName='$userName' WHERE MobileNumber='$MobileNumber'";
mysqli_query($CONNECTION,$updateRegistrationInfo);
foreach ($row as $result)
{
$aa= $result['registerUserID'];
$searchResult[]= array('serverProfileId'=>$result['no'],
'category'=>$result['category'],
'gender'=>$result['gender'],
'firstName'=>$result['firstName'],
'lastName'=>$result['lastName'],
'fatherName'=>$result['fatherName'],
'dateOfBirth'=>$result['dateOfBirth'],
'no_of_kids'=>$result['noOfKids'],
'marital_status'=>$result['maritalStatus'],
'birthPlace'=>$result['birthPlace'],
'heightOfUser'=>$result['heightOfUser'],
'birthTime'=>$result['birthTime'],
'highestQualification'=>$result['highestQualification'],
'userJobProfile'=>$result['userJobProfile'],
'TypeOfBusiness'=>$result['TypeOfBusiness'],
'business'=>$result['business'],
'income'=>$result['income'],
'fatherJobProfile'=>$result['fatherJobProfile'],
'TypeOfFatherBusiness'=>$result['TypeOfFatherBusiness'],
'fatherBusiness'=>$result['fatherBusiness'],
'fatherIncome'=>$result['fatherIncome'],
'gautr'=>$result['gautr'],
'gautrNanihal'=>$result['gautrNanihal'],
'zodiacSign'=>$result['zodiacSign'],
'star'=>$result['star'],
'saturn'=>$result['saturn'],
'manglik'=>$result['manglik'],
'currentAddress'=>$result['currentAddress'],
'permanentAddress'=>$result['permanentAddress'],
'emailId'=>$result['emailId'],
'mobileNumber'=>$result['mobileNumber'],
'WhatsAppNumber'=>$result['WhatsAppNumber'],
'city'=>$result['city'],
'caste'=>$result['caste'],
'subcaste'=>$result['subcaste'],
//'imageName'=>"http://".$_SERVER['HTTP_HOST']."/images/".$result['imageName'],
//'uniqueImageId'=>"http://".$_SERVER['HTTP_HOST']."/images/".$result['uniqueImageId'],
'imageName'=>"http://lifepartner.zeroerp.com/images/".$result['imageName'],
'uniqueImageId'=>"http://lifepartner.zeroerp.com/images/".$result['uniqueImageId'],
);
}
$re= array('code'=>"100",
'result'=>"search",
'registeredId'=>$aa,
'profiles'=>$searchResult
);
print_r(json_encode($re));
}else {
$queryInsert="insert into RegisteredUser(userName,EmailID,MobileNumber) values('$userName','$EmailID','$MobileNumber') ";
mysqli_query($CONNECTION,$queryInsert);
$id=mysqli_insert_id($CONNECTION);
if (mysqli_affected_rows()>=0){
$result=mysqli_fetch_array($queryInsert);
$re=array('code'=>"200",
'result'=>"inserted",
'msg'=>'',
'registeredId'=>$id
);
print_r(json_encode($re));
}else {
$re=array('code'=>"300",
'result'=>"failled",
'registeredId'=>0
);
print_r(json_encode($re));
}
}
}elseif ($action=="addProfile"){
}
}