Test Setup Failed
Branch master (f3ea8f)
by Ankit
03:00
created
registration-module/source/class.validate.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -3,23 +3,23 @@  discard block
 block discarded – undo
3 3
 require_once 'database.php';
4 4
 class validate
5 5
 {
6
-	private $connect;
7
-	function __construct()
8
-	{
9
-		$this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
6
+    private $connect;
7
+    function __construct()
8
+    {
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,
15 15
 			password varchar(255) not null
16 16
 			) ENGINE=INNODB;";
17 17
 
18
-		if (!$this->connect->query($query)) {
19
-			echo "Table is not created || Query failed";
20
-		}
18
+        if (!$this->connect->query($query)) {
19
+            echo "Table is not created || Query failed";
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,
@@ -28,34 +28,34 @@  discard block
 block discarded – undo
28 28
 			FOREIGN KEY (login_id) REFERENCES register(id)
29 29
 			) ENGINE=INNODB;";
30 30
 		
31
-		if (!$this->connect->query($query)) {
32
-			echo "Table is not created || Query failed";
33
-		}	
34
-	}
31
+        if (!$this->connect->query($query)) {
32
+            echo "Table is not created || Query failed";
33
+        }	
34
+    }
35 35
 	
36
-	function validate_email_in_db($email)
37
-	{
38
-		$query="SELECT login_id FROM login WHERE email='$email'";
39
-		if ($result=$this->connect->query($query)) 
40
-		{
41
-			if ($result->num_rows>0) {
42
-				return 1;
43
-			}
44
-			else
45
-				return 0;
46
-		}
47
-	}
36
+    function validate_email_in_db($email)
37
+    {
38
+        $query="SELECT login_id FROM login WHERE email='$email'";
39
+        if ($result=$this->connect->query($query)) 
40
+        {
41
+            if ($result->num_rows>0) {
42
+                return 1;
43
+            }
44
+            else
45
+                return 0;
46
+        }
47
+    }
48 48
 
49
-	function validate_username_in_db($username)
50
-	{
51
-		$query="SELECT login_id FROM login WHERE username='$username'";
52
-		if ($result=$this->connect->query($query)) {
53
-			if ($result->num_rows>0) {
54
-				return 1;
55
-			}
56
-			else
57
-				return 0;
49
+    function validate_username_in_db($username)
50
+    {
51
+        $query="SELECT login_id FROM login WHERE username='$username'";
52
+        if ($result=$this->connect->query($query)) {
53
+            if ($result->num_rows>0) {
54
+                return 1;
55
+            }
56
+            else
57
+                return 0;
58 58
 			
59
-		}
60
-	}
59
+        }
60
+    }
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
registration-module/source/class.login.php 1 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"=>"http://localhost/openchat/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"=>"http://localhost/openchat/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 1 patch
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.