Test Setup Failed
Push — master ( 976b69...15356d )
by Ankit
02:31
created
src/SideBar.php 2 patches
Braces   +4 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,27 +38,22 @@
 block discarded – undo
38 38
                         if($substring != $userId)
39 39
                         {
40 40
                             $this->Data($substring, $row);
41
-                        }
42
-
43
-                        else
41
+                        } else
44 42
                         {
45 43
                             $substring = substr($identifier, $length+1);
46 44
                             $this->Data($substring, $row);
47 45
                         }
48 46
                     }
49 47
                     return json_encode($this->array);
50
-                }
51
-                else
48
+                } else
52 49
                 {
53 50
                     return json_encode(null);
54 51
                 }
55
-            }
56
-            else
52
+            } else
57 53
             {
58 54
                 echo "Query Failed";
59 55
             }
60
-        }
61
-        else
56
+        } else
62 57
         {
63 58
             header('Location:../login.php');
64 59
         }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 namespace ChatApp;
4
-require_once (dirname(__DIR__) . '/config/database.php');
4
+require_once (dirname(__DIR__).'/config/database.php');
5 5
 use ChatApp\Time;
6 6
 
7 7
 /**
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function LoadSideBar($userId)
25 25
     {
26
-        if(isset($userId))
26
+        if (isset($userId))
27 27
         {
28 28
             $query = "SELECT * FROM total_message WHERE user1='$userId' or user2='$userId'  ORDER BY id DESC";
29
-            if($result = $this->connect->query($query))
29
+            if ($result = $this->connect->query($query))
30 30
             {
31 31
                 if ($result->num_rows > 0)
32 32
                 {
33 33
                     $length = strlen($userId);
34
-                    while($row = $result->fetch_assoc())
34
+                    while ($row = $result->fetch_assoc())
35 35
                     {
36 36
                         $identifier = $row['identifier'];
37 37
                         $substring = substr($identifier, 0, $length);
38
-                        if($substring != $userId)
38
+                        if ($substring != $userId)
39 39
                         {
40 40
                             $this->Data($substring, $row);
41 41
                         }
42 42
 
43 43
                         else
44 44
                         {
45
-                            $substring = substr($identifier, $length+1);
45
+                            $substring = substr($identifier, $length + 1);
46 46
                             $this->Data($substring, $row);
47 47
                         }
48 48
                     }
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
     public function Data($id, $row)
69 69
     {
70 70
         $query = "SELECT username,name,login_status,login_id from login where login_id = '$id'";
71
-        if($result = $this->connect->query($query))
71
+        if ($result = $this->connect->query($query))
72 72
         {
73
-            if($result->num_rows > 0)
73
+            if ($result->num_rows > 0)
74 74
             {
75 75
                 $fetch = $result->fetch_assoc();
76 76
                 $row['time'] = $this->obTime->TimeConversion($row['time']);
Please login to merge, or discard this patch.
cmd.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@
 block discarded – undo
8 8
 use ChatApp\Chat;
9 9
 
10 10
 $server =IoServer::factory(
11
-	new HttpServer(
12
-		new WsServer(
13
-			new Chat()
14
-			)
15
-		)
16
-	,
17
-	8080
18
-	);
11
+    new HttpServer(
12
+        new WsServer(
13
+            new Chat()
14
+            )
15
+        )
16
+    ,
17
+    8080
18
+    );
19 19
 $server->run();
20 20
 
21 21
 
22 22
 
23
- ?>
24 23
\ No newline at end of file
24
+    ?>
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 use Ratchet\WebSocket\WsServer;
8 8
 use ChatApp\Chat;
9 9
 
10
-$server =IoServer::factory(
10
+$server = IoServer::factory(
11 11
 	new HttpServer(
12 12
 		new WsServer(
13 13
 			new Chat()
Please login to merge, or discard this patch.
message.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 session_start();
3
-if(isset($_SESSION['start']) and empty($_GET['user']))
3
+if (isset($_SESSION['start']) and empty($_GET['user']))
4 4
 {
5 5
 ?>
6 6
 <!DOCTYPE html>
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 <?php
132 132
 }
133
-else{
133
+else {
134 134
 	header('Location:http://www.localhost/openchat/login.php');
135 135
 }
136 136
 ?>
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,8 +129,7 @@
 block discarded – undo
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
 ?>
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,6 +131,6 @@
 block discarded – undo
131 131
 <?php
132 132
 }
133 133
 else{
134
-	header('Location:http://localhost/openchat');
134
+    header('Location:http://localhost/openchat');
135 135
 }
136 136
 ?>
Please login to merge, or discard this patch.
profile_generate.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@
 block discarded – undo
5 5
 $login_id=$_SESSION['start'];
6 6
 if(isset($_POST['submit']))
7 7
 {
8
-	$query="SELECT * from profile where login_id='$login_id'";
9
-	if($result=$connect->query($query))
10
-	{
11
-		if($result->num_rows>0)
12
-		{
13
-			$row=$result->fetch_assoc();
14
-		}
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'];
8
+    $query="SELECT * from profile where login_id='$login_id'";
9
+    if($result=$connect->query($query))
10
+    {
11
+        if($result->num_rows>0)
12
+        {
13
+            $row=$result->fetch_assoc();
14
+        }
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'];
28 28
 
29
-	$query="UPDATE profile set status='$status', education='$edu', gender='$gender' where login_id='$login_id'";
30
-	if($result=$connect->query($query))
31
-	{
32
-		header('Location: account.php');
33
-	}
34
-	else
35
-	{
36
-		die("error");
37
-	}
29
+    $query="UPDATE profile set status='$status', education='$edu', gender='$gender' where login_id='$login_id'";
30
+    if($result=$connect->query($query))
31
+    {
32
+        header('Location: account.php');
33
+    }
34
+    else
35
+    {
36
+        die("error");
37
+    }
38 38
 }
39 39
 
40 40
 ?>
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,32 +2,32 @@
 block discarded – undo
2 2
 session_start();
3 3
 include 'database.php';
4 4
 $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
5
-$login_id=$_SESSION['start'];
6
-if(isset($_POST['submit']))
5
+$login_id = $_SESSION['start'];
6
+if (isset($_POST['submit']))
7 7
 {
8
-	$query="SELECT * from profile where login_id='$login_id'";
9
-	if($result=$connect->query($query))
8
+	$query = "SELECT * from profile where login_id='$login_id'";
9
+	if ($result = $connect->query($query))
10 10
 	{
11
-		if($result->num_rows>0)
11
+		if ($result->num_rows > 0)
12 12
 		{
13
-			$row=$result->fetch_assoc();
13
+			$row = $result->fetch_assoc();
14 14
 		}
15 15
 	}
16
-	if(trim($_POST['status']))
17
-		$status=$_POST['status'];
16
+	if (trim($_POST['status']))
17
+		$status = $_POST['status'];
18 18
 	else
19
-		$status=$row['status'];
20
-	if(trim($_POST['education']))
21
-		$edu=$_POST['education'];
19
+		$status = $row['status'];
20
+	if (trim($_POST['education']))
21
+		$edu = $_POST['education'];
22 22
 	else
23
-		$edu=$row['education'];
24
-	if(isset($_POST['gender']))
25
-		$gender=$_POST['gender'];
23
+		$edu = $row['education'];
24
+	if (isset($_POST['gender']))
25
+		$gender = $_POST['gender'];
26 26
 	else
27
-		$gender=$row['gender'];
27
+		$gender = $row['gender'];
28 28
 
29
-	$query="UPDATE profile set status='$status', education='$edu', gender='$gender' where login_id='$login_id'";
30
-	if($result=$connect->query($query))
29
+	$query = "UPDATE profile set status='$status', education='$edu', gender='$gender' where login_id='$login_id'";
30
+	if ($result = $connect->query($query))
31 31
 	{
32 32
 		header('Location: account.php');
33 33
 	}
Please login to merge, or discard this patch.
Braces   +16 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,25 +13,27 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
register.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 session_start();
3
-if(isset($_SESSION['start']))
3
+if (isset($_SESSION['start']))
4 4
 {
5 5
     header("Location: account.php");
6 6
 }
Please login to merge, or discard this patch.
src/Validate.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
 		}	
34 34
 	}
35 35
 	
36
+	/**
37
+	 * @param string $email
38
+	 */
36 39
 	function validate_email_in_db($email)
