-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuseronline.php
More file actions
108 lines (99 loc) · 3.72 KB
/
useronline.php
File metadata and controls
108 lines (99 loc) · 3.72 KB
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Prisoner's Dilemma</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Lora' rel='stylesheet' type='text/css'>
<link href="css/stylesheet.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/custom.css" rel="stylesheet">
</head>
<body>
<!-- Navigation Bar begin -->
<header class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand/Logo and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapse" aria-expanded="false">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">Prisoner's Dilemma</a>
</div>
<!-- Collect the nav links and other content for toggling -->
<div class="collapse navbar-collapse" id="collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="profilepage.php">Home</a></li>
<li class="active"><a href="useronline.php">Who's Online</a></li>
<li><a href="playgame.php">Play Game</a></li>
<li><a href="playgame_live.php">Play Game Live</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">My Account <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="profilepage.php">My Profile</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</header><!-- end Navigation Bar -->
<!-- list of users online -->
<?php
include('connection.php');
include('session.php');
echo "<spam style ='margin-left:10px'>Not ".$login_session." ".$login_lname." ? We would appreciate if you "."<a style='text-decoration:none' href='logout.php'><strong> bug off </strong></a> ". " right away!</span>";
$online_users_query="SELECT * from users WHERE online_status='1'";
$offline_users_query="SELECT * from users WHERE online_status='0'";
$result = $dbc -> query($online_users_query);
$result1 = $dbc -> query($offline_users_query);
if ($result -> num_rows > 0)
{
?>
<div class="container">
<div class="user-list">
<ul class="list-unstyled">
<li>
<?php while ($row = $result->fetch_assoc())
{
if (($row['id']) != $login_id) {
echo " "."<div class='outerContainer green'>".
"<div class='innerContainer'>"."<a href='playgame.php?id=".$row['id']."' style='color:white'>".$row['id']."</a>"."<br />".
"</div>".
"</div>";
}
}
}
?>
</li>
<li>
<?php
if ($result1 -> num_rows > 0) {
while ($row = $result1->fetch_assoc())
{
echo " "."<div class='outerContainer red'>".
"<div class='innerContainer'>" .$row['id']."<br />".
"</div>".
"</div>";
}
}
?>
</li>
</ul>
</div>
</div>
<?php
mysqli_query($dbc, "COMMIT");
//3. ALWAYS CLOSE A DATABASE AFTER USING IT.
mysqli_close($dbc); //dbc is for connection.php
?>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type=" src=js/myscript.js"></script>
<script src="js/zsparks.js"></script>
</body>
</html>