Devco1
Home
Console
Upload
New File
New Folder
Tools
Info
About
/
home
/
wifiyecu
/
www
/
admin
/
Filename :
login.php
back
Copy
<?php session_start(); include '../includes/config.php'; // إذا كان المدير مسجل الدخول بالفعل، توجيه إلى لوحة التحكم if (isset($_SESSION['admin_logged_in'])) { header('Location: index.php'); exit; } // معالجة تسجيل الدخول if ($_SERVER['REQUEST_METHOD'] === 'POST') { $username = $_POST['username'] ?? ''; $password = $_POST['password'] ?? ''; try { $stmt = $pdo->prepare("SELECT * FROM admins WHERE username = ?"); $stmt->execute([$username]); $admin = $stmt->fetch(); if ($admin && password_verify($password, $admin['password'])) { $_SESSION['admin_logged_in'] = true; $_SESSION['admin_username'] = $admin['username']; $_SESSION['admin_id'] = $admin['id']; header('Location: index.php'); exit; } else { $error = "اسم المستخدم أو كلمة المرور غير صحيحة"; } } catch (PDOException $e) { $error = "حدث خطأ في النظام: " . $e->getMessage(); } } ?> <!DOCTYPE html> <html lang="ar" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>تسجيل الدخول - لوحة التحكم</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> <style> body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); height: 100vh; display: flex; align-items: center; } .login-card { background: white; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); } </style> </head> <body> <div class="container"> <div class="row justify-content-center"> <div class="col-md-5"> <div class="login-card p-5"> <div class="text-center mb-4"> <i class="fas fa-mobile-alt fa-3x text-primary mb-3"></i> <h2>لوحة التحكم</h2> <p class="text-muted">متجر الهواتف الذكية</p> </div> <?php if (isset($error)): ?> <div class="alert alert-danger"><?php echo $error; ?></div> <?php endif; ?> <form method="POST"> <div class="mb-3"> <label for="username" class="form-label">اسم المستخدم</label> <div class="input-group"> <span class="input-group-text"><i class="fas fa-user"></i></span> <input type="text" class="form-control" id="username" name="username" required> </div> </div> <div class="mb-3"> <label for="password" class="form-label">كلمة المرور</label> <div class="input-group"> <span class="input-group-text"><i class="fas fa-lock"></i></span> <input type="password" class="form-control" id="password" name="password" required> </div> </div> <button type="submit" class="btn btn-primary w-100 btn-lg"> <i class="fas fa-sign-in-alt"></i> تسجيل الدخول </button> </form> <div class="text-center mt-3"> <small class="text-muted"> بيانات الدخول الافتراضية:<br> username: admin | password: password </small> </div> </div> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> </body> </html>