pls work
This commit is contained in:
parent
3a579fc476
commit
ab876ee883
@ -12,7 +12,11 @@ if (!isset($_SESSION['user_id'])) {
|
|||||||
$result = mysqli_query($mysqli, $query);
|
$result = mysqli_query($mysqli, $query);
|
||||||
$user = mysqli_fetch_assoc($result);
|
$user = mysqli_fetch_assoc($result);
|
||||||
|
|
||||||
// Include the index page with user information
|
// Include the appropriate HTML based on user's status
|
||||||
include 'pages/index.html';
|
if ($user['isAdmin'] == 1) {
|
||||||
|
include 'pages/index_admin.html'; // Custom HTML for Admin
|
||||||
|
} else {
|
||||||
|
include 'pages/index_user.html'; // Custom HTML for regular user
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -3,17 +3,14 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Welcome</title>
|
<title>Welcome Admin</title>
|
||||||
<link rel="stylesheet" href="../styles/style.css">
|
<link rel="stylesheet" href="../styles/pages/style.css">
|
||||||
<link rel="stylesheet" href="../styles/global.css">
|
<link rel="stylesheet" href="../styles/global.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Welcome</h2>
|
<h2>Welcome</h2>
|
||||||
<?php
|
<?php
|
||||||
echo "Logged in as " . $user['username'];
|
echo "Logged in as Admin: " . $user['username'];
|
||||||
if ($user['isAdmin'] == 1) {
|
|
||||||
echo " (Admin)";
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Display Gravatar image -->
|
<!-- Display Gravatar image -->
|
26
pages/index_user.html
Normal file
26
pages/index_user.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Welcome User</title>
|
||||||
|
<link rel="stylesheet" href="../styles/pages/style.css">
|
||||||
|
<link rel="stylesheet" href="../styles/global.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>Welcome</h2>
|
||||||
|
<?php
|
||||||
|
echo "Logged in as: " . $user['username'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Display Gravatar image -->
|
||||||
|
<?php
|
||||||
|
$email = $user['email'];
|
||||||
|
$hash = md5(strtolower(trim($email)));
|
||||||
|
$gravatarUrl = "https://www.gravatar.com/avatar/$hash?s=100";
|
||||||
|
echo "<img src='$gravatarUrl' alt='Gravatar Profile Picture'>";
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a href="logout.php">Logout</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Login</title>
|
<title>Login</title>
|
||||||
<link rel="stylesheet" href="../styles/login.css">
|
<link rel="stylesheet" href="../styles/pages/login.css">
|
||||||
<link rel="stylesheet" href="../styles/global.css">
|
<link rel="stylesheet" href="../styles/global.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Register</title>
|
<title>Register</title>
|
||||||
<link rel="stylesheet" href="../styles/register.css">
|
<link rel="stylesheet" href="../styles/pages/register.css">
|
||||||
<link rel="stylesheet" href="../styles/global.css">
|
<link rel="stylesheet" href="../styles/global.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user