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 1 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 1 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 1 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.