309 lines
7.5 KiB
PHP
309 lines
7.5 KiB
PHP
<?php
|
|
session_start();
|
|
if(isset($_SESSION['username'])){
|
|
header("Location: index.php");
|
|
exit;
|
|
}
|
|
|
|
include "koneksi.php";
|
|
|
|
$error = false;
|
|
if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
|
$username = $conn->real_escape_string($_POST['username']);
|
|
$password = $_POST['password'];
|
|
|
|
$sql = "SELECT * FROM tb_admin WHERE username='$username'";
|
|
$result = $conn->query($sql);
|
|
|
|
if($result && $result->num_rows > 0){
|
|
$row = $result->fetch_assoc();
|
|
if(password_verify($password, $row['password'])){
|
|
$_SESSION['username'] = $username;
|
|
$_SESSION['role'] = $row['role'];
|
|
header("Location: index.php");
|
|
exit;
|
|
} else {
|
|
$error = true;
|
|
}
|
|
} else {
|
|
$error = true;
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Login — WebGIS Kemiskinan</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
:root {
|
|
--primary: #0891b2;
|
|
--primary-hover: #0e7490;
|
|
--primary-light: #ecfeff;
|
|
--radius: 14px;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Plus Jakarta Sans', sans-serif;
|
|
min-height: 100vh;
|
|
background: linear-gradient(135deg, #0c1a2e 0%, #0f2744 40%, #071525 100%);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 20px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Decorative background blobs */
|
|
body::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: -200px;
|
|
right: -200px;
|
|
width: 600px;
|
|
height: 600px;
|
|
background: radial-gradient(circle, rgba(8,145,178,0.15) 0%, transparent 70%);
|
|
border-radius: 50%;
|
|
pointer-events: none;
|
|
}
|
|
|
|
body::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -200px;
|
|
left: -200px;
|
|
width: 500px;
|
|
height: 500px;
|
|
background: radial-gradient(circle, rgba(8,145,178,0.1) 0%, transparent 70%);
|
|
border-radius: 50%;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.login-wrapper {
|
|
width: 100%;
|
|
max-width: 420px;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
/* Brand header */
|
|
.brand-header {
|
|
text-align: center;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.brand-icon {
|
|
width: 72px;
|
|
height: 72px;
|
|
background: linear-gradient(135deg, #0891b2, #06b6d4);
|
|
border-radius: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 32px;
|
|
margin: 0 auto 16px;
|
|
box-shadow: 0 8px 32px rgba(8,145,178,0.4);
|
|
}
|
|
|
|
.brand-title {
|
|
font-size: 24px;
|
|
font-weight: 800;
|
|
color: #fff;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.brand-sub {
|
|
font-size: 13px;
|
|
color: rgba(255,255,255,0.5);
|
|
}
|
|
|
|
/* Card */
|
|
.login-card {
|
|
background: rgba(255,255,255,0.05);
|
|
backdrop-filter: blur(20px);
|
|
border: 1px solid rgba(255,255,255,0.1);
|
|
border-radius: var(--radius);
|
|
padding: 32px;
|
|
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
color: #fff;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.card-sub {
|
|
font-size: 13px;
|
|
color: rgba(255,255,255,0.5);
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
/* Error */
|
|
.error-box {
|
|
background: rgba(239,68,68,0.15);
|
|
border: 1px solid rgba(239,68,68,0.3);
|
|
border-radius: 8px;
|
|
padding: 12px 14px;
|
|
margin-bottom: 18px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
font-size: 13px;
|
|
color: #fca5a5;
|
|
font-weight: 500;
|
|
}
|
|
|
|
/* Form */
|
|
.form-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
color: rgba(255,255,255,0.7);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
input[type="text"], input[type="password"] {
|
|
width: 100%;
|
|
background: rgba(255,255,255,0.07);
|
|
border: 1px solid rgba(255,255,255,0.12);
|
|
border-radius: 8px;
|
|
padding: 12px 14px;
|
|
font-size: 14px;
|
|
font-family: 'Plus Jakarta Sans', sans-serif;
|
|
color: #fff;
|
|
outline: none;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
input[type="text"]:focus, input[type="password"]:focus {
|
|
border-color: var(--primary);
|
|
background: rgba(8,145,178,0.08);
|
|
box-shadow: 0 0 0 3px rgba(8,145,178,0.2);
|
|
}
|
|
|
|
input::placeholder { color: rgba(255,255,255,0.3); }
|
|
|
|
.btn-login {
|
|
width: 100%;
|
|
padding: 14px;
|
|
background: linear-gradient(135deg, #0891b2, #06b6d4);
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 15px;
|
|
font-weight: 700;
|
|
font-family: 'Plus Jakarta Sans', sans-serif;
|
|
color: #fff;
|
|
cursor: pointer;
|
|
margin-top: 8px;
|
|
transition: all 0.2s;
|
|
box-shadow: 0 4px 20px rgba(8,145,178,0.4);
|
|
}
|
|
|
|
.btn-login:hover {
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 6px 28px rgba(8,145,178,0.55);
|
|
}
|
|
|
|
.btn-login:active { transform: translateY(0); }
|
|
|
|
/* Info chips at bottom */
|
|
.info-chips {
|
|
display: flex;
|
|
gap: 8px;
|
|
margin-top: 20px;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
}
|
|
|
|
.chip {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
background: rgba(255,255,255,0.06);
|
|
border: 1px solid rgba(255,255,255,0.1);
|
|
border-radius: 20px;
|
|
padding: 5px 10px;
|
|
font-size: 11px;
|
|
color: rgba(255,255,255,0.5);
|
|
}
|
|
|
|
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #22d3ee; }
|
|
|
|
/* Footer */
|
|
.footer-link {
|
|
text-align: center;
|
|
margin-top: 20px;
|
|
font-size: 12.5px;
|
|
color: rgba(255,255,255,0.35);
|
|
}
|
|
|
|
.footer-link a {
|
|
color: rgba(8,145,178,0.9);
|
|
text-decoration: none;
|
|
font-weight: 600;
|
|
transition: color 0.15s;
|
|
}
|
|
|
|
.footer-link a:hover { color: #06b6d4; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="login-wrapper">
|
|
<div class="brand-header">
|
|
<div class="brand-icon">🏠</div>
|
|
<div class="brand-title">WebGIS Kemiskinan</div>
|
|
<div class="brand-sub">Pemetaan Kemiskinan Berbasis Partisipasi Rumah Ibadah</div>
|
|
</div>
|
|
|
|
<div class="login-card">
|
|
<div class="card-title">Masuk ke Sistem</div>
|
|
<div class="card-sub">Gunakan akun Admin Kemiskinan untuk mengakses peta</div>
|
|
|
|
<?php if($error): ?>
|
|
<div class="error-box">
|
|
⚠️ Username atau password salah. Silakan coba lagi.
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<form method="POST" action="login.php">
|
|
<div class="form-group">
|
|
<label>Username</label>
|
|
<input type="text" name="username" placeholder="Masukkan username" required autofocus>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Password</label>
|
|
<input type="password" name="password" placeholder="Masukkan password" required>
|
|
</div>
|
|
<button type="submit" class="btn-login">🔑 Masuk ke Sistem Kemiskinan</button>
|
|
</form>
|
|
|
|
<div class="info-chips">
|
|
<div class="chip"><span class="dot"></span> Tempat Ibadah</div>
|
|
<div class="chip"><span class="dot"></span> Rumah Warga</div>
|
|
<div class="chip"><span class="dot"></span> Radius Bantuan</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer-link">
|
|
<a href="index.php">← Kembali ke Peta Kemiskinan</a>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|