Test Setup Failed
Branch master (f3ea8f)
by Ankit
03:00
created
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.
login.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.
database.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 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');
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 7
 ?>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 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
 ?>
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
 			<a id="brand" href="#">OpenChat</a>
17 17
 			<ul class="nav-right">
18 18
 				<?php if(isset($_SESSION['start']))
19
-				{
20
-				?>
19
+                {
20
+                ?>
21 21
 				<li><a href="account.php">Account</a></li>
22 22
 				<li><a href="message.php">Message</a></li>
23 23
 				<li><a href="registration-module/source/class.logout.php">Log out</a></li>
24 24
 				<?php 
25
-				}
26
-				else
27
-				{
28
-				?>
25
+                }
26
+                else
27
+                {
28
+                ?>
29 29
 				<li><a href="login.php">Login</a></li>
30 30
 				<li><a href="register.php">Register</a></li>
31 31
 				<?php
32
-				}
33
-				?>
32
+                }
33
+                ?>
34 34
 			</ul>
35 35
 		</div>
36 36
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 		<div class="header">
16 16
 			<a id="brand" href="#">OpenChat</a>
17 17
 			<ul class="nav-right">
18
-				<?php if(isset($_SESSION['start']))
18
+				<?php if (isset($_SESSION['start']))
19 19
 				{
20 20
 				?>
21 21
 				<li><a href="account.php">Account</a></li>
Please login to merge, or discard this patch.
account.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -10,43 +10,43 @@  discard block
 block discarded – undo
10 10
 // var_dump($user);
11 11
 if(isset($_SESSION['start']) and !$user)
12 12
 {
13
-	$login_id=$_SESSION['start'];
14
-	$query="SELECT username from login where login_id='$login_id'";
15
-	if($result=$connect->query($query))
16
-	{
17
-		if($result->num_rows >0)
18
-		{
19
-			$row=$result->fetch_assoc();
20
-			$location="http://localhost/openchat/account.php/".$row['username'];
21
-			header("Location:".$location);
22
-		}
23
-	}
13
+    $login_id=$_SESSION['start'];
14
+    $query="SELECT username from login where login_id='$login_id'";
15
+    if($result=$connect->query($query))
16
+    {
17
+        if($result->num_rows >0)
18
+        {
19
+            $row=$result->fetch_assoc();
20
+            $location="http://localhost/openchat/account.php/".$row['username'];
21
+            header("Location:".$location);
22
+        }
23
+    }
24 24
 
25 25
 }
26 26
 
27 27
 else if($user)
28 28
 {
29
-	$query="SELECT * from login where username='$user'";
30
-	if($result=$connect->query($query))
31
-	{
32
-		if($result->num_rows >0)
33
-		{
34
-			$row=$result->fetch_assoc();
35
-			$id=$row['login_id'];
36
-			$query="SELECT * from profile where login_id='$id'";
37
-			if($result=$connect->query($query))
38
-			{
39
-				if($result->num_rows>0)
40
-				{
41
-					$r=$result->fetch_assoc();
42
-					$row=array_merge($row,$r);
43
-					// var_dump($row);
44
-				}
45
-			}
46
-			else
47
-			{
48
-				die("error");
49
-			}
29
+    $query="SELECT * from login where username='$user'";
30
+    if($result=$connect->query($query))
31
+    {
32
+        if($result->num_rows >0)
33
+        {
34
+            $row=$result->fetch_assoc();
35
+            $id=$row['login_id'];
36
+            $query="SELECT * from profile where login_id='$id'";
37
+            if($result=$connect->query($query))
38
+            {
39
+                if($result->num_rows>0)
40
+                {
41
+                    $r=$result->fetch_assoc();
42
+                    $row=array_merge($row,$r);
43
+                    // var_dump($row);
44
+                }
45
+            }
46
+            else
47
+            {
48
+                die("error");
49
+            }
50 50
 ?>
51 51
 	<head>
52 52
 		<title>OpenChat || Profile</title>
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
             <ul class="nav-right">
63 63
                 <li><a href="../index.php">About</a></li>
64 64
                 <?php if(isset($_SESSION['start']))
65
-				{
66
-				?>
65
+                {
66
+                ?>
67 67
 				<li><a href="../message.php">Message</a></li>
68 68
 				<li><a href="../registration-module/source/class.logout.php">Log out</a></li>
69 69
 				<?php 
70
-				}
71
-				else
72
-				{
73
-				?>
70
+                }
71
+                else
72
+                {
73
+                ?>
74 74
 				<li><a href="../login.php">Login</a></li>
75 75
 				<li><a href="../register.php">Register</a></li>
76 76
 				<?php
77
-				}
78
-				?>
77
+                }
78
+                ?>
79 79
             </ul>
80 80
         </div>
81 81
 			
@@ -92,32 +92,32 @@  discard block
 block discarded – undo
92 92
 				<div class="brief">
93 93
 					<h1 id="name">Name: <?php echo $row['name']; ?></h1><br>
94 94
 					<?php foreach ($row as $key => $value) {
95
-						if($key=='username' and $value!=null)
96
-							echo '<p>Username: '.$row["username"] .'</p><br>';
97
-						if($key=='email' and $value!=null)
98
-							echo '<p>Email Id: '.$row["email"] .'</p><br>';
99
-						if($key=='status' and $value!=null)
100
-							echo '<p>Status: '.$row["status"] .'</p><br>';
101
-						if($key=='education' and $value!=null)
102
-							echo '<p>Education: '.$row["education"] .'</p><br>';
103
-						if($key=='gender' and $value!=null)
104
-							echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
105
-					}
106
-					?>
95
+                        if($key=='username' and $value!=null)
96
+                            echo '<p>Username: '.$row["username"] .'</p><br>';
97
+                        if($key=='email' and $value!=null)
98
+                            echo '<p>Email Id: '.$row["email"] .'</p><br>';
99
+                        if($key=='status' and $value!=null)
100
+                            echo '<p>Status: '.$row["status"] .'</p><br>';
101
+                        if($key=='education' and $value!=null)
102
+                            echo '<p>Education: '.$row["education"] .'</p><br>';
103
+                        if($key=='gender' and $value!=null)
104
+                            echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
105
+                    }
106
+                    ?>
107 107
 				</div>	
108 108
 				<?php if($_SESSION['start']==$row['login_id'])
109
-				{
110
-					?>
109
+                {
110
+                    ?>
111 111
 				<div class="edit"><a href="#">Edit Profile</a></div>
112 112
 				<?php
113
-				}
114
-				?>	
113
+                }
114
+                ?>	
115 115
 			</div>	
116 116
 	
117 117
 			<?php 
118
-			if($_SESSION['start']==$row['login_id'])
119
-			{
120
-				?>
118
+            if($_SESSION['start']==$row['login_id'])
119
+            {
120
+                ?>
121 121
 		
122 122
 			<div class="boxx" id="profile">
123 123
 				<form method="post" action="../profile_generate.php">
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 				</form>
133 133
 			</div>
134 134
 			<?php
135
-			}
136
-			?>
135
+            }
136
+            ?>
137 137
 		</div>
138 138
 
139 139
 
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 
153 153
 
154 154
 <?php
155
-		}
156
-		else
157
-		{
158
-			die("Invalid User");
159
-		}
160
-	}
161
-	else
162
-	{
163
-		die("invalid");
164
-	}
155
+        }
156
+        else
157
+        {
158
+            die("Invalid User");
159
+        }
160
+    }
161
+    else
162
+    {
163
+        die("invalid");
164
+    }
165 165
 }
