@@ -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 | * |
@@ -1,7 +1,7 @@ |
||
| 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'); |
|
| 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 | 7 | ?> |
@@ -16,21 +16,21 @@ |
||
| 16 | 16 | <a id="brand" href="#">OpenChat</a> |
| 17 | 17 | <ul class="nav-right"> |
| 18 | 18 | <?php if(isset($_SESSION['start'])) |
| 19 | - { |
|
| 20 | - ?> |
|
| 19 | + { |
|
| 20 | + ?> |
|
| 21 | 21 | <li><a href="account.php">Account</a></li> |
| 22 | 22 | <li><a href="message.php">Message</a></li> |
| 23 | 23 | <li><a href="registration-module/source/class.logout.php">Log out</a></li> |
| 24 | 24 | <?php |
| 25 | - } |
|
| 26 | - else |
|
| 27 | - { |
|
| 28 | - ?> |
|
| 25 | + } |
|
| 26 | + else |
|
| 27 | + { |
|
| 28 | + ?> |
|
| 29 | 29 | <li><a href="login.php">Login</a></li> |
| 30 | 30 | <li><a href="register.php">Register</a></li> |
| 31 | 31 | <?php |
| 32 | - } |
|
| 33 | - ?> |
|
| 32 | + } |
|
| 33 | + ?> |
|
| 34 | 34 | </ul> |
| 35 | 35 | </div> |
| 36 | 36 | |
@@ -10,43 +10,43 @@ discard block |
||
| 10 | 10 | // var_dump($user); |
| 11 | 11 | if(isset($_SESSION['start']) and !$user) |
| 12 | 12 | { |
| 13 | - $login_id=$_SESSION['start']; |
|
| 14 | - $query="SELECT username from login where login_id='$login_id'"; |
|
| 15 | - if($result=$connect->query($query)) |
|
| 16 | - { |
|
| 17 | - if($result->num_rows >0) |
|
| 18 | - { |
|
| 19 | - $row=$result->fetch_assoc(); |
|
| 20 | - $location="http://localhost/openchat/account.php/".$row['username']; |
|
| 21 | - header("Location:".$location); |
|
| 22 | - } |
|
| 23 | - } |
|
| 13 | + $login_id=$_SESSION['start']; |
|
| 14 | + $query="SELECT username from login where login_id='$login_id'"; |
|
| 15 | + if($result=$connect->query($query)) |
|
| 16 | + { |
|
| 17 | + if($result->num_rows >0) |
|
| 18 | + { |
|
| 19 | + $row=$result->fetch_assoc(); |
|
| 20 | + $location="http://localhost/openchat/account.php/".$row['username']; |
|
| 21 | + header("Location:".$location); |
|
| 22 | + } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | else if($user) |
| 28 | 28 | { |
| 29 | - $query="SELECT * from login where username='$user'"; |
|
| 30 | - if($result=$connect->query($query)) |
|
| 31 | - { |
|
| 32 | - if($result->num_rows >0) |
|
| 33 | - { |
|
| 34 | - $row=$result->fetch_assoc(); |
|
| 35 | - $id=$row['login_id']; |
|
| 36 | - $query="SELECT * from profile where login_id='$id'"; |
|
| 37 | - if($result=$connect->query($query)) |
|
| 38 | - { |
|
| 39 | - if($result->num_rows>0) |
|
| 40 | - { |
|
| 41 | - $r=$result->fetch_assoc(); |
|
| 42 | - $row=array_merge($row,$r); |
|
| 43 | - // var_dump($row); |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - else |
|
| 47 | - { |
|
| 48 | - die("error"); |
|
| 49 | - } |
|
| 29 | + $query="SELECT * from login where username='$user'"; |
|
| 30 | + if($result=$connect->query($query)) |
|
| 31 | + { |
|
| 32 | + if($result->num_rows >0) |
|
| 33 | + { |
|
| 34 | + $row=$result->fetch_assoc(); |
|
| 35 | + $id=$row['login_id']; |
|
| 36 | + $query="SELECT * from profile where login_id='$id'"; |
|
| 37 | + if($result=$connect->query($query)) |
|
| 38 | + { |
|
| 39 | + if($result->num_rows>0) |
|
| 40 | + { |
|
| 41 | + $r=$result->fetch_assoc(); |
|
| 42 | + $row=array_merge($row,$r); |
|
| 43 | + // var_dump($row); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + else |
|
| 47 | + { |
|
| 48 | + die("error"); |
|
| 49 | + } |
|
| 50 | 50 | ?> |
| 51 | 51 | <head> |
| 52 | 52 | <title>OpenChat || Profile</title> |
@@ -62,20 +62,20 @@ discard block |
||
| 62 | 62 | <ul class="nav-right"> |
| 63 | 63 | <li><a href="../index.php">About</a></li> |
| 64 | 64 | <?php if(isset($_SESSION['start'])) |
| 65 | - { |
|
| 66 | - ?> |
|
| 65 | + { |
|
| 66 | + ?> |
|
| 67 | 67 | <li><a href="../message.php">Message</a></li> |
| 68 | 68 | <li><a href="../registration-module/source/class.logout.php">Log out</a></li> |
| 69 | 69 | <?php |
| 70 | - } |
|
| 71 | - else |
|
| 72 | - { |
|
| 73 | - ?> |
|
| 70 | + } |
|
| 71 | + else |
|
| 72 | + { |
|
| 73 | + ?> |
|
| 74 | 74 | <li><a href="../login.php">Login</a></li> |
| 75 | 75 | <li><a href="../register.php">Register</a></li> |
| 76 | 76 | <?php |
| 77 | - } |
|
| 78 | - ?> |
|
| 77 | + } |
|
| 78 | + ?> |
|
| 79 | 79 | </ul> |
| 80 | 80 | </div> |
| 81 | 81 | |
@@ -92,32 +92,32 @@ discard block |
||
| 92 | 92 | <div class="brief"> |
| 93 | 93 | <h1 id="name">Name: <?php echo $row['name']; ?></h1><br> |
| 94 | 94 | <?php foreach ($row as $key => $value) { |
| 95 | - if($key=='username' and $value!=null) |
|
| 96 | - echo '<p>Username: '.$row["username"] .'</p><br>'; |
|
| 97 | - if($key=='email' and $value!=null) |
|
| 98 | - echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|
| 99 | - if($key=='status' and $value!=null) |
|
| 100 | - echo '<p>Status: '.$row["status"] .'</p><br>'; |
|
| 101 | - if($key=='education' and $value!=null) |
|
| 102 | - echo '<p>Education: '.$row["education"] .'</p><br>'; |
|
| 103 | - if($key=='gender' and $value!=null) |
|
| 104 | - echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|
| 105 | - } |
|
| 106 | - ?> |
|
| 95 | + if($key=='username' and $value!=null) |
|
| 96 | + echo '<p>Username: '.$row["username"] .'</p><br>'; |
|
| 97 | + if($key=='email' and $value!=null) |
|
| 98 | + echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|
| 99 | + if($key=='status' and $value!=null) |
|
| 100 | + echo '<p>Status: '.$row["status"] .'</p><br>'; |
|
| 101 | + if($key=='education' and $value!=null) |
|
| 102 | + echo '<p>Education: '.$row["education"] .'</p><br>'; |
|
| 103 | + if($key=='gender' and $value!=null) |
|
| 104 | + echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|
| 105 | + } |
|
| 106 | + ?> |
|
| 107 | 107 | </div> |
| 108 | 108 | <?php if($_SESSION['start']==$row['login_id']) |
| 109 | - { |
|
| 110 | - ?> |
|
| 109 | + { |
|
| 110 | + ?> |
|
| 111 | 111 | <div class="edit"><a href="#">Edit Profile</a></div> |
| 112 | 112 | <?php |
| 113 | - } |
|
| 114 | - ?> |
|
| 113 | + } |
|
| 114 | + ?> |
|
| 115 | 115 | </div> |
| 116 | 116 | |
| 117 | 117 | <?php |
| 118 | - if($_SESSION['start']==$row['login_id']) |
|
| 119 | - { |
|
| 120 | - ?> |
|
| 118 | + if($_SESSION['start']==$row['login_id']) |
|
| 119 | + { |
|
| 120 | + ?> |
|
| 121 | 121 | |
| 122 | 122 | <div class="boxx" id="profile"> |
| 123 | 123 | <form method="post" action="../profile_generate.php"> |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | </form> |
| 133 | 133 | </div> |
| 134 | 134 | <?php |
| 135 | - } |
|
| 136 | - ?> |
|
| 135 | + } |
|
| 136 | + ?> |
|
| 137 | 137 | </div> |
| 138 | 138 | |
| 139 | 139 | |
@@ -152,20 +152,20 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | <?php |
| 155 | - } |
|
| 156 | - else |
|
| 157 | - { |
|
| 158 | - die("Invalid User"); |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - else |
|
| 162 | - { |
|
| 163 | - die("invalid"); |
|
| 164 | - } |
|
| 155 | + } |
|
| 156 | + else |
|
| 157 | + { |
|
| 158 | + die("Invalid User"); |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + else |
|
| 162 | + { |
|
| 163 | + die("invalid"); |
|
| 164 | + } |
|
| 165 | 165 | } |
| 166 | 166 | else |
| 167 | 167 | { |
| 168 | - header("Location:http://localhost/openchat/index.php"); |
|
| 168 | + header("Location:http://localhost/openchat/index.php"); |
|
| 169 | 169 | } |
| 170 | 170 | ?> |
| 171 | 171 | |
@@ -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 |
@@ -131,6 +131,6 @@ |
||
| 131 | 131 | <?php |
| 132 | 132 | } |
| 133 | 133 | else{ |
| 134 | - header('Location:http://www.localhost/openchat/login.php'); |
|
| 134 | + header('Location:http://www.localhost/openchat/login.php'); |
|
| 135 | 135 | } |
| 136 | 136 | ?> |
@@ -3,17 +3,17 @@ |
||
| 3 | 3 | require_once '../source/class.register.php'; |
| 4 | 4 | if(isset($_POST['q'])) |
| 5 | 5 | { |
| 6 | - $register_field=json_decode($_POST['q']); |
|
| 7 | - $name=$register_field->name; |
|
| 8 | - $email=$register_field->email; |
|
| 9 | - $username=$register_field->username; |
|
| 10 | - $mob=$register_field->mob; |
|
| 11 | - $password=$register_field->password; |
|
| 12 | - $ob = new register(); |
|
| 13 | - $result=$ob->_register($name,$email,$username,$password,$mob); |
|
| 14 | - if(isset($result)) |
|
| 15 | - echo $result; |
|
| 16 | - else |
|
| 17 | - echo json_encode([]); |
|
| 6 | + $register_field=json_decode($_POST['q']); |
|
| 7 | + $name=$register_field->name; |
|
| 8 | + $email=$register_field->email; |
|
| 9 | + $username=$register_field->username; |
|
| 10 | + $mob=$register_field->mob; |
|
| 11 | + $password=$register_field->password; |
|
| 12 | + $ob = new register(); |
|
| 13 | + $result=$ob->_register($name,$email,$username,$password,$mob); |
|
| 14 | + if(isset($result)) |
|
| 15 | + echo $result; |
|
| 16 | + else |
|
| 17 | + echo json_encode([]); |
|
| 18 | 18 | } |
| 19 | 19 | ?> |
| 20 | 20 | \ No newline at end of file |
@@ -3,14 +3,14 @@ |
||
| 3 | 3 | require_once '../source/class.login.php'; |
| 4 | 4 | if(isset($_POST['q'])) |
| 5 | 5 | { |
| 6 | - $login_field=json_decode($_POST['q']); |
|
| 7 | - $login=$login_field->login; |
|
| 8 | - $password=$login_field->password; |
|
| 9 | - $ob = new login(); |
|
| 10 | - $result=$ob->_login($login,$password); |
|
| 11 | - if(isset($result)) |
|
| 12 | - echo $result; |
|
| 13 | - else |
|
| 14 | - echo json_encode([]); |
|
| 6 | + $login_field=json_decode($_POST['q']); |
|
| 7 | + $login=$login_field->login; |
|
| 8 | + $password=$login_field->password; |
|
| 9 | + $ob = new login(); |
|
| 10 | + $result=$ob->_login($login,$password); |
|
| 11 | + if(isset($result)) |
|
| 12 | + echo $result; |
|
| 13 | + else |
|
| 14 | + echo json_encode([]); |
|
| 15 | 15 | } |
| 16 | 16 | ?> |
| 17 | 17 | \ No newline at end of file |