-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
executable file
·73 lines (65 loc) · 1.75 KB
/
home.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
session_start();
include 'dbconnect.php';
if(isset($_SESSION['username'])){
if(isset($_SESSION['touser_name'])){
unset($_SESSION['touser_name']);
}
$username=$_SESSION['username'];
$sql="SELECT * FROM kunal_user where username='$username';";
// echo $sql; die();
$result=mysqli_query($conn,$sql);
// echo $result; die();
if($result){
$row=mysqli_fetch_assoc($result);
}
else{
die();
}
$query="SELECT * FROM kunal_user where username!='$username';";
$result1=mysqli_query($conn,$query);
if($row['first_name']==""){
header("Location:profile.php");
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.css"/>
<link rel="stylesheet" type="text/css" href="home.css">
<title>
Home Page
</title>
</head>
<body>
<div class=main>
<div class="id">
<h1>Welecome <?php echo $row['first_name'];?><br>
<i>   <?php echo $username;?></i></h1>
<img src="<?php echo 'avatar/'.$row['avatar'] ?>" height=100 width=100>
<br><br><br>
<a href="logout.php">LOGOUT</a><br><br>
<a href="edit_profile.php">Edit Profile</a><br><br>
</div>
<div class="info">
<h2>Select the user to chat with</h2>
<form action="chats.php" method="POST">
<?php
while($row1=mysqli_fetch_assoc($result1)){
?>
<div class="field">
<input type="radio" value="<?php echo $row1['username'];?>" name="userchat" id="<?php echo $row1['username']; ?>">
<label for="<?php echo $row1['username'];?>"><?php echo $row1['username'];?></label><br>
</div>
<?php
}
}
else{
header('location:index.php');
}
?>
<br><br> <button type="submit" value="chat" id="chat-btn" name="chat">CHAT</button>
</form>
</div>
</div>
</body>
</html>