166 166
 else
167 167
 {
168
-	header("Location:http://localhost/openchat/index.php");
168
+    header("Location:http://localhost/openchat/index.php");
169 169
 }
170 170
 ?>
171 171
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -6,40 +6,40 @@  discard block
 block discarded – undo
6 6
 session_start();
7 7
 include 'database.php';
8 8
 $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
9
-$user=substr($_SERVER['REQUEST_URI'],22);
9
+$user = substr($_SERVER['REQUEST_URI'], 22);
10 10
 // var_dump($user);
11
-if(isset($_SESSION['start']) and !$user)
11
+if (isset($_SESSION['start']) and !$user)
12 12
 {
13
-	$login_id=$_SESSION['start'];
14
-	$query="SELECT username from login where login_id='$login_id'";
15
-	if($result=$connect->query($query))
13
+	$login_id = $_SESSION['start'];
14
+	$query = "SELECT username from login where login_id='$login_id'";
15
+	if ($result = $connect->query($query))
16 16
 	{
17
-		if($result->num_rows >0)
17
+		if ($result->num_rows > 0)
18 18
 		{
19
-			$row=$result->fetch_assoc();
20
-			$location="http://localhost/openchat/account.php/".$row['username'];
19
+			$row = $result->fetch_assoc();
20
+			$location = "http://localhost/openchat/account.php/".$row['username'];
21 21
 			header("Location:".$location);
22 22
 		}
23 23
 	}
24 24
 
25 25
 }
