-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
75 lines (71 loc) · 2.69 KB
/
Copy pathadmin.php
File metadata and controls
75 lines (71 loc) · 2.69 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
<?php
require_once('header.php');
require_once('config.php');
require_once('online_users.php');
session_start();
$email = $_SESSION['email'];
$hmnu = $_POST['hmnu'];
$hlit = $_POST['hlit'];
$id = $_SESSION['id'];
$_SESSION['id'] = $id;
$_SESSION['email'] = $email;
$name = $surname = $email = $username = '';
$sql = "SELECT * FROM users WHERE id='$id'";
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$name = $row["name"];
$surname = $row["surname"];
$email = $row["email"];
$username = $row["username"];
}
$kontrol = "SELECT admin FROM users WHERE email='$email'";
$kontrol2=mysqli_query($db,$kontrol);
$sonuc = $kontrol2->fetch_array(MYSQLI_NUM);
if($sonuc[0] > 0)
{
$admin_paneli="<div style='justify-content: center; display: flex; margin-top:-50px;'>
<a href='/digituslogin/admin.php'><font size='4'>Admin Paneli</font></a></div>";
$sql = "SELECT * FROM users WHERE active='0' AND DATEDIFF(created_at,now())";
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result) > 0)
{
$didntverify="Users didn't verify their account for more than 1 day: \n". mysqli_num_rows($result);
}
}
else {
header("Location: index.php");
}
}
else {
header("Location: index.php");
}
$logtime = "SELECT AVG(time) FROM taken_time WHERE DAY(day) = DAY('$hlit')";
$logtimex = mysqli_query($db, $logtime);
$logtimex = mysqli_fetch_assoc($logtimex);
$logtimetaken = $logtimex['AVG(time)'];
$hmny = "SELECT * FROM users WHERE active='1' AND created_at >= now() - interval '$hmnu' day";
$hmny = mysqli_query($db, $hmny);
if(mysqli_num_rows($hmny) > 0)
{
$hmnyu=mysqli_num_rows($hmny)." new users registered within $hmnu day.";
}
?>
<div class="jumbotron">
<center>
<h1>Welcome <?php echo $username.", ".$name." ".$surname; ?></h1><br>
<form class="form-horizontal" method="POST" action="admin.php">
<div class='alert alert-success' role='alert'> <b>Users Online:</b><? echo $count_user_online; ?><br> </div>
<div class='alert alert-success' role='alert'> <b>How many new users are successfully registered within a time period:</b> <? echo $hmnyu; ?>
<input type="text" name="hmnu" style="width:75px;">
<input type="submit" value="Get" class="btn btn-primary"></div>
<div class='alert alert-dark' role='alert'> <b>How long it takes to complete login (in seconds):</b> <? echo $logtimetaken; ?>
<input type="date" name="hlit" value="<?php echo date('Y-m-d h:i:s'); ?>" />
<input type="submit" value="Get" class="btn btn-primary"></div>
<div class='alert alert-danger' role='alert'>
<? echo $didntverify; ?></div>
<a href="logout.php"><button type="button" class="btn btn-danger">Logout</button></a>
</center>
</div>