This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
executable file
·111 lines (109 loc) · 4.46 KB
/
main.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
include 'functions.php';
//God damn you, what is it?!?! solve it before messing up!
if($_SESSION["password"] == ""){
header("location:index.php?er=AccessDenied");
}
// TODO solve private chat for phone devices
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>hot chat!</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/forms.css">
<link rel="stylesheet" href="css/chat.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
function openNav() {
document.getElementById("open").style.display = "none";
document.getElementById("nav").style.display = "block";
document.getElementById("nav").style.width = document.getElementById("aside").style.width;
document.getElementById("close").style.display = "block";
}
function closeNav() {
document.getElementById("close").style.display = "none";
document.getElementById("nav").style.width = "0%";
document.getElementById("open").style.display = "block";
}
</script>
</head>
<body>
<main>
<aside id="aside">
<div class="bar">
<div class="menu">
<a id="close" class="close" onclick="closeNav()"><i class="fas fa-times"></i></a>
<a id="open" onclick="openNav()"><i class="fas fa-bars"></i></a>
</div>
<input class="search" type="text" name="search" placeholder="search..."> <!-- write user searching -->
</div>
<div class="aside">
<?php
$user=$_SESSION["username"];
$res=getChats($user);
$i=1;
while($row=mysqli_fetch_array($res,1)):
if ($_SESSION["username"] == $row["usersend"]) {
?>
<a href="main.php?usr=<?php echo $row["usergive"]; ?>">
<?php
}else{
?>
<a href="main.php?usr=<?php echo $row["usersend"]; ?>">
<?php
}
?>
<div class="lists"> <!-- i add some bugs here -->
<?php
if ($_SESSION["username"] == $row["usersend"]) {
?>
<img src="pic/default.png" alt="user picture"> <!-- solve this show user pic -->
<h1><?php echo $row["usergive"]; ?></h1>
<?php
}else {
?>
<img src="pic/default.png" alt="user picture"> <!-- solve this show user pic -->
<h1><?php echo $row["usersend"]; ?></h1>
<?php
}
?>
</div>
</a>
<?php
$i=$i+1;
endwhile;
?>
</div>
<div class="nav" id="nav">
<div class="proPic">
<?php
$id=$_SESSION["id"];
$res=getPicture($id);
while($row=mysqli_fetch_array($res,1)):
?>
<img src="pic/<?php echo $row["pic"];?>" alt="profile picture" width="100px" height="100px">
<?php
endwhile;
?>
</div>
<h3><?php echo $_SESSION["username"]; ?></h3>
<a href="main.php">Home</a>
<a href="profile.php">Profile</a>
<a href="#">Messages</a>
<a href="setting.php">Setting</a>
<a href="exit.php">Exit</a>
</div>
</aside>
<article class="">
<?php
if(isset($_GET["usr"])){
include 'chat.php';
}
?>
</article>
</main>
</body>
</html>