Completed
Push — master ( 0dfdea...ca2f25 )
by Ankit
02:37
created
src/Validate.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
src/Profile.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,12 +14,13 @@
 block discarded – undo
14 14
         $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
15 15
         $query = "SELECT * from profile where login_id = '$userId'";
16 16
         $result = $connect->query($query);
17
-        if($result->num_rows > 0)                   // if true
17
+        if($result->num_rows > 0) {
18
+            // if true
18 19
         {
19 20
             $details = $result->fetch_assoc();
20
-            return $details;
21 21
         }
22
-        else
22
+            return $details;
23
+        } else
23 24
         {
24 25
             return NULL;
25 26
         }
Please login to merge, or discard this patch.
logout.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
         header('Location: ../../index.php');
13 13
     }
14 14
 
15
-}
16
-else
15
+} else
17 16
 {
18 17
 	echo "Please Login";
19 18
 }
Please login to merge, or discard this patch.
ajax/validate_login.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@
 block discarded – undo
10 10
 	$password = $loginField->password;
11 11
 	$obLogin = new Login();
12 12
 	$result = $obLogin->authLogin($login, $password);
13
-	if(isset($result))
14
-		echo $result;
15
-	else
16
-		echo json_encode([]);
17
-}
18 13
\ No newline at end of file
14
+	if(isset($result)) {
15
+			echo $result;
16
+	} else {
17
+			echo json_encode([]);
18
+	}
19
+	}
19 20
\ No newline at end of file
Please login to merge, or discard this patch.
ajax/validate_register.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,9 +13,10 @@
 block discarded – undo
13 13
 	$password = $registerField->password;
14 14
 	$obRegister = new Register();
15 15
 	$result = $obRegister->authRegister($name, $email, $username, $password, $mob);
16
-	if(isset($result))
17
-		echo $result;
18
-	else
19
-		echo json_encode([]);
20
-}
16
+	if(isset($result)) {
17
+			echo $result;
18
+	} else {
19
+			echo json_encode([]);
20
+	}
21
+	}
21 22
 
Please login to merge, or discard this patch.
account.php 1 patch
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
 		$location = URL . "/account.php/". $row['username'];
20 20
 		header("Location:".$location);
21 21
 	}
22
-}
23
-elseif ($user != "account.php")
22
+} elseif ($user != "account.php")
24 23
 {
25 24
 	$obUser = new User();
26 25
 	$row = $obUser->UserDetails($user, False);
27 26
 	if($row != NULL):
28 27
 		$userId = $row['login_id'];
29 28
 		$details = Profile::getProfile($userId);
30
-		if($details != NULL)
31
-			$row = array_merge($row, $details);
32
-		else
33
-			header("Location:".URL."/error.php");
34
-?>
29
+		if($details != NULL) {
30
+					$row = array_merge($row, $details);
31
+		} else {
32
+					header("Location:".URL."/error.php");
33
+		}
34
+		?>
35 35
 
36 36
 		<!Doctype html>
37 37
 		<html>
@@ -48,10 +48,13 @@  discard block
 block discarded – undo
48 48
 		                <?php if(Session::get('start') != null): ?>
49 49
 							<li><a href="../message.php">Message</a></li>
50 50
 							<li><a href="../logout.php">Log out</a></li>
51
-						<?php else: ?>
51
+						<?php else {
52
+    : ?>
52 53
 							<li><a href="../login.php">Login</a></li>
53 54
 							<li><a href="../register.php">Register</a></li>
54
-						<?php endif; ?>
55
+						<?php endif;
56
+}
57
+?>
55 58
 		            </ul>
56 59
 		        </div>
57 60
 
@@ -65,16 +68,21 @@  discard block
 block discarded – undo
65 68
 						<div class="brief">
66 69
 							<h1 id="name">Name: <?php echo $row['name']; ?></h1><br>
67 70
 							<?php foreach ($row as $key => $value) {
68
-								if($key =='username' && $value != null)
69
-									echo '<p>Username: '.$row["username"] .'</p><br>';
70
-								if($key == 'email' && $value != null)
71
-									echo '<p>Email Id: '.$row["email"] .'</p><br>';
72
-								if($key == 'status' && $value != null)
73
-									echo '<p>Status: '.$row["status"] .'</p><br>';
74
-								if($key == 'education' && $value != null)
75
-									echo '<p>Education: '.$row["education"] .'</p><br>';
76
-								if($key == 'gender' && $value != null)
77
-									echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
71
+								if($key =='username' && $value != null) {
72
+																	echo '<p>Username: '.$row["username"] .'</p><br>';
73
+								}
74
+								if($key == 'email' && $value != null) {
75
+																	echo '<p>Email Id: '.$row["email"] .'</p><br>';
76
+								}
77
+								if($key == 'status' && $value != null) {
78
+																	echo '<p>Status: '.$row["status"] .'</p><br>';
79
+								}
80
+								if($key == 'education' && $value != null) {
81
+																	echo '<p>Education: '.$row["education"] .'</p><br>';
82
+								}
83
+								if($key == 'gender' && $value != null) {
84
+																	echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
85
+								}
78 86
 							}
79 87
 							?>
80 88
 						</div>
@@ -116,11 +124,12 @@  discard block
 block discarded – undo
116 124
 			</body>
117 125
 		</html>
118 126
 <?php
119
-	else:
127
+	else {
128
+	    :
120 129
 		header("Location:".URL."/error.php");
130
+	}
121 131
 	endif;
122
-}
123
-else
132
+} else
124 133
 {
125 134
 	header("Location: ".URL);
126 135
 }
Please login to merge, or discard this patch.
profile_generate.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,14 +18,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Register.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -36,11 +36,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.