-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
63 lines (57 loc) · 1.72 KB
/
admin.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin</title>
<style type="text/css">
body {
background-color: #00CCFF;
}
</style>
</head>
<body>
<?php include "./PHP_Classes/Manage.php";
session_start();
if (!isset($_SERVER['HTTPS']) || !$_SERVER['HTTPS']) { // if request is not secure, redirect to secure url
$url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header('Location: ' . $url);
//exit;
}
// check the session variable, if exist, get them
if(isset($_SESSION["user_name"]))
$user_name = $_SESSION["user_name"];
if(isset($_SESSION["user_type"]))
$user_type = $_SESSION["user_type"];
if(isset($user_name))
{
// check if it is regular user
if($user_type == "a")
{
echo "<table width='100%' align='center'>";
echo "<tr>";
echo "<td align='right' style='color: #C15BAF; font-size: 24px;'>Welcome Admin! Press here to <a href='logout.php'>logout!</a></td>";
echo "</tr>";
echo "</table>";
$manage = new Manage(Hostname, DB-username, password, Database-Name);
$manage->connect();
$manage->show_users();
$manage->get_user_name();
$manage->show_user_business_plan_information();
$manage->disconnect();
echo "<a href='register.php'>Register a New user</a>";
}
// check if it is admin user
else
if($user_type == "r")
header("location: user.php");
else
echo "Login in error";
}
else
{
echo "Please enter username and password to login<br />";
echo "Press here to <a href='index.php?'>HomePage!</a>";
}
?>
</body>
</html>