37 40
 	{
38 41
 		$query="SELECT login_id FROM login WHERE email='$email'";
@@ -46,6 +49,9 @@  discard block
 block discarded – undo
46 49
 		}
47 50
 	}
48 51
 
52
+	/**
53
+	 * @param string $username
54
+	 */
49 55
 	function validate_username_in_db($username)
50 56
 	{
51 57
 		$query="SELECT login_id FROM login WHERE username='$username'";
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,35 +4,35 @@
 block discarded – undo
4 4
 
5 5
 class Validate
6 6
 {
7
-	protected $connect;
7
+    protected $connect;
8 8
 
9
-	public function __construct()
10
-	{
11
-		$this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
12
-	}
9
+    public function __construct()
10
+    {
11
+        $this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
12
+    }
13 13
 
14
-	public function validateEmailInDb($email)
15
-	{
16
-		$query = "SELECT login_id FROM login WHERE email = '$email'";
17
-		if ($result = $this->connect->query($query))
18
-		{
19
-			if ($result->num_rows > 0) {
20
-				return 1;
21
-			}
22
-			else
23
-				return 0;
24
-		}
25
-	}
14
+    public function validateEmailInDb($email)
15
+    {
16
+        $query = "SELECT login_id FROM login WHERE email = '$email'";
17
+        if ($result = $this->connect->query($query))
18
+        {
19
+            if ($result->num_rows > 0) {
20
+                return 1;
21
+            }
22
+            else
23
+                return 0;
24
+        }
25
+    }
26 26
 
27
-	function validateUsernameInDb($username)
28
-	{
29
-		$query = "SELECT login_id FROM login WHERE username = '$username'";
30
-		if ($result = $this->connect->query($query)) {
31
-			if ($result->num_rows > 0) {
32
-				return 1;
33
-			}
34
-			else
35
-				return 0;
36
-		}
37
-	}
27
+    function validateUsernameInDb($username)
28
+    {
29
+        $query = "SELECT login_id FROM login WHERE username = '$username'";
30
+        if ($result = $this->connect->query($query)) {
31
+            if ($result->num_rows > 0) {
32
+                return 1;
33
+            }
34
+            else
35
+                return 0;
36
+        }
37
+    }
38 38
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace ChatApp;
3
-require_once (dirname(__DIR__) . '/config/database.php');
3
+require_once (dirname(__DIR__).'/config/database.php');
4 4
 
5 5
 class Validate
6 6
 {
Please login to merge, or discard this 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.
config/database.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-  // Define database connection constants
3
-  define('DB_HOST', 'localhost');
4
-  define('DB_USER', 'root');
5
-  define('DB_PASSWORD','');
6
-  define('DB_NAME', 'openchat');
7
-  define('URL', URL());
2
+    // Define database connection constants
3
+    define('DB_HOST', 'localhost');
4
+    define('DB_USER', 'root');
5
+    define('DB_PASSWORD','');
6
+    define('DB_NAME', 'openchat');
7
+    define('URL', URL());
8 8
 
9
-   function URL()
10
-  {
9
+    function URL()
10
+    {
11 11
     $http = "http://";
12 12
     $host = $_SERVER['SERVER_NAME'];
13 13
     $port = $_SERVER['SERVER_PORT'];
@@ -18,5 +18,5 @@  discard block
 block discarded – undo
18 18
     }
19 19
     $url = $http.$host.":".$port.$fol;
20 20
     return $url;
21
-  }
21
+    }
22 22
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
   // Define database connection constants
3 3
   define('DB_HOST', 'localhost');
4 4
   define('DB_USER', 'root');
5
-  define('DB_PASSWORD','');
5
+  define('DB_PASSWORD', '');
6 6
   define('DB_NAME', 'openchat');
7 7
   define('URL', URL());
8 8
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     $host = $_SERVER['SERVER_NAME'];
13 13
     $port = $_SERVER['SERVER_PORT'];
14 14
     $fol = "";
15
-    if(@$_SERVER['SERVER_ADDR']!=NULL)
15
+    if (@$_SERVER['SERVER_ADDR'] != NULL)
16 16
     {
17 17
         $fol = "/".explode('/', $_SERVER['PHP_SELF'])[1];
18 18
     }
Please login to merge, or discard this patch.
account.php 3 patches
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 		$location = URL . "/account.php/". $row['username'];
21 21
 		header("Location:".$location);
22 22
 	}
23
-}
24
-elseif ($user != "account.php")
23
+} elseif ($user != "account.php")
25 24
 {
26 25
 	$obUser = new User();
27 26
 	$row = $obUser->UserDetails($user, False);
28 27
 	if($row != NULL):
29 28
 		$userId = $row['login_id'];
30 29
 		$details = Profile::getProfile($userId);
31
-		if($details != NULL)
32
-			$row = array_merge($row, $details);
33
-		else
34
-			header("Location:".URL."/error.php");
35
-?>
30
+		if($details != NULL) {
31
+					$row = array_merge($row, $details);
32
+		} else {
33
+					header("Location:".URL."/error.php");
34
+		}
35
+		?>
36 36
 
37 37
 		<!Doctype html>
38 38
 		<html>
@@ -49,10 +49,13 @@  discard block
 block discarded – undo
49 49
 		                <?php if($session->get('start') != null): ?>
50 50
 							<li><a href="../message.php">Message</a></li>
51 51
 							<li><a href="../logout.php">Log out</a></li>
52
-						<?php else: ?>
52
+						<?php else {
53
+    : ?>
53 54
 							<li><a href="../login.php">Login</a></li>
54 55
 							<li><a href="../register.php">Register</a></li>
55
-						<?php endif; ?>
56
+						<?php endif;
57
+}
58
+?>
56 59
 		            </ul>
57 60
 		        </div>
58 61
 
@@ -66,16 +69,21 @@  discard block
 block discarded – undo
66 69
 						<div class="brief">
67 70
 							<h1 id="name">Name: <?php echo $row['name']; ?></h1><br>
68 71
 							<?php foreach ($row as $key => $value) {
69
-								if($key =='username' and $value != null)
70
-									echo '<p>Username: '.$row["username"] .'</p><br>';
71
-								if($key == 'email' and $value != null)
72
-									echo '<p>Email Id: '.$row["email"] .'</p><br>';
73
-								if($key == 'status' and $value != null)
74
-									echo '<p>Status: '.$row["status"] .'</p><br>';
75
-								if($key == 'education' and $value != null)
76
-									echo '<p>Education: '.$row["education"] .'</p><br>';
77
-								if($key == 'gender' and $value != null)
78
-									echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
72
+								if($key =='username' and $value != null) {
73
+																	echo '<p>Username: '.$row["username"] .'</p><br>';
74
+								}
75
+								if($key == 'email' and $value != null) {
76
+																	echo '<p>Email Id: '.$row["email"] .'</p><br>';
77
+								}
78
+								if($key == 'status' and $value != null) {
79
+																	echo '<p>Status: '.$row["status"] .'</p><br>';
80
+								}
81
+								if($key == 'education' and $value != null) {
82
+																	echo '<p>Education: '.$row["education"] .'</p><br>';
83
+								}
84
+								if($key == 'gender' and $value != null) {
85
+																	echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
86
+								}
79 87
 							}
80 88
 							?>
81 89
 						</div>
@@ -117,11 +125,12 @@  discard block
 block discarded – undo
117 125
 			</body>
118 126
 		</html>
119 127
 <?php
120
-	else:
128
+	else {
129
+	    :
121 130
 		header("Location:".URL."/error.php");
131
+	}
122 132
 	endif;
123
-}
124
-else
133
+} else
125 134
 {
126 135
 	header("Location: ".URL);
127 136
 }
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@  discard block
 block discarded – undo
