diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..498ebbb --- /dev/null +++ b/contact.php @@ -0,0 +1,94 @@ +prepare("INSERT INTO contact_messages (name, email, subject, message) VALUES (?, ?, ?, ?)"); + $stmt->execute([$name, $email, $subject, $message]); + + // Send email using MailService + $res = MailService::sendContactMessage($name, $email, $message); + + $success = 'Thank you for your message! We will get back to you soon.'; + } catch (PDOException $e) { + $error = 'An error occurred while sending your message. Please try again later.'; + } + } +} + +include 'includes/header.php'; +?> + +
+
+
+

Get in Touch

+

Have questions about a car or want to list your own? Our team in Kabul is ready to help you 24/7.

+ +
+

Contact Information

+

Email: admin@gmail.com

+

Location: Kabul, Afghanistan

+

Developer: Mohammad Sadiq

+
+
+ +
+
+

Send a Message

+ + +
+ +
+ + + +
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+
+
+
+
+ + diff --git a/login.php b/login.php new file mode 100644 index 0000000..e56593c --- /dev/null +++ b/login.php @@ -0,0 +1,75 @@ +prepare("SELECT * FROM users WHERE email = ?"); + $stmt->execute([$email]); + $user = $stmt->fetch(); + + if ($user && password_verify($password, $user['password'])) { + $_SESSION['user_id'] = $user['id']; + $_SESSION['user_name'] = $user['name']; + $_SESSION['user_role'] = $user['role']; + + header('Location: index.php'); + exit; + } else { + $error = 'Invalid email or password.'; + } + } catch (PDOException $e) { + $error = 'An error occurred. Please try again later.'; + } + } +} + +include 'includes/header.php'; +?> + +
+
+
+

Welcome Back

+

Login to manage your car listings

+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+ + + +

+ Don't have an account? Register here +

+
+
+ +
+

Admin Demo: admin@gmail.com / 12345678

+
+
+
+ + diff --git a/register.php b/register.php new file mode 100644 index 0000000..5e9b8c1 --- /dev/null +++ b/register.php @@ -0,0 +1,92 @@ +prepare("SELECT id FROM users WHERE email = ?"); + $stmt->execute([$email]); + if ($stmt->fetch()) { + $error = 'This email is already registered.'; + } else { + $hashed_password = password_hash($password, PASSWORD_DEFAULT); + $stmt = db()->prepare("INSERT INTO users (name, email, password) VALUES (?, ?, ?)"); + $stmt->execute([$name, $email, $hashed_password]); + + $success = 'Account created successfully! You can now login.'; + } + } catch (PDOException $e) { + $error = 'An error occurred. Please try again later.'; + } + } +} + +include 'includes/header.php'; +?> + +
+
+
+

Create Account

+

Join the premium car marketplace in Afghanistan

+ + +
+ +
+ + + +
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +

+ Already have an account? Login here +

+
+
+
+
+ +