📁 File Manager
Editing:
/home/wvl7mof7402e/public_html/int/admin/login.php
<?php /* |-------------------------------------------------------------------------- | YARE PRINT & PACK PVT. LTD. - ADMIN LOGIN |-------------------------------------------------------------------------- | Database Table: admins | | Columns: | id | name | email | password_hash | status | created_at | updated_at |-------------------------------------------------------------------------- */ require('includes/db.php'); if (session_status() == PHP_SESSION_NONE) { session_start(); } /* |-------------------------------------------------------------------------- | ALREADY LOGGED IN |-------------------------------------------------------------------------- */ if (isset($_SESSION['ADMIN_ID'])) { header("Location: index.php"); exit(); } $error = ""; /* |-------------------------------------------------------------------------- | LOGIN PROCESS |-------------------------------------------------------------------------- */ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['login'])) { $email = trim($_POST['email'] ?? ''); $password = $_POST['password'] ?? ''; /* |-------------------------------------------------------------------------- | VALIDATION |-------------------------------------------------------------------------- */ if ($email === '' || $password === '') { $error = "Please enter your email and password."; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = "Please enter a valid email address."; } else { /* |-------------------------------------------------------------------------- | FIND ADMIN |-------------------------------------------------------------------------- */ $query = "SELECT id, name, email, password_hash, status FROM admins WHERE email = ? LIMIT 1"; $stmt = mysqli_prepare($con, $query); if ($stmt) { mysqli_stmt_bind_param( $stmt, "s", $email ); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); if ($result && mysqli_num_rows($result) === 1) { $admin = mysqli_fetch_assoc($result); /* |-------------------------------------------------------------------------- | CHECK STATUS |-------------------------------------------------------------------------- */ if ((int)$admin['status'] !== 1) { $error = "Your admin account is inactive."; } /* |-------------------------------------------------------------------------- | CHECK PASSWORD |-------------------------------------------------------------------------- */ elseif ( password_verify( $password, $admin['password_hash'] ) ) { /* |-------------------------------------------------------------------------- | SECURE SESSION |-------------------------------------------------------------------------- */ session_regenerate_id(true); $_SESSION['ADMIN_ID'] = $admin['id']; $_SESSION['ADMIN_NAME'] = $admin['name']; $_SESSION['ADMIN_EMAIL'] = $admin['email']; $_SESSION['ADMIN_LOGIN'] = 'yes'; /* |-------------------------------------------------------------------------- | DASHBOARD |-------------------------------------------------------------------------- */ header("Location: index.php"); exit(); } else { $error = "Invalid email or password."; } } else { $error = "Invalid email or password."; } mysqli_stmt_close($stmt); } else { $error = "Database error. Please try again."; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" > <title>Admin Login </title> <!-- ========================================================= GOOGLE FONT ========================================================= --> <link rel="preconnect" href="https://fonts.googleapis.com" > <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin > <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@500;600;700;800&display=swap" rel="stylesheet" > <!-- ========================================================= FONT AWESOME ========================================================= --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" > <style> /* ========================================================= ROOT COLORS ========================================================= */ :root{ --navy:#17133D; --navy-dark:#0D0A27; --purple:#7A1974; --magenta:#B5298A; --pink:#D43A9B; --yellow:#F4C400; --yellow-light:#FFE56A; --white:#FFFFFF; --off-white:#FAF9FF; --text:#19172A; --muted:#7A788A; --border:#E9E7F1; --danger:#C62828; } /* ========================================================= RESET ========================================================= */ *{ margin:0; padding:0; box-sizing:border-box; } /* ========================================================= BODY ========================================================= */ html{ min-height:100%; } body{ min-height:100vh; font-family: "Inter", Arial, sans-serif; background: radial-gradient( circle at 5% 10%, rgba(212,58,155,.20), transparent 30% ), radial-gradient( circle at 95% 90%, rgba(244,196,0,.16), transparent 30% ), linear-gradient( 135deg, #0D0A27 0%, #17133D 48%, #24144B 100% ); display:flex; justify-content:center; align-items:center; padding:25px; overflow-x:hidden; } /* ========================================================= BACKGROUND SHAPES ========================================================= */ .bg-shape{ position:fixed; border-radius:50%; pointer-events:none; z-index:0; filter:blur(1px); } .bg-shape.one{ width:500px; height:500px; top:-280px; left:-250px; border: 1px solid rgba(244,196,0,.16); box-shadow: 0 0 100px rgba(181,41,138,.12); } .bg-shape.two{ width:430px; height:430px; right:-230px; bottom:-250px; border: 1px solid rgba(255,255,255,.09); } .bg-shape.three{ width:120px; height:120px; left:13%; bottom:12%; background: rgba(244,196,0,.06); filter:blur(30px); } /* ========================================================= MAIN WRAPPER ========================================================= */ .login-wrapper{ width:100%; max-width:1120px; min-height:650px; display:grid; grid-template-columns: 1fr 1fr; position:relative; z-index:2; overflow:hidden; border-radius:30px; background:#FFFFFF; box-shadow: 0 40px 100px rgba(0,0,0,.45); } /* ========================================================= BRAND PANEL ========================================================= */ .brand-panel{ position:relative; overflow:hidden; display:flex; flex-direction:column; justify-content:center; padding:65px; color:#FFFFFF; background: linear-gradient( 145deg, #0D0A27 0%, #17133D 48%, #58104F 100% ); } /* decorative rings */ .brand-panel::before{ content:""; position:absolute; width:500px; height:500px; border-radius:50%; right:-290px; top:-180px; border: 1px solid rgba(244,196,0,.18); } .brand-panel::after{ content:""; position:absolute; width:320px; height:320px; border-radius:50%; left:-210px; bottom:-190px; border: 1px solid rgba(181,41,138,.25); } /* ========================================================= BRAND TOP ========================================================= */ .brand-content{ position:relative; z-index:3; } /* ========================================================= LOGO ========================================================= */ .logo-box{ width:112px; height:112px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:#FFFFFF; padding:6px; margin-bottom:28px; border: 5px solid var(--yellow); box-shadow: 0 18px 45px rgba(0,0,0,.30), 0 0 0 6px rgba(255,255,255,.06); } .logo-box img{ width:100%; height:100%; object-fit:contain; border-radius:50%; } /* ========================================================= BRAND NAME ========================================================= */ .company-small{ font-size:12px; font-weight:800; letter-spacing:3px; text-transform:uppercase; color:var(--yellow); margin-bottom:14px; } .brand-panel h1{ font-family: "Manrope", sans-serif; font-size:43px; line-height:1.08; font-weight:800; letter-spacing:-1.7px; margin-bottom:20px; } .brand-panel h1 span{ color:var(--yellow); } .brand-description{ max-width:440px; color: rgba( 255, 255, 255, .70 ); font-size:14px; line-height:1.85; } /* ========================================================= FEATURE LIST ========================================================= */ .features{ margin-top:38px; display:flex; flex-direction:column; gap:15px; } .feature{ display:flex; align-items:center; gap:13px; color: rgba( 255, 255, 255, .88 ); font-size:12px; font-weight:500; } .feature-icon{ width:37px; height:37px; flex-shrink:0; border-radius:11px; display:flex; align-items:center; justify-content:center; color:var(--yellow); background: rgba( 255, 255, 255, .07 ); border: 1px solid rgba( 255, 255, 255, .10 ); } /* ========================================================= FORM PANEL ========================================================= */ .form-panel{ position:relative; background: linear-gradient( 180deg, #FFFFFF 0%, #FCFBFF 100% ); display:flex; justify-content:center; align-items:center; padding:55px; } /* ========================================================= FORM CONTENT ========================================================= */ .form-content{ width:100%; max-width:410px; } /* ========================================================= MOBILE LOGO ========================================================= */ .mobile-logo{ display:none; } /* ========================================================= FORM HEADING ========================================================= */ .form-title{ font-family: "Manrope", sans-serif; font-size:32px; font-weight:800; color:var(--text); letter-spacing:-1px; margin-bottom:8px; } .form-subtitle{ color:var(--muted); font-size:13px; line-height:1.6; margin-bottom:30px; } /* ========================================================= ERROR ========================================================= */ .error-message{ display:flex; align-items:flex-start; gap:11px; width:100%; padding:13px 15px; margin-bottom:22px; border-radius:13px; color:#A51E1E; background:#FFF3F3; border: 1px solid #FFD5D5; font-size:12px; line-height:1.5; animation: errorIn .35s ease; } .error-message i{ margin-top:2px; font-size:15px; } @keyframes errorIn{ from{ opacity:0; transform: translateY(-7px); } to{ opacity:1; transform: translateY(0); } } /* ========================================================= LABEL ========================================================= */ .form-label{ display:block; margin-bottom:8px; color:#383549; font-size:12px; font-weight:700; } /* ========================================================= INPUT GROUP ========================================================= */ .input-group{ position:relative; margin-bottom:20px; } /* ========================================================= LEFT ICON ========================================================= */ .input-icon{ position:absolute; left:17px; top:50%; transform: translateY(-50%); color:#9995A8; font-size:14px; pointer-events:none; transition:.25s; } /* ========================================================= INPUT ========================================================= */ .form-input{ width:100%; height:56px; padding: 0 48px; border: 1px solid var(--border); border-radius:14px; outline:none; background:#FFFFFF; color:var(--text); font-family:inherit; font-size:13px; transition: border-color .25s ease, box-shadow .25s ease, background .25s ease; } .form-input::placeholder{ color:#B0ADBA; } .form-input:hover{ border-color:#D7D4E1; } .form-input:focus{ border-color: var(--magenta); background:#FFFFFF; box-shadow: 0 0 0 4px rgba( 181, 41, 138, .09 ); } .input-group:focus-within .input-icon{ color: var(--magenta); } /* ========================================================= PASSWORD TOGGLE ========================================================= */ .password-toggle{ position:absolute; right:15px; top:50%; transform: translateY(-50%); width:32px; height:32px; display:flex; align-items:center; justify-content:center; border:0; outline:0; border-radius:9px; background:transparent; color:#9995A8; cursor:pointer; transition:.2s; } .password-toggle:hover{ color:var(--magenta); background:#F8F0F7; } /* ========================================================= LOGIN BUTTON ========================================================= */ .login-button{ width:100%; height:56px; border:0; outline:0; border-radius:14px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:10px; color:#FFFFFF; font-family:inherit; font-size:13px; font-weight:800; letter-spacing:.2px; background: linear-gradient( 135deg, var(--magenta) 0%, var(--purple) 100% ); box-shadow: 0 13px 28px rgba( 181, 41, 138, .25 ); transition: transform .2s ease, box-shadow .2s ease; } .login-button:hover{ transform: translateY(-2px); box-shadow: 0 17px 35px rgba( 181, 41, 138, .33 ); } .login-button:active{ transform: translateY(0); } /* ========================================================= BUTTON LOADING ========================================================= */ .login-button.loading{ pointer-events:none; opacity:.85; } .login-button .spinner{ width:16px; height:16px; border: 2px solid rgba( 255, 255, 255, .35 ); border-top-color:#FFFFFF; border-radius:50%; animation: spin .7s linear infinite; } @keyframes spin{ to{ transform:rotate(360deg); } } /* ========================================================= SECURITY BADGE ========================================================= */ .security-badge{ display:flex; align-items:center; justify-content:center; gap:7px; margin-top:21px; color:#9B98A8; font-size:10px; font-weight:500; } .security-badge i{ color: #3B9C68; font-size:12px; } /* ========================================================= FOOTER ========================================================= */ .login-footer{ text-align:center; margin-top:28px; padding-top:20px; border-top: 1px solid #F0EEF4; color:#AAA7B4; font-size:10px; line-height:1.7; } .login-footer strong{ color:#716D7E; font-weight:700; } /* ========================================================= YELLOW ACCENT ========================================================= */ .yellow-line{ width:48px; height:4px; border-radius:50px; margin-top:23px; background: linear-gradient( 90deg, var(--yellow), var(--yellow-light) ); } /* ========================================================= RESPONSIVE TABLET ========================================================= */ @media(max-width:900px){ body{ padding:16px; } .login-wrapper{ max-width:520px; min-height:auto; grid-template-columns:1fr; border-radius:25px; } .brand-panel{ padding:38px 35px; text-align:center; } .brand-panel h1{ font-size:34px; } .brand-description{ margin-left:auto; margin-right:auto; } .logo-box{ width:92px; height:92px; margin-left:auto; margin-right:auto; margin-bottom:20px; } .company-small{ font-size:10px; letter-spacing:2px; } .features{ display:none; } .yellow-line{ margin-left:auto; margin-right:auto; } .form-panel{ padding:40px 30px 35px; } } /* ========================================================= MOBILE ========================================================= */ @media(max-width:520px){ body{ padding:10px; align-items:flex-start; padding-top:20px; padding-bottom:20px; } .login-wrapper{ border-radius:21px; box-shadow: 0 25px 60px rgba(0,0,0,.35); } .brand-panel{ padding:30px 22px; } .brand-panel h1{ font-size:29px; letter-spacing:-1px; } .brand-description{ font-size:12px; line-height:1.7; } .logo-box{ width:82px; height:82px; border-width:4px; } .form-panel{ padding:32px 21px 27px; } .form-title{ font-size:27px; } .form-subtitle{ font-size:12px; margin-bottom:25px; } .form-input{ height:53px; font-size:12px; } .login-button{ height:53px; } .login-footer{ margin-top:23px; } } /* ========================================================= SMALL MOBILE ========================================================= */ @media(max-width:360px){ .brand-panel h1{ font-size:25px; } .brand-description{ font-size:11px; } .form-panel{ padding-left:17px; padding-right:17px; } } /* ========================================================= REDUCED MOTION ========================================================= */ @media(prefers-reduced-motion:reduce){ *{ animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; } } </style> </head> <body> <!-- ========================================================= BACKGROUND ========================================================= --> <div class="bg-shape one"></div> <div class="bg-shape two"></div> <div class="bg-shape three"></div> <!-- ========================================================= MAIN LOGIN ========================================================= --> <div class="login-wrapper"> <!-- ===================================================== BRAND PANEL ====================================================== --> <section class="brand-panel"> <div class="brand-content"> <!-- LOGO --> <div class="logo-box"> <img src="images/logo.png" alt="Yare Print & Pack Pvt. Ltd." > </div> <!-- COMPANY --> <div class="company-small"> International Adventures Overseas Services </div> <!-- HEADING --> <h1> Welcome Back,<br> <span>Admin.</span> </h1> <!-- DESCRIPTION --> <p class="brand-description"> Securely manage your business operations, products, orders, customers and reports from one modern administration panel. </p> <div class="yellow-line"></div> <!-- FEATURES --> <div class="features"> <div class="feature"> <div class="feature-icon"> <i class="fa-solid fa-shield-halved"></i> </div> <span> Secure administrator access </span> </div> <div class="feature"> <div class="feature-icon"> <i class="fa-solid fa-chart-line"></i> </div> <span> Manage your business dashboard </span> </div> <div class="feature"> <div class="feature-icon"> <i class="fa-solid fa-lock"></i> </div> <span> Protected account authentication </span> </div> </div> </div> </section> <!-- ===================================================== FORM PANEL ====================================================== --> <section class="form-panel"> <div class="form-content"> <!-- TITLE --> <h2 class="form-title"> Admin Login </h2> <p class="form-subtitle"> Sign in to continue to your administration dashboard. </p> <!-- ================================================= ERROR MESSAGE ================================================== --> <?php if ($error !== "") { ?> <div class="error-message"> <i class="fa-solid fa-circle-exclamation"></i> <span> <?php echo htmlspecialchars($error); ?> </span> </div> <?php } ?> <!-- ================================================= LOGIN FORM ================================================== --> <form method="POST" autocomplete="off" id="loginForm" > <!-- EMAIL --> <label class="form-label" for="email" > Email Address </label> <div class="input-group"> <i class="fa-regular fa-envelope input-icon" ></i> <input type="email" name="email" id="email" class="form-input" placeholder="Enter your email address" value="<?php echo htmlspecialchars( $_POST['email'] ?? '' ); ?>" maxlength="150" autocomplete="username" required > </div> <!-- PASSWORD --> <label class="form-label" for="password" > Password </label> <div class="input-group"> <i class="fa-solid fa-lock input-icon" ></i> <input type="password" name="password" id="password" class="form-input" placeholder="Enter your password" autocomplete="current-password" required > <button type="button" class="password-toggle" id="passwordToggle" aria-label="Show password" > <i class="fa-regular fa-eye" id="eyeIcon" ></i> </button> </div> <!-- LOGIN BUTTON --> <button type="submit" name="login" class="login-button" id="loginButton" > <i class="fa-solid fa-arrow-right-to-bracket" id="loginIcon" ></i> <span id="loginText"> Sign In </span> </button> </form> <!-- ================================================= SECURITY ================================================== --> <div class="security-badge"> <i class="fa-solid fa-circle-check"></i> Secure Admin Login </div> <!-- ================================================= FOOTER ================================================== --> <div class="login-footer"> © <?php echo date('Y'); ?> <strong> Yare Print & Pack Pvt. Ltd. </strong> <br> Administration Panel </div> </div> </section> </div> <script> /* ========================================================= PASSWORD SHOW / HIDE ========================================================= */ const password = document.getElementById("password"); const passwordToggle = document.getElementById("passwordToggle"); const eyeIcon = document.getElementById("eyeIcon"); passwordToggle.addEventListener( "click", function(){ if(password.type === "password"){ password.type = "text"; eyeIcon.classList.remove( "fa-eye" ); eyeIcon.classList.add( "fa-eye-slash" ); passwordToggle.setAttribute( "aria-label", "Hide password" ); }else{ password.type = "password"; eyeIcon.classList.remove( "fa-eye-slash" ); eyeIcon.classList.add( "fa-eye" ); passwordToggle.setAttribute( "aria-label", "Show password" ); } } ); /* ========================================================= LOGIN BUTTON LOADING ========================================================= */ const loginForm = document.getElementById("loginForm"); const loginButton = document.getElementById("loginButton"); const loginIcon = document.getElementById("loginIcon"); const loginText = document.getElementById("loginText"); loginForm.addEventListener( "submit", function(){ /* * Do not change the PHP login logic. * This only gives visual feedback. */ loginButton.classList.add("loading"); loginIcon.style.display = "none"; loginText.innerHTML = '<span class="spinner"></span> Signing In...'; } ); /* ========================================================= AUTO FOCUS ========================================================= */ window.addEventListener( "load", function(){ const email = document.getElementById("email"); if(email && email.value.trim() === ""){ email.focus(); } } ); </script> </body> </html>
Save
Cancel