Test Setup Failed
Branch master (f3ea8f)
by Ankit
03:00
created
registration-module/source/class.logout.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 require_once 'database.php';
3 3
 session_start();
4 4
 $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
5
-if(isset($_SESSION['start']))
5
+if (isset($_SESSION['start']))
6 6
 {
7 7
     $id = $_SESSION['start'];
8 8
     $query = "Update login set login_status = '' where login_id = '$id'";
9
-    if($result = $connect->query($query))
9
+    if ($result = $connect->query($query))
10 10
     {
11 11
         unset($_SESSION['start']);
12 12
         header('Location: ../../index.php');
Please login to merge, or discard this patch.
registration-module/source/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.
registration-module/source/class.validate.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	{
9 9
 		$this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
10 10
 
11
-		$query="CREATE TABLE IF NOT EXISTS register (
11
+		$query = "CREATE TABLE IF NOT EXISTS register (
12 12
 			id int primary key auto_increment unique not null,
13 13
 			email varchar(255) unique not null,
14 14
 			username varchar(255) unique not null,
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 			echo "Table is not created || Query failed";
20 20
 		}
21 21
 
22
-			$query="CREATE TABLE IF NOT EXISTS login (
22
+			$query = "CREATE TABLE IF NOT EXISTS login (
23 23
 			login_id int primary key not null,
24 24
 			name varchar(255) not null,
25 25
 			email varchar(255) unique not null,
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	
36 36
 	function validate_email_in_db($email)
37 37
 	{
38
-		$query="SELECT login_id FROM login WHERE email='$email'";
39
-		if ($result=$this->connect->query($query)) 
38
+		$query = "SELECT login_id FROM login WHERE email='$email'";
39
+		if ($result = $this->connect->query($query)) 
40 40
 		{
41
-			if ($result->num_rows>0) {
41
+			if ($result->num_rows > 0) {
42 42
 				return 1;
43 43
 			}
44 44
 			else
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
 	function validate_username_in_db($username)
50 50
 	{
51
-		$query="SELECT login_id FROM login WHERE username='$username'";
52
-		if ($result=$this->connect->query($query)) {
53
-			if ($result->num_rows>0) {
51
+		$query = "SELECT login_id FROM login WHERE username='$username'";
52
+		if ($result = $this->connect->query($query)) {
53
+			if ($result->num_rows > 0) {
54 54
 				return 1;
55 55
 			}
56 56
 			else
Please login to merge, or discard this patch.
registration-module/source/class.login.php 1 patch
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.
profile_generate.php 1 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.