diff --git a/admin_messages.php b/admin_messages.php index 878883c..372d262 100644 --- a/admin_messages.php +++ b/admin_messages.php @@ -12,7 +12,7 @@ $pdo = db(); if (isset($_GET['action']) && isset($_GET['id'])) { $id = $_GET['id']; if ($_GET['action'] === 'read') { - $pdo->prepare("UPDATE contact_messages SET status = 'read' WHERE id = ?")->execute([id]); + $pdo->prepare("UPDATE contact_messages SET status = 'read' WHERE id = ?")->execute([$id]); } elseif ($_GET['action'] === 'delete') { $pdo->prepare("DELETE FROM contact_messages WHERE id = ?")->execute([$id]); } diff --git a/db/database.sql b/db/database.sql index 4fed2ab..5e6c449 100644 --- a/db/database.sql +++ b/db/database.sql @@ -206,7 +206,9 @@ CREATE TABLE `purchases` ( `buyer_name` varchar(100) DEFAULT NULL, `buyer_email` varchar(100) DEFAULT NULL, `buyer_phone` varchar(20) DEFAULT NULL, - `status` enum('pending','completed','cancelled') DEFAULT 'pending', + `bank_id` varchar(100) DEFAULT NULL, + `personal_info` text DEFAULT NULL, + `status` enum('pending','completed','cancelled','approved','rejected') DEFAULT 'pending', `created_at` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `car_id` (`car_id`), @@ -269,6 +271,8 @@ CREATE TABLE `users` ( `name` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(255) NOT NULL, + `phone` varchar(20) DEFAULT NULL, + `address` text DEFAULT NULL, `role` enum('guest','user','admin') DEFAULT 'user', `status` enum('active','inactive') DEFAULT 'active', `created_at` timestamp NULL DEFAULT current_timestamp(), @@ -285,7 +289,7 @@ CREATE TABLE `users` ( LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES -(1,'Admin','admin@gmail.com','$2y$10$JCXfZuRFtFozIdO.r40iQeueUsqIWutBjlAS/8hkL/7rVbPd2JOhu','admin','active','2026-02-23 08:29:20',NULL); +(1,'Admin','admin@gmail.com','$2y$10$JCXfZuRFtFozIdO.r40iQeueUsqIWutBjlAS/8hkL/7rVbPd2JOhu',NULL,NULL,'admin','active','2026-02-23 08:29:20',NULL); /*!40000 ALTER TABLE `users` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; diff --git a/db/setup.php b/db/setup.php index 4ad10cf..445fa0c 100644 --- a/db/setup.php +++ b/db/setup.php @@ -10,6 +10,8 @@ try { name VARCHAR(100) NOT NULL, email VARCHAR(100) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, + phone VARCHAR(20) DEFAULT NULL, + address TEXT DEFAULT NULL, role ENUM('guest', 'user', 'admin') DEFAULT 'user', status ENUM('active', 'inactive') DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -63,7 +65,9 @@ try { buyer_name VARCHAR(100), buyer_email VARCHAR(100), buyer_phone VARCHAR(20), - status ENUM('pending', 'completed', 'cancelled') DEFAULT 'pending', + bank_id VARCHAR(100), + personal_info TEXT, + status ENUM('pending', 'completed', 'cancelled', 'approved', 'rejected') DEFAULT 'pending', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (car_id) REFERENCES cars(id) ON DELETE CASCADE, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE