forked from keterFree/posperity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
88 lines (77 loc) · 3.04 KB
/
index.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
<?php
session_start();
include "redisconnect.php";
$me = $_COOKIE['PHPSESSID'];
$logged = $redis->hgetall("user:$me");
// Start session
session_start();
// Close Redis connection (Predis automatically handles connections, so no explicit close is needed)
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="home.css">
<script src="https://kit.fontawesome.com/f7e75704ad.js" crossorigin="anonymous"></script>
<script src="title.js"></script>
</head>
<body>
<header>
<h1>
<?php
if ($redis->exists("user:$me")) {
echo $logged['merchantname'];
} else {
echo '<script>window.location.href = "login.php"</script>';
}
?>
</h1>
<div class="head">
<div class="menu">
<a onclick="toggleMenu()"><i class="fa-solid fa-bars"></i></a>
<div id="hide" class="navbar-toggle">
<a class="bar" href="index.php">Home</a>
<a class="bar" href="makeSale.php">Make Sale</a>
<a class="bar" href="inventory.php">Inventory</a>
<a class="bar" href="transactions.php">Transactions</a>
<a class="bar" href="about.html">About</a>
<a class="bar" href="services.html">Services</a>
<a class="bar" href="logout.php">Log out</a>
</div>
</div>
<nav class="nav" id="navbarLinks">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="makeSale.php">Make Sale</a></li>
<li><a href="inventory.php">Inventory</a></li>
<li><a href="transactions.php">Transactions</a></li>
<li><a href="about.html">About</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="logout.php"><i class="fa-regular fa-user" style="color: #ffffff;"></i> log out</a></li>
</ul>
</nav>
</div>
</header>
<div id="maindiv">
<div class="main-content" id="div2">
<?php
if (isset($logged['merchantname'])) {
// Display user details if logged in
echo "<h2> " . $logged['username'] . " </h2>";
// echo "<h2>Welcome, " . $logged['merchantid'] . "</h2>";
echo "<div class='profile-image'><img src='assets\profile.png' alt='Profile Image'></div>";
} else {
// Display login button if not logged in
echo "<a href='login.php' class='button'>Login</a>";
}
?>
</div>
</div>
<footer>
<p style="font-size: 10px;">
© 2024 posperity,all rights reserved</p>
</footer>
</body>
</html>