Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php session_start(); require 'includes/db.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = $_POST['username']; $password = $_POST['password']; $stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?"); $stmt->execute([$username]); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password'])) { $_SESSION['user'] = $user; header("Location: dashboard.php"); exit; } else { $error = "بيانات الدخول غير صحيحة."; } } ?> <!DOCTYPE html> <html lang="ar"> <head> <meta charset="UTF-8"> <title>نقطة الإطفاء - دخول</title> </head> <body> <h2>تسجيل الدخول</h2> <?php if (isset($error)) echo "<p>$error</p>"; ?> <form method="POST"> اسم المستخدم: <input type="text" name="username" required><br> كلمة المرور: <input type="password" name="password" required><br> <button type="submit">دخول</button> </form> </body> </html>
Copy Clear