11 11
 $userId = Session::get('start');
12 12
 if($userId != null and $user == "account.php")
13 13
 {
14
-	$obUser = new User();
15
-	$row = $obUser->UserDetails($userId, True);
14
+    $obUser = new User();
15
+    $row = $obUser->UserDetails($userId, True);
16 16
 
17
-	if($row != NULL)
18
-	{
19
-		$location = URL . "/account.php/". $row['username'];
20
-		header("Location:".$location);
21
-	}
17
+    if($row != NULL)
18
+    {
19
+        $location = URL . "/account.php/". $row['username'];
20
+        header("Location:".$location);
21
+    }
22 22
 }
23 23
 elseif ($user != "account.php")
24 24
 {
25
-	$obUser = new User();
26
-	$row = $obUser->UserDetails($user, False);
27
-	if($row != NULL):
28
-		$userId = $row['login_id'];
29
-		$details = Profile::getProfile($userId);
30
-		if($details != NULL)
31
-			$row = array_merge($row, $details);
32
-		else
33
-			header("Location:".URL."/error.php");
25
+    $obUser = new User();
26
+    $row = $obUser->UserDetails($user, False);
27
+    if($row != NULL):
28
+        $userId = $row['login_id'];
29
+        $details = Profile::getProfile($userId);
30
+        if($details != NULL)
31
+            $row = array_merge($row, $details);
32
+        else
33
+            header("Location:".URL."/error.php");
34 34
 ?>
35 35
 
36 36
 		<!Doctype html>
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 						<div class="brief">
66 66
 							<h1 id="name">Name: <?php echo $row['name']; ?></h1><br>
67 67
 							<?php foreach ($row as $key => $value) {
68
-								if($key =='username' and $value != null)
69
-									echo '<p>Username: '.$row["username"] .'</p><br>';
70
-								if($key == 'email' and $value != null)
71
-									echo '<p>Email Id: '.$row["email"] .'</p><br>';
72
-								if($key == 'status' and $value != null)
73
-									echo '<p>Status: '.$row["status"] .'</p><br>';
74
-								if($key == 'education' and $value != null)
75
-									echo '<p>Education: '.$row["education"] .'</p><br>';
76
-								if($key == 'gender' and $value != null)
77
-									echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
78
-							}
79
-							?>
68
+                                if($key =='username' and $value != null)
69
+                                    echo '<p>Username: '.$row["username"] .'</p><br>';
70
+                                if($key == 'email' and $value != null)
71
+                                    echo '<p>Email Id: '.$row["email"] .'</p><br>';
72
+                                if($key == 'status' and $value != null)
73
+                                    echo '<p>Status: '.$row["status"] .'</p><br>';
74
+                                if($key == 'education' and $value != null)
75
+                                    echo '<p>Education: '.$row["education"] .'</p><br>';
76
+                                if($key == 'gender' and $value != null)
77
+                                    echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
78
+                            }
79
+                            ?>
80 80
 						</div>
