-
Notifications
You must be signed in to change notification settings - Fork 3
/
afterjoin.php
36 lines (25 loc) · 1004 Bytes
/
afterjoin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include("config.php");
session_start();
$conn = new mysqli($host, $username, $password, $dbname);
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$roomid = mysqli_real_escape_string($conn,$_POST['roomid']);
$sql = "SELECT roomid FROM room WHERE roomid = '$roomid'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == 1) {
$_SESSION['roomid'] = $roomid;
echo "Room joined";
header("location: http://localhost:5000");
// header("location: home.html");
}
else {
$error = "Room does not exist";
header("location: http://localhost:5000");
// header("location: afterlogin_new.php");
}
}
?>