Skip to content
Snippets Groups Projects
Commit 23b4bbc0 authored by Hidayatullah Wildan Ghaly Buchary's avatar Hidayatullah Wildan Ghaly Buchary
Browse files

feat: add error 403 FORBIDDEN

parent 92412ac7
Branches
Tags
No related merge requests found
ErrorDocument 404 "/error/404.php" ErrorDocument 404 "/error/404.php"
\ No newline at end of file ErrorDocument 403 /error/403.php
\ No newline at end of file
...@@ -4,6 +4,16 @@ if (!isset($_SESSION['username'])) { ...@@ -4,6 +4,16 @@ if (!isset($_SESSION['username'])) {
header('Location: ../login'); header('Location: ../login');
return; return;
} }
if (!isset($_SESSION['isAdmin'])) {
header('Location: ../my-achievement');
return;
}
if ($_SESSION['isAdmin'] == 0) {
// Masuk ke FORBIDDEN
http_response_code(403);
header('Location: /error/403.php');
exit();
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>Error 403</title>
<link rel="stylesheet" type="text/css" href="/public/css/error.css">
</head>
<body>
<section>
<?php for ($i = 0; $i < 260; $i++) { ?>
<span></span>
<?php } ?>
<div class="random404">
<h1>403</h1>
</div>
<div class="mahasiswa">
<h1>Mahasiswa</h1>
<h1>Leveling</h1>
</div>
<div class="error404">
<div class="error404-content">
<h2>Access Denied</h2>
<p>You do not have permission to access this resource.</p>
<button id="btn" class="btn" onclick="window.location.href='/app/views/landing/'">Back to Home</button>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>Error 404</title> <title>Error 404</title>
<link rel="stylesheet" type="text/css" href="/public/css/error404.css"> <link rel="stylesheet" type="text/css" href="/public/css/error.css">
</head> </head>
<body> <body>
<section> <section>
......
File moved
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment