Test Setup Failed
Push — master ( f3ea8f...027aaa )
by Ankit
02:16
created
database.php 1 patch
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.
registration-module/source/database.php 1 patch
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.
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"=> 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.