Test Setup Failed
Push — master ( f3ea8f...027aaa )
by Ankit
02:16
created
registration-module/source/class.login.php 3 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,76 +11,76 @@
 block discarded – undo
11 11
 
12 12
 	function __construct()
13 13
 	{
14
-		$_SESSION['password']='';
15
-		$_SESSION['login']='';
16
-		$this->key=0;
17
-		$this->array_error=array();
14
+		$_SESSION['password'] = '';
15
+		$_SESSION['login'] = '';
16
+		$this->key = 0;
17
+		$this->array_error = array();
18 18
 	}
19 19
 
20
-	function _login($login,$password)
20
+	function _login($login, $password)
21 21
 	{
22 22
 		$connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
23 23
 
24
-		$this->login=trim($login);
25
-		$this->password=trim($password);
24
+		$this->login = trim($login);
25
+		$this->password = trim($password);
26 26
 
27
-		if(empty($this->login))
27
+		if (empty($this->login))
28 28
 		{
29
-			$this->key=1;
30
-			$this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]);
29
+			$this->key = 1;
30
+			$this->array_error = array_merge($this->array_error, ["login"=>"Enter the login field"]);
31 31
 		}
32
-		elseif (preg_match("/^[@]{1}$/",$this->login))
32
+		elseif (preg_match("/^[@]{1}$/", $this->login))
33 33
 		{
34
-			if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false)
34
+			if (filter_var($this->email, FILTER_VALIDATE_EMAIL) == false)
35 35
 			{
36
-			$this->key=1;
37
-			$this->array_error=array_merge($this->array_error,["login"=>"Enter correct Email address"]);
36
+			$this->key = 1;
37
+			$this->array_error = array_merge($this->array_error, ["login"=>"Enter correct Email address"]);
38 38
 			}
39 39
 		}
40
-		if(empty($this->password)) {
41
-			$this->key=1;
42
-			$this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]);
40
+		if (empty($this->password)) {
41
+			$this->key = 1;
42
+			$this->array_error = array_merge($this->array_error, ["password"=>"Enter the password"]);
43 43
 		}
44 44
 		else
45 45
 		{
46
-			$pass=md5($this->password);
46
+			$pass = md5($this->password);
47 47
 		}
48 48
 
49
-		if($this->key==0)
49
+		if ($this->key == 0)
50 50
 		{
51
-			$query="SELECT * FROM login WHERE email='$this->login' or username='$this->login'";
52
-			if ($result=$connect->query($query))
51
+			$query = "SELECT * FROM login WHERE email='$this->login' or username='$this->login'";
52
+			if ($result = $connect->query($query))
53 53
 			{
54
-				if ($result->num_rows>0)
54
+				if ($result->num_rows > 0)
55 55
 				{
56
-					$row=$result->fetch_assoc();
57
-					$login_id=$row['login_id'];
58
-					$query="SELECT id FROM register WHERE id='$login_id' and password='$pass'";
59
-					if($result=$connect->query($query))
56
+					$row = $result->fetch_assoc();
57
+					$login_id = $row['login_id'];
58
+					$query = "SELECT id FROM register WHERE id='$login_id' and password='$pass'";
59
+					if ($result = $connect->query($query))
60 60
 					{
61
-						if ($result->num_rows>0)
61
+						if ($result->num_rows > 0)
62 62
 						{
63 63
 							$query = "Update login set login_status = '1' where login_id = '$login_id'";
64
-							if($result = $connect->query($query))
64
+							if ($result = $connect->query($query))
65 65
 							{
66
-								$time=date("D d M Y H:i:s", time()+12600);	// current time
67
-								$time_id=date("YmdHis",time()+12600);
66
+								$time = date("D d M Y H:i:s", time() + 12600); // current time
67
+								$time_id = date("YmdHis", time() + 12600);
68 68
 								// $query = "Update "
69
-								$_SESSION['start']=$login_id;
69
+								$_SESSION['start'] = $login_id;
70 70
 								return json_encode(["location"=>"http://localhost/openchat/account.php"]);
71 71
 							}
72 72
 
73 73
 						}
74 74
 						else
75 75
 						{
76
-							$this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]);
76
+							$this->array_error = array_merge($this->array_error, ["password"=>"Invalid password"]);
77 77
 							return json_encode($this->array_error);
78 78
 						}
79 79
 					}
80 80
 				}
81 81
 				else
82 82
 				{
83
-					$this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]);
83
+					$this->array_error = array_merge($this->array_error, ["login"=>"Invalid username or email"]);
84 84
 					return json_encode($this->array_error);
85 85
 				}
86 86
 			}
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
 		{
29 29
 			$this->key=1;
30 30
 			$this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]);
31
-		}
32
-		elseif (preg_match("/^[@]{1}$/",$this->login))
31
+		} elseif (preg_match("/^[@]{1}$/",$this->login))
33 32
 		{
34 33
 			if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false)
35 34
 			{
@@ -40,8 +39,7 @@  discard block
 block discarded – undo
40 39
 		if(empty($this->password)) {
41 40
 			$this->key=1;
42 41
 			$this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]);
43
-		}
44
-		else
42
+		} else
45 43
 		{
46 44
 			$pass=md5($this->password);
47 45
 		}
@@ -70,23 +68,20 @@  discard block
 block discarded – undo
70 68
 								return json_encode(["location"=>"http://localhost/openchat/account.php"]);
71 69
 							}
72 70
 
73
-						}
74
-						else
71
+						} else
75 72
 						{
76 73
 							$this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]);
77 74
 							return json_encode($this->array_error);
78 75
 						}
79 76
 					}
