@@ -129,8 +129,7 @@ |
||
| 129 | 129 | </html> |
| 130 | 130 | |
| 131 | 131 | <?php |
| 132 | -} |
|
| 133 | -else{ |
|
| 132 | +} else{ |
|
| 134 | 133 | header('Location:http://www.localhost/openchat/login.php'); |
| 135 | 134 | } |
| 136 | 135 | ?> |
@@ -8,9 +8,10 @@ |
||
| 8 | 8 | $password=$login_field->password; |
| 9 | 9 | $ob = new login(); |
| 10 | 10 | $result=$ob->_login($login,$password); |
| 11 | - if(isset($result)) |
|
| 12 | - echo $result; |
|
| 13 | - else |
|
| 14 | - echo json_encode([]); |
|
| 15 | -} |
|
| 11 | + if(isset($result)) { |
|
| 12 | + echo $result; |
|
| 13 | + } else { |
|
| 14 | + echo json_encode([]); |
|
| 15 | + } |
|
| 16 | + } |
|
| 16 | 17 | ?> |
| 17 | 18 | \ No newline at end of file |
@@ -76,12 +76,10 @@ discard block |
||
| 76 | 76 | if(empty($this->email)) { |
| 77 | 77 | $this->key=1; |
| 78 | 78 | $this->array_error=array_merge($this->array_error,["email"=>"Enter the email address"]); |
| 79 | - } |
|
| 80 | - elseif(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false) { |
|
| 79 | + } elseif(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false) { |
|
| 81 | 80 | $this->key=1; |
| 82 | 81 | $this->array_error=array_merge($this->array_error,["email"=>"Enter correct Email address"]); |
| 83 | - } |
|
| 84 | - else |
|
| 82 | + } else |
|
| 85 | 83 | { |
| 86 | 84 | if($this->ob->validate_email_in_db($this->email)) |
| 87 | 85 | { |
@@ -93,8 +91,7 @@ discard block |
||
| 93 | 91 | if(empty($this->username)) { |
| 94 | 92 | $this->key=1; |
| 95 | 93 | $this->array_error=array_merge($this->array_error,["username"=>"Enter the username"]); |
| 96 | - } |
|
| 97 | - else |
|
| 94 | + } else |
|
| 98 | 95 | { |
| 99 | 96 | if($this->ob->validate_username_in_db($this->username)) |
| 100 | 97 | { |
@@ -111,8 +108,7 @@ discard block |
||
| 111 | 108 | if(empty($this->mob)) { |
| 112 | 109 | $this->key=1; |
| 113 | 110 | $this->array_error=array_merge($this->array_error,["mob"=>"Enter the Mobile Number"]); |
| 114 | - } |
|
| 115 | - elseif (!preg_match("/^[0-9]{10}$/",$this->mob)) { |
|
| 111 | + } elseif (!preg_match("/^[0-9]{10}$/",$this->mob)) { |
|
| 116 | 112 | $this->key=1; |
| 117 | 113 | $this->array_error=array_merge($this->array_error,["mob"=>"Enter correct Mobile Number"]); |
| 118 | 114 | } |
@@ -120,8 +116,7 @@ discard block |
||
| 120 | 116 | if($this->key==1) |
| 121 | 117 | { |
| 122 | 118 | return json_encode($this->array_error); |
| 123 | - } |
|
| 124 | - else |
|
| 119 | + } else |
|
| 125 | 120 | { |
| 126 | 121 | $this->key=0; |
| 127 | 122 | $pass=md5($this->password); |
@@ -129,8 +124,7 @@ discard block |
||
| 129 | 124 | if(!$this->connect->query($query)) { |
| 130 | 125 | $this->key=1; |
| 131 | 126 | echo "You are not registered || Error in registration2"; |
| 132 | - } |
|
| 133 | - else |
|
| 127 | + } else |
|
| 134 | 128 | { |
| 135 | 129 | $query="SELECT id FROM register WHERE email='$this->email'"; |
| 136 | 130 | if($result=$this->connect->query($query)) { |
@@ -154,8 +148,7 @@ discard block |
||
| 154 | 148 | if ($this->key==0) { |
| 155 | 149 | $_SESSION['start']=$id; |
| 156 | 150 | return json_encode(["location"=>"http://localhost/openchat/account.php"]); |
| 157 | - } |
|
| 158 | - else |
|
| 151 | + } else |
|
| 159 | 152 | { |
| 160 | 153 | return json_encode($this->array_error); |
| 161 | 154 | } |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | header('Location: ../../index.php'); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -} |
|
| 16 | -else |
|
| 15 | +} else |
|
| 17 | 16 | { |
| 18 | 17 | echo "Please Login"; |
| 19 | 18 | } |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | if ($result->num_rows>0) { |
| 42 | 42 | return 1; |
| 43 | + } else { |
|
| 44 | + return 0; |
|
| 43 | 45 | } |
| 44 | - else |
|
| 45 | - return 0; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | if ($result=$this->connect->query($query)) { |
| 53 | 53 | if ($result->num_rows>0) { |
| 54 | 54 | return 1; |
| 55 | + } else { |
|
| 56 | + return 0; |
|
| 55 | 57 | } |
| 56 | - else |
|
| 57 | - return 0; |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $this->key=1; |
| 30 | 30 | $this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]); |
| 31 | - } |
|
| 32 | - elseif (preg_match("/^[@]{1}$/",$this->login)) |
|
| 31 | + } elseif (preg_match("/^[@]{1}$/",$this->login)) |
|
| 33 | 32 | { |
| 34 | 33 | if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false) |
| 35 | 34 | { |
@@ -40,8 +39,7 @@ discard block |
||
| 40 | 39 | if(empty($this->password)) { |
| 41 | 40 | $this->key=1; |
| 42 | 41 | $this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]); |
| 43 | - } |
|
| 44 | - else |
|
| 42 | + } else |
|
| 45 | 43 | { |
| 46 | 44 | $pass=md5($this->password); |
| 47 | 45 | } |
@@ -70,23 +68,20 @@ discard block |
||
| 70 | 68 | return json_encode(["location"=>"http://localhost/openchat/account.php"]); |
| 71 | 69 | } |
| 72 | 70 | |
| 73 | - } |
|
| 74 | - else |
|
| 71 | + } else |
|
| 75 | 72 | { |
| 76 | 73 | $this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]); |
| 77 | 74 | return json_encode($this->array_error); |
| 78 | 75 | } |
| 79 | 76 | } |
| 80 | - } |
|
| 81 | - else |
|
| 77 | + } else |
|
| 82 | 78 | { |
| 83 | 79 | $this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]); |
| 84 | 80 | return json_encode($this->array_error); |
| 85 | 81 | } |
| 86 | 82 | } |
| 87 | 83 | |
| 88 | - } |
|
| 89 | - else |
|
| 84 | + } else |
|
| 90 | 85 | { |
| 91 | 86 | return json_encode($this->array_error); |
| 92 | 87 | } |
@@ -13,25 +13,27 @@ |
||
| 13 | 13 | $row=$result->fetch_assoc(); |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | - if(trim($_POST['status'])) |
|
| 17 | - $status=$_POST['status']; |
|
| 18 | - else |
|
| 19 | - $status=$row['status']; |
|
| 20 | - if(trim($_POST['education'])) |
|
| 21 | - $edu=$_POST['education']; |
|
| 22 | - else |
|
| 23 | - $edu=$row['education']; |
|
| 24 | - if(isset($_POST['gender'])) |
|
| 25 | - $gender=$_POST['gender']; |
|
| 26 | - else |
|
| 27 | - $gender=$row['gender']; |
|
| 16 | + if(trim($_POST['status'])) { |
|
| 17 | + $status=$_POST['status']; |
|
| 18 | + } else { |
|
| 19 | + $status=$row['status']; |
|
| 20 | + } |
|
| 21 | + if(trim($_POST['education'])) { |
|
| 22 | + $edu=$_POST['education']; |
|
| 23 | + } else { |
|
| 24 | + $edu=$row['education']; |
|
| 25 | + } |
|
| 26 | + if(isset($_POST['gender'])) { |
|
| 27 | + $gender=$_POST['gender']; |
|
| 28 | + } else { |
|
| 29 | + $gender=$row['gender']; |
|
| 30 | + } |
|
| 28 | 31 | |
| 29 | 32 | $query="UPDATE profile set status='$status', education='$edu', gender='$gender' where login_id='$login_id'"; |
| 30 | 33 | if($result=$connect->query($query)) |
| 31 | 34 | { |
| 32 | 35 | header('Location: account.php'); |
| 33 | - } |
|
| 34 | - else |
|
| 36 | + } else |
|
| 35 | 37 | { |
| 36 | 38 | die("error"); |
| 37 | 39 | } |
@@ -8,9 +8,10 @@ |
||
| 8 | 8 | $password=$login_field->password; |
| 9 | 9 | $ob = new login(); |
| 10 | 10 | $result=$ob->_login($login,$password); |
| 11 | - if(isset($result)) |
|
| 12 | - echo $result; |
|
| 13 | - else |
|
| 14 | - echo json_encode([]); |
|
| 15 | -} |
|
| 11 | + if(isset($result)) { |
|
| 12 | + echo $result; |
|
| 13 | + } else { |
|
| 14 | + echo json_encode([]); |
|
| 15 | + } |
|
| 16 | + } |
|
| 16 | 17 | ?> |
| 17 | 18 | \ No newline at end of file |