@@ -18,14 +18,12 @@ |
||
| 18 | 18 | if($result = $connect->query($query)) |
| 19 | 19 | { |
| 20 | 20 | header('Location:'.URL.'/account.php'); |
| 21 | - } |
|
| 22 | - else |
|
| 21 | + } else |
|
| 23 | 22 | { |
| 24 | 23 | header("Location:".URL."/error.php"); |
| 25 | 24 | } |
| 26 | 25 | endif; |
| 27 | -} |
|
| 28 | -else |
|
| 26 | +} else |
|
| 29 | 27 | { |
| 30 | 28 | header("Location:".URL."/error.php"); |
| 31 | 29 | } |
@@ -36,11 +36,9 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | if(empty($email)) { |
| 38 | 38 | $this->onError(["email" => " *Enter the email address"]); |
| 39 | - } |
|
| 40 | - elseif(filter_var($email, FILTER_VALIDATE_EMAIL) == false) { |
|
| 39 | + } elseif(filter_var($email, FILTER_VALIDATE_EMAIL) == false) { |
|
| 41 | 40 | $this->onError(["email" => " *Enter correct Email address"]); |
| 42 | - } |
|
| 43 | - else |
|
| 41 | + } else |
|
| 44 | 42 | { |
| 45 | 43 | if($this->obValidate->validateEmailInDb($email) === 1) |
| 46 | 44 | { |
@@ -51,8 +49,7 @@ discard block |
||
| 51 | 49 | |
| 52 | 50 | if(empty($username)) { |
| 53 | 51 | $this->onError(["username" => " *Enter the username"]); |
| 54 | - } |
|
| 55 | - else |
|
| 52 | + } else |
|
| 56 | 53 | { |
| 57 | 54 | if($this->obValidate->validateUsernameInDb($username) === 1) |
| 58 | 55 | { |
@@ -67,16 +64,14 @@ discard block |
||
| 67 | 64 | |
| 68 | 65 | if(empty($mob)) { |
| 69 | 66 | $this->onError(["mob" => " *Enter the Mobile Number"]); |
| 70 | - } |
|
| 71 | - elseif (!preg_match("/^[0-9]{10}$/", $mob)) { |
|
| 67 | + } elseif (!preg_match("/^[0-9]{10}$/", $mob)) { |
|
| 72 | 68 | $this->onError(["mob" => " *Enter correct Mobile Number"]); |
| 73 | 69 | } |
| 74 | 70 | |
| 75 | 71 | if($this->key == 1) |
| 76 | 72 | { |
| 77 | 73 | return json_encode($this->error); |
| 78 | - } |
|
| 79 | - else |
|
| 74 | + } else |
|
| 80 | 75 | { |
| 81 | 76 | $this->key = 0; |
| 82 | 77 | $pass = md5($password); |
@@ -84,8 +79,7 @@ discard block |
||
| 84 | 79 | if(!$this->connect->query($query)) { |
| 85 | 80 | $this->key = 1; |
| 86 | 81 | echo "You are not registered || Error in registration1"; |
| 87 | - } |
|
| 88 | - else |
|
| 82 | + } else |
|
| 89 | 83 | { |
| 90 | 84 | $query = "SELECT id FROM register WHERE email = '$email'"; |
| 91 | 85 | if($result = $this->connect->query($query)) { |
@@ -96,8 +90,7 @@ discard block |
||
| 96 | 90 | if(!$this->connect->query($query)) { |
| 97 | 91 | $this->key = 1; |
| 98 | 92 | echo "You are not registered || Error in registration2"; |
| 99 | - } |
|
| 100 | - else |
|
| 93 | + } else |
|
| 101 | 94 | { |
| 102 | 95 | $query = "INSERT INTO profile VALUES('$userId', 'Joined OpenChat', 'Joined OpenChat', '')"; |
| 103 | 96 | if(!$this->connect->query($query)) { |
@@ -113,8 +106,7 @@ discard block |
||
| 113 | 106 | return json_encode([ |
| 114 | 107 | "location" => URL."/account.php" |
| 115 | 108 | ]); |
| 116 | - } |
|
| 117 | - else |
|
| 109 | + } else |
|
| 118 | 110 | { |
| 119 | 111 | return json_encode($this->error); |
| 120 | 112 | } |