81 81
 						<?php if(Session::get('start') == $row['login_id']): ?>
82 82
 							<div class="edit">
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 					</div>
87 87
 
88 88
 					<?php
89
-						if(Session::get('start') == $row['login_id']):
90
-					?>
89
+                        if(Session::get('start') == $row['login_id']):
90
+                    ?>
91 91
 
92 92
 					<div class="boxx" id="profile">
93 93
 						<form method="post" action="../profile_generate.php">
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 						</form>
103 103
 					</div>
104 104
 					<?php
105
-						endif;
106
-					?>
105
+                        endif;
106
+                    ?>
107 107
 				</div>
108 108
 
109 109
 				<div class="footer">
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 			</body>
117 117
 		</html>
118 118
 <?php
119
-	else:
120
-		header("Location:".URL."/error.php");
121
-	endif;
119
+    else:
120
+        header("Location:".URL."/error.php");
121
+    endif;
122 122
 }
123 123
 else
124 124
 {
125
-	header("Location: ".URL);
125
+    header("Location: ".URL);
126 126
 }
127 127
 ?>
128 128
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once (__DIR__ . '/vendor/autoload.php');
4
-require_once (__DIR__ . '/config/database.php');
3
+require_once (__DIR__.'/vendor/autoload.php');
4
+require_once (__DIR__.'/config/database.php');
5 5
 use ChatApp\User;
