Siteβ―Builder
Editing:
login.php
writable 0666
<?php /***************************************************************** * Classicβpassword login (local accounts) *****************************************************************/ require_once __DIR__.'/lib/db.php'; // β relative path is correct session_start(); /* ββββββββββββββββ handle POST ββββββββββββββββ */ $err = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stmt = $db->prepare( 'SELECT id, password_hash FROM users WHERE username = ?'); $stmt->execute([ $_POST['user'] ?? '' ]); $row = $stmt->fetch(); if ($row && password_verify($_POST['pass'] ?? '', $row['password_hash'])) { session_regenerate_id(true); $_SESSION['uid'] = $row['id']; header('Location: '.($_GET['next'] ?? '/members/dashboard.php')); exit; } $err = 'Invalid username or password'; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Log in βΒ BestDealOn</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <style> /* βββββ minimalist 2025 look, no external assets βββββ */ :root{ --bg:#f6f7fb;--card:#fff;--brand:#0366d6;--brand-d:#024fa9; --text:#202124;--sub:#5f6368;--radius:10px; } *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI', Roboto,Helvetica,Arial,sans-serif;margin:0;padding:0} body{background:var(--bg);color:var(--text);display:flex; min-height:100vh;align-items:center;justify-content:center} main{width:clamp(320px,90vw,420px);background:var(--card);border-radius:var(--radius); box-shadow:0 8px 24px rgba(0,0,0,.08);padding:2.4rem 2rem} h1{font-size:1.8rem;font-weight:700;margin-bottom:1.4rem;text-align:center} p.sub{color:var(--sub);font-size:.9rem;margin-top:.4rem;text-align:center} form{margin-top:1.4rem} label{display:block;font-size:.86rem;margin-bottom:.35rem;font-weight:600} input{width:100%;font-size:1rem;padding:.7rem .8rem;margin-bottom:1rem; border:1px solid #d0d0d5;border-radius:6px} input:focus{outline:2px solid var(--brand);border-color:var(--brand)} button{width:100%;padding:.8rem 1rem;font-size:1.05rem;font-weight:600; background:var(--brand);color:#fff;border:0;border-radius:6px;cursor:pointer} button:hover{background:var(--brand-d)} a{color:var(--brand);text-decoration:none} a:hover{text-decoration:underline} .err{background:#ffe1e1;color:#c00;padding:.8rem 1rem;border-radius:6px; margin-bottom:1rem;text-align:center} .divider{display:flex;align-items:center;margin:1.6rem 0} .divider::before,.divider::after{content:'';flex:1;height:1px; background:#ddd;margin:0 .6rem} .btn-google{display:flex;align-items:center;justify-content:center; gap:.55rem;width:100%;padding:.7rem 1rem;border:1px solid #d0d0d5; border-radius:6px;background:#fff;font-weight:600;font-size:.97rem;margin-bottom:1.4rem} .btn-google:hover{background:#f1f1f1} .btn-google svg{width:18px;height:18px} footer{font-size:.85rem;text-align:center;margin-top:.6rem;color:var(--sub)} .top{background:#eee;padding:.8em 1.2em;font-weight:900} </style> </head> <body> <main> <h1>Sign in</h1> <?php if($err): ?> <div class="err"><?= htmlspecialchars($err) ?></div> <?php endif; ?> <form method="post" novalidate> <label for="user">Username</label> <input id="user" name="user" placeholder="john_doe" required> <label for="pass">Password</label> <input id="pass" type="password" name="pass" placeholder="ββββββββ" required> <button>Log in</button> </form> <div class="divider">or</div> <a href="/members/oauth/google-login.php" class="btn-google"> <!-- tiny inline Google G icon --> <svg viewBox="0 0 533.5 544.3" aria-hidden="true"> <path fill="#EA4335" d="M533.5 278.4c0-17.4-1.4-34.5-4-51.1H272v96.7h146.9 c-6.3 33.2-25 61.5-53.3 80.4v66h86.2c50.3-46.3 81.7-114.5 81.7-192z"/> <path fill="#34A853" d="M272 544.3c71.9 0 132.4-23.8 176.5-64.5l-86.2-66 c-24 16.1-54.7 25.7-90.3 25.7-69.4 0-128.2-46.9-149.3-109.8 H35.4v68.8C79.2 489.3 168 544.3 272 544.3z"/> <path fill="#4A90E2" d="M122.7 329.6c-10.5-30.8-10.5-64 0-94.8v-68.8H35.4 c-33.9 67.7-33.9 149.9 0 217.6l87.3-54z"/> <path fill="#FBBC05" d="M272 107.6c37.9-.6 74.2 13.3 101.9 38.9l76.2-76.2C409.7 23.7 351.3-1 272 .3 168 .3 79.2 55.3 35.4 143.9l87.3 54 C143.8 154.5 202.6 107.6 272 107.6z"/> </svg> Sign in with Google </a> <footer> <a href="/members/forgot.php">Forgot password?</a> · <a href="/members/register.php">Create account</a> </footer> </main> </body> </html>
Save changes
Create folder
writable 0777
Create
Cancel