80
-				}
81
-				else
77
+				} else
82 78
 				{
83 79
 					$this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]);
84 80
 					return json_encode($this->array_error);
85 81
 				}
86 82
 			}
87 83
 
88
-		}
89
-		else
84
+		} else
90 85
 		{
91 86
 			return json_encode($this->array_error);
92 87
 		}
Please login to merge, or discard this patch.
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -4,93 +4,93 @@
 block discarded – undo
4 4
 class login
5 5
 {
6 6
 
7
-	private $login;
8
-	private $password;
9
-	private $key;
10
-	private $array_error;
7
+    private $login;
8
+    private $password;
9
+    private $key;
10
+    private $array_error;
11 11
 
12
-	function __construct()
13
-	{
14
-		$_SESSION['password']='';
15
-		$_SESSION['login']='';
16
-		$this->key=0;
17
-		$this->array_error=array();
18
-	}
12
+    function __construct()
13
+    {
14
+        $_SESSION['password']='';
15
+        $_SESSION['login']='';
16
+        $this->key=0;
17
+        $this->array_error=array();
18
+    }
19 19
 
20
-	function _login($login,$password)
21
-	{
22
-		$connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
20
+    function _login($login,$password)
21
+    {
22
+        $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
23 23
 
24
-		$this->login=trim($login);
25
-		$this->password=trim($password);
24
+        $this->login=trim($login);
25
+        $this->password=trim($password);
26 26
 
27
-		if(empty($this->login))
28
-		{
29
-			$this->key=1;
30
-			$this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]);
31
-		}
32
-		elseif (preg_match("/^[@]{1}$/",$this->login))
33
-		{
34
-			if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false)
35
-			{
36
-			$this->key=1;
37
-			$this->array_error=array_merge($this->array_error,["login"=>"Enter correct Email address"]);
38
-			}
39
-		}
40
-		if(empty($this->password)) {
41
-			$this->key=1;
42
-			$this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]);
43
-		}
44
-		else
45
-		{
46
-			$pass=md5($this->password);
47
-		}
27
+        if(empty($this->login))
28
+        {
29
+            $this->key=1;
30
+            $this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]);
31
+        }
32
+        elseif (preg_match("/^[@]{1}$/",$this->login))
33
+        {
34
+            if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false)
35
+            {
36
+            $this->key=1;
37
+            $this->array_error=array_merge($this->array_error,["login"=>"Enter correct Email address"]);
38
+            }
39
+        }
40
+        if(empty($this->password)) {
41
+            $this->key=1;
42
+            $this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]);
43
+        }
44
+        else
45
+        {
46
+            $pass=md5($this->password);
47
+        }
48 48
 
49
-		if($this->key==0)
50
-		{
51
-			$query="SELECT * FROM login WHERE email='$this->login' or username='$this->login'";
52
-			if ($result=$connect->query($query))
53
-			{
54
-				if ($result->num_rows>0)
55
-				{
56
-					$row=$result->fetch_assoc();
57
-					$login_id=$row['login_id'];
58
-					$query="SELECT id FROM register WHERE id='$login_id' and password='$pass'";
59
-					if($result=$connect->query($query))
60
-					{
61
-						if ($result->num_rows>0)
62
-						{
63
-							$query = "Update login set login_status = '1' where login_id = '$login_id'";
64
-							if($result = $connect->query($query))
65
-							{
66
-								$time=date("D d M Y H:i:s", time()+12600);	// current time
67
-								$time_id=date("YmdHis",time()+12600);
68
-								// $query = "Update "
69
-								$_SESSION['start']=$login_id;
70
-								return json_encode(["location"=> URL."/account.php"]);
71
-							}
49
+        if($this->key==0)
50
+        {
51
+            $query="SELECT * FROM login WHERE email='$this->login' or username='$this->login'";
52
+            if ($result=$connect->query($query))
53
+            {
54
+                if ($result->num_rows>0)
55
+                {
56
+                    $row=$result->fetch_assoc();
57
+                    $login_id=$row['login_id'];
58
+                    $query="SELECT id FROM register WHERE id='$login_id' and password='$pass'";
59
+                    if($result=$connect->query($query))
60
+                    {
61
+                        if ($result->num_rows>0)
62
+                        {
63
+                            $query = "Update login set login_status = '1' where login_id = '$login_id'";
64
+                            if($result = $connect->query($query))
65
+                            {
66
+                                $time=date("D d M Y H:i:s", time()+12600);	// current time
67
+                                $time_id=date("YmdHis",time()+12600);
68
+                                // $query = "Update "
69
+                                $_SESSION['start']=$login_id;
70
+                                return json_encode(["location"=> URL."/account.php"]);
71
+                            }
72 72
 
73
-						}
74
-						else
75
-						{
76
-							$this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]);
77
-							return json_encode($this->array_error);
78
-						}
79
-					}
80
-				}
81
-				else
82
-				{
83
-					$this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]);
84
-					return json_encode($this->array_error);
85
-				}
86
-			}
73
+                        }
74
+                        else
75
+                        {
76
+                            $this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]);
77
+                            return json_encode($this->array_error);
78
+                        }
79
+                    }
80
+                }
81
+                else
82
+                {
83
+                    $this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]);
84
+                    return json_encode($this->array_error);
85
+                }
86
+            }
87 87
 
88
-		}
89
-		else
90
-		{
91
-			return json_encode($this->array_error);
92
-		}
93
-	}
88
+        }
89
+        else
90
+        {
91
+            return json_encode($this->array_error);
92
+        }
93
+    }
94 94
 }
95 95
 
96 96
 
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.
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.
registration-module/source/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.