6 6
 use ChatApp\Profile;
7 7
 use ChatApp\Session;
8 8
 
9 9
 $user = explode("/", $_SERVER['REQUEST_URI']);
10
-$user = $user[count($user)-1];
10
+$user = $user[count($user) - 1];
11 11
 $userId = Session::get('start');
12
-if($userId != null and $user == "account.php")
12
+if ($userId != null and $user == "account.php")
13 13
 {
14 14
 	$obUser = new User();
15 15
 	$row = $obUser->UserDetails($userId, True);
16 16
 
17
-	if($row != NULL)
17
+	if ($row != NULL)
18 18
 	{
19
-		$location = URL . "/account.php/". $row['username'];
19
+		$location = URL."/account.php/".$row['username'];
20 20
 		header("Location:".$location);
21 21
 	}
22 22
 }
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 {
25 25
 	$obUser = new User();
26 26
 	$row = $obUser->UserDetails($user, False);
27
-	if($row != NULL):
27
+	if ($row != NULL):
28 28
 		$userId = $row['login_id'];
29 29
 		$details = Profile::getProfile($userId);
30
-		if($details != NULL)
30
+		if ($details != NULL)
31 31
 			$row = array_merge($row, $details);
32 32
 		else
33 33
 			header("Location:".URL."/error.php");
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		            <a id="brand" href="">OpenChat</a>
46 46
 		            <ul class="nav-right">
47 47
 		                <li><a href="../index.php">About</a></li>
48
-		                <?php if(Session::get('start') != null): ?>
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 51
 						<?php else: ?>
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 						<div class="brief">
66 66
 							<h1 id="name">Name: <?php echo $row['name']; ?></h1><br>
67 67
 							<?php foreach ($row as $key => $value) {
68
-								if($key =='username' and $value != null)
69
-									echo '<p>Username: '.$row["username"] .'</p><br>';
70
-								if($key == 'email' and $value != null)
71
-									echo '<p>Email Id: '.$row["email"] .'</p><br>';
72
-								if($key == 'status' and $value != null)
73
-									echo '<p>Status: '.$row["status"] .'</p><br>';
74
-								if($key == 'education' and $value != null)
75
-									echo '<p>Education: '.$row["education"] .'</p><br>';
76
-								if($key == 'gender' and $value != null)
77
-									echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
68
+								if ($key == 'username' and $value != null)
69
+									echo '<p>Username: '.$row["username"].'</p><br>';
70
+								if ($key == 'email' and $value != null)
71
+									echo '<p>Email Id: '.$row["email"].'</p><br>';
72
+								if ($key == 'status' and $value != null)
73
+									echo '<p>Status: '.$row["status"].'</p><br>';
74
+								if ($key == 'education' and $value != null)
75
+									echo '<p>Education: '.$row["education"].'</p><br>';
76
+								if ($key == 'gender' and $value != null)
77
+									echo '<p>Gender: 	'.$row["gender"].'</p><br>';
78 78
 							}
79 79
 							?>
80 80
 						</div>
81
-						<?php if(Session::get('start') == $row['login_id']): ?>
81
+						<?php if (Session::get('start') == $row['login_id']): ?>
82 82
 							<div class="edit">
83 83
 								<a href="#">Edit Profile</a>
84 84
 							</div>
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 					</div>
87 87
 
88 88
 					<?php
89
-						if(Session::get('start') == $row['login_id']):
89
+						if (Session::get('start') == $row['login_id']):
90 90
 					?>
91 91
 
92 92
 					<div class="boxx" id="profile">
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 							<label>Education : </label>
97 97
 							<input type="text" name="education" id="education" value="<?php echo $row['education']; ?>"></input>
98 98
 							<label>Gender : </label><br>
99
-							<input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender']=='Male')?'checked':'' ?>> Male<br>
100
-							<input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender']=='Female')?'checked':'' ?>> Female<br>
99
+							<input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender'] == 'Male') ? 'checked' : '' ?>> Male<br>
100
+							<input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender'] == 'Female') ? 'checked' : '' ?>> Female<br>
101 101
 							<input type="submit" name="submit" value="Done" id="submit">
102 102
 						</form>
103 103
 					</div>
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 session_start();
3
-if(isset($_SESSION['start']))
3
+if (isset($_SESSION['start']))
4 4
 {
5 5
     header("Location: account.php");
6 6
 }
Please login to merge, or discard this patch.