@@ -2,11 +2,9 @@ |
||
2 | 2 | namespace ChatApp; |
3 | 3 | use Ratchet\MessageComponentInterface; |
4 | 4 | use Ratchet\ConnectionInterface; |
5 | -use ChatApp\Models\Message; |
|
6 | 5 | use ChatApp\Reply; |
7 | 6 | use ChatApp\Conversation; |
8 | 7 | use ChatApp\Receiver; |
9 | -use ChatApp\SideBar; |
|
10 | 8 | use ChatApp\Search; |
11 | 9 | use ChatApp\Compose; |
12 | 10 |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace ChatApp; |
4 | 4 | require_once (dirname(__DIR__) . '/database.php'); |
5 | 5 | use ChatApp\User; |
6 | -use ChatApp\Time; |
|
7 | 6 | use ChatApp\Conversation; |
8 | 7 | /** |
9 | 8 | * |
@@ -8,16 +8,16 @@ |
||
8 | 8 | use ChatApp\Chat; |
9 | 9 | |
10 | 10 | $server =IoServer::factory( |
11 | - new HttpServer( |
|
12 | - new WsServer( |
|
13 | - new Chat() |
|
14 | - ) |
|
15 | - ) |
|
16 | - , |
|
17 | - 8080 |
|
18 | - ); |
|
11 | + new HttpServer( |
|
12 | + new WsServer( |
|
13 | + new Chat() |
|
14 | + ) |
|
15 | + ) |
|
16 | + , |
|
17 | + 8080 |
|
18 | + ); |
|
19 | 19 | $server->run(); |
20 | 20 | |
21 | 21 | |
22 | 22 | |
23 | - ?> |
|
24 | 23 | \ No newline at end of file |
24 | + ?> |
|
25 | 25 | \ No newline at end of file |
@@ -5,36 +5,36 @@ |
||
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 |
@@ -1,13 +1,13 @@ discard block |
||
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 |
||
18 | 18 | } |
19 | 19 | $url = $http.$host.":".$port.$fol; |
20 | 20 | return $url; |
21 | - } |
|
21 | + } |
|
22 | 22 | ?> |
@@ -131,6 +131,6 @@ |
||
131 | 131 | <?php |
132 | 132 | } |
133 | 133 | else{ |
134 | - header('Location:http://localhost/openchat'); |
|
134 | + header('Location:http://localhost/openchat'); |
|
135 | 135 | } |
136 | 136 | ?> |
@@ -4,35 +4,35 @@ |
||
4 | 4 | |
5 | 5 | class Validate |
6 | 6 | { |
7 | - protected $connect; |
|
7 | + protected $connect; |
|
8 | 8 | |
9 | - public function __construct() |
|
10 | - { |
|
11 | - $this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); |
|
12 | - } |
|
9 | + public function __construct() |
|
10 | + { |
|
11 | + $this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); |
|
12 | + } |
|
13 | 13 | |
14 | - public function validateEmailInDb($email) |
|
15 | - { |
|
16 | - $query = "SELECT login_id FROM login WHERE email = '$email'"; |
|
17 | - if ($result = $this->connect->query($query)) |
|
18 | - { |
|
19 | - if ($result->num_rows > 0) { |
|
20 | - return 1; |
|
21 | - } |
|
22 | - else |
|
23 | - return 0; |
|
24 | - } |
|
25 | - } |
|
14 | + public function validateEmailInDb($email) |
|
15 | + { |
|
16 | + $query = "SELECT login_id FROM login WHERE email = '$email'"; |
|
17 | + if ($result = $this->connect->query($query)) |
|
18 | + { |
|
19 | + if ($result->num_rows > 0) { |
|
20 | + return 1; |
|
21 | + } |
|
22 | + else |
|
23 | + return 0; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | |
27 | - function validateUsernameInDb($username) |
|
28 | - { |
|
29 | - $query = "SELECT login_id FROM login WHERE username = '$username'"; |
|
30 | - if ($result = $this->connect->query($query)) { |
|
31 | - if ($result->num_rows > 0) { |
|
32 | - return 1; |
|
33 | - } |
|
34 | - else |
|
35 | - return 0; |
|
36 | - } |
|
37 | - } |
|
27 | + function validateUsernameInDb($username) |
|
28 | + { |
|
29 | + $query = "SELECT login_id FROM login WHERE username = '$username'"; |
|
30 | + if ($result = $this->connect->query($query)) { |
|
31 | + if ($result->num_rows > 0) { |
|
32 | + return 1; |
|
33 | + } |
|
34 | + else |
|
35 | + return 0; |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
@@ -5,13 +5,13 @@ |
||
5 | 5 | |
6 | 6 | if(isset($_POST['q'])) |
7 | 7 | { |
8 | - $loginField = json_decode($_POST['q']); |
|
9 | - $login = $loginField->login; |
|
10 | - $password = $loginField->password; |
|
11 | - $obLogin = new Login(); |
|
12 | - $result = $obLogin->authLogin($login, $password); |
|
13 | - if(isset($result)) |
|
14 | - echo $result; |
|
15 | - else |
|
16 | - echo json_encode([]); |
|
8 | + $loginField = json_decode($_POST['q']); |
|
9 | + $login = $loginField->login; |
|
10 | + $password = $loginField->password; |
|
11 | + $obLogin = new Login(); |
|
12 | + $result = $obLogin->authLogin($login, $password); |
|
13 | + if(isset($result)) |
|
14 | + echo $result; |
|
15 | + else |
|
16 | + echo json_encode([]); |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -5,17 +5,17 @@ |
||
5 | 5 | |
6 | 6 | if(isset($_POST['q'])) |
7 | 7 | { |
8 | - $registerField = json_decode($_POST['q']); |
|
9 | - $name = $registerField->name; |
|
10 | - $email = $registerField->email; |
|
11 | - $username = $registerField->username; |
|
12 | - $mob = $registerField->mob; |
|
13 | - $password = $registerField->password; |
|
14 | - $obRegister = new Register(); |
|
15 | - $result = $obRegister->authRegister($name, $email, $username, $password, $mob); |
|
16 | - if(isset($result)) |
|
17 | - echo $result; |
|
18 | - else |
|
19 | - echo json_encode([]); |
|
8 | + $registerField = json_decode($_POST['q']); |
|
9 | + $name = $registerField->name; |
|
10 | + $email = $registerField->email; |
|
11 | + $username = $registerField->username; |
|
12 | + $mob = $registerField->mob; |
|
13 | + $password = $registerField->password; |
|
14 | + $obRegister = new Register(); |
|
15 | + $result = $obRegister->authRegister($name, $email, $username, $password, $mob); |
|
16 | + if(isset($result)) |
|
17 | + echo $result; |
|
18 | + else |
|
19 | + echo json_encode([]); |
|
20 | 20 | } |
21 | 21 |