26 26
 
27
-else if($user)
27
+else if ($user)
28 28
 {
29
-	$query="SELECT * from login where username='$user'";
30
-	if($result=$connect->query($query))
29
+	$query = "SELECT * from login where username='$user'";
30
+	if ($result = $connect->query($query))
31 31
 	{
32
-		if($result->num_rows >0)
32
+		if ($result->num_rows > 0)
33 33
 		{
34
-			$row=$result->fetch_assoc();
35
-			$id=$row['login_id'];
36
-			$query="SELECT * from profile where login_id='$id'";
37
-			if($result=$connect->query($query))
34
+			$row = $result->fetch_assoc();
35
+			$id = $row['login_id'];
36
+			$query = "SELECT * from profile where login_id='$id'";
37
+			if ($result = $connect->query($query))
38 38
 			{
39
-				if($result->num_rows>0)
39
+				if ($result->num_rows > 0)
40 40
 				{
41
-					$r=$result->fetch_assoc();
42
-					$row=array_merge($row,$r);
41
+					$r = $result->fetch_assoc();
42
+					$row = array_merge($row, $r);
43 43
 					// var_dump($row);
44 44
 				}
45 45
 			}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             <a id="brand" href="">OpenChat</a>
62 62
             <ul class="nav-right">
63 63
                 <li><a href="../index.php">About</a></li>
64
-                <?php if(isset($_SESSION['start']))
64
+                <?php if (isset($_SESSION['start']))
65 65
 				{
66 66
 				?>
67 67
 				<li><a href="../message.php">Message</a></li>
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 				<div class="brief">
93 93
 					<h1 id="name">Name: <?php echo $row['name']; ?></h1><br>
94 94
 					<?php foreach ($row as $key => $value) {
95
-						if($key=='username' and $value!=null)
96
-							echo '<p>Username: '.$row["username"] .'</p><br>';
97
-						if($key=='email' and $value!=null)
98
-							echo '<p>Email Id: '.$row["email"] .'</p><br>';
99
-						if($key=='status' and $value!=null)
100
-							echo '<p>Status: '.$row["status"] .'</p><br>';
101
-						if($key=='education' and $value!=null)
102
-							echo '<p>Education: '.$row["education"] .'</p><br>';
103
-						if($key=='gender' and $value!=null)
104
-							echo '<p>Gender: 	'.$row["gender"] .'</p><br>';
95
+						if ($key == 'username' and $value != null)
96
+							echo '<p>Username: '.$row["username"].'</p><br>';
97
+						if ($key == 'email' and $value != null)
98
+							echo '<p>Email Id: '.$row["email"].'</p><br>';
99
+						if ($key == 'status' and $value != null)
100
+							echo '<p>Status: '.$row["status"].'</p><br>';
101
+						if ($key == 'education' and $value != null)
102
+							echo '<p>Education: '.$row["education"].'</p><br>';
103
+						if ($key == 'gender' and $value != null)
104
+							echo '<p>Gender: 	'.$row["gender"].'</p><br>';
105 105
 					}
106 106
 					?>
107 107
 				</div>	
108
-				<?php if($_SESSION['start']==$row['login_id'])
108
+				<?php if ($_SESSION['start'] == $row['login_id'])
109 109
 				{
110 110
 					?>
111 111
 				<div class="edit"><a href="#">Edit Profile</a></div>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			</div>	
116 116
 	
117 117
 			<?php 
118
-			if($_SESSION['start']==$row['login_id'])
118
+			if ($_SESSION['start'] == $row['login_id'])
119 119
 			{
120 120
 				?>
121 121
 		
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 					<label>Education : </label>
127 127
 					<input type="text" name="education" id="education" value="<?php echo $row['education']; ?>"></input>
128 128
 					<label>Gender : </label><br>
129
-					<input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender']=='Male')?'checked':'' ?>> Male<br>
130
-					<input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender']=='Female')?'checked':'' ?>> Female<br>
129
+					<input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender'] == 'Male') ? 'checked' : '' ?>> Male<br>
130
+					<input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender'] == 'Female') ? 'checked' : '' ?>> Female<br>
131 131
 					<input type="submit" name="submit" value="Done" id="submit">
132 132
 				</form>
133 133
 			</div>
Please login to merge, or discard this patch.
src/Compose.php 1 patch
Spacing   +6 added lines, -6 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__) . '/database.php');
4
+require_once (dirname(__DIR__).'/database.php');
5 5
 
6 6
 /**
7 7
 *
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
     public function SelectUser($msg)
24 24
     {
25 25
         $msg = $msg->value;
26
-        if(isset($_SESSION['start']) && isset($msg))
26
+        if (isset($_SESSION['start']) && isset($msg))
27 27
         {
28 28
             $id = $_SESSION['start'];
29 29
             $suggestion = trim($msg);
30
-            if($suggestion != "" )
30
+            if ($suggestion != "")
31 31
             {
32 32
                 $query = "SELECT * FROM login where login_id != '$id' and name like '$suggestion%' ORDER BY name DESC";
33
-                if($result = $this->connect->query($query))
33
+                if ($result = $this->connect->query($query))
34 34
                 {
35
-                    if($result->num_rows > 0)
35
+                    if ($result->num_rows > 0)
36 36
                     {
37
-                        while($row = $result->fetch_assoc())
37
+                        while ($row = $result->fetch_assoc())
38 38
                         {
39 39
                             $this->array = array_merge($this->array, [$row]);
40 40
                         }
Please login to merge, or discard this patch.
src/Time.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
     function TimeConversion($time)
17 17
     {
18 18
 
19
-        if(substr($time,4,11) == date("d M Y", time() + 16200))
20
-            $time = substr($time,16,5);
21
-        else if(substr($time,7,8) == date("M Y", time() + 16200) && substr($time, 4,2) - date("d") < 7)
22
-            $time = substr($time,0,3);
23
-        else if(substr($time,11,4) == date("Y", time() + 16200))
24
-            $time = substr($time,4,6);
19
+        if (substr($time, 4, 11) == date("d M Y", time() + 16200))
20
+            $time = substr($time, 16, 5);
21
+        else if (substr($time, 7, 8) == date("M Y", time() + 16200) && substr($time, 4, 2) - date("d") < 7)
22
+            $time = substr($time, 0, 3);
23
+        else if (substr($time, 11, 4) == date("Y", time() + 16200))
24
+            $time = substr($time, 4, 6);
25 25
         else
26
-            $time = substr($time,4,11);
26
+            $time = substr($time, 4, 11);
27 27
 
28 28
         return $time;
29 29
     }
Please login to merge, or discard this patch.
src/Models/message.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class Message extends Model
10 10
 {
11
-    protected $table='message';
11
+    protected $table = 'message';
12 12
 
13 13
     protected $fillable = ['identifier_message_number', 'message', 'sent_by', 'time'];
14 14
 }
Please login to merge, or discard this patch.
src/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 
4 4
 namespace ChatApp;
5
-require_once (dirname(__DIR__) . '/database.php');
5
+require_once (dirname(__DIR__).'/database.php');
6 6
 
7 7
 /**
8 8
 * For retreiving User Information
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
     function UserDetails($id, $para)
23 23
     {
24
-        if($para == True)
24
+        if ($para == True)
25 25
             $this->query = "SELECT * from login where login_id = '$id'";
26 26
         else
27 27
             $this->query = "SELECT * from login where username = '$id'";
28 28
         $this->result = $this->connect->query($this->query);
29
-        if($this->result->num_rows > 0)                   // if true
29
+        if ($this->result->num_rows > 0)                   // if true
30 30
         {
31 31
             $this->details = $this->result->fetch_assoc();
32 32
             return $this->details;
Please login to merge, or discard this patch.