Editando: login.php
<?php session_start(); include('db.php'); if (isset($_POST['login'])) { $username = $_POST['user']; $password = $_POST['pass']; $sql = "SELECT * FROM admin_users WHERE username='$username' AND password='$password'"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) == 1) { $_SESSION['admin'] = $username; header("Location: dashboard.php"); } else { $error = "Invalid Username or Password!"; } } ?> <!DOCTYPE html> <html> <head> <title>Mithram Login</title> <style> body { font-family: sans-serif; background: #f4f4f4; display: flex; justify-content: center; align-items: center; height: 100vh; } .login-box { background: white; padding: 30px; border-radius: 10px; shadow: 0px 0px 10px #ccc; } input { display: block; width: 100%; margin: 10px 0; padding: 10px; box-sizing: border-box;} button { width: 100%; padding: 10px; background: #e67e22; color: white; border: none; cursor: pointer; } </style> </head> <body> <div class="login-box"> <h2>Mithram Admin Login</h2> <?php if(isset($error)) echo "<p style='color:red;'>$error</p>"; ?> <form method="POST"> <input type="text" name="user" placeholder="Username" required> <input type="password" name="pass" placeholder="Password" required> <button type="submit" name="login">Login</button> </form> </div> </body> </html>
Cancelar
Kerym Chaeceran