From b95f5763dd269a9980d241e53ee8cf28ce121a7b Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 5 Nov 2025 23:36:37 +0000 Subject: [PATCH] fix 12 --- auth-check.php | 6 ------ db/config.php | 17 ----------------- index.php | 4 ---- login.php | 11 ----------- run-migrations.php | 23 ----------------------- 5 files changed, 61 deletions(-) delete mode 100644 run-migrations.php diff --git a/auth-check.php b/auth-check.php index 37c4786..0614be9 100644 --- a/auth-check.php +++ b/auth-check.php @@ -1,13 +1,7 @@ \ No newline at end of file diff --git a/db/config.php b/db/config.php index 2714b40..4314103 100644 --- a/db/config.php +++ b/db/config.php @@ -23,22 +23,5 @@ function db() { } - // Migration logic - $pdo->exec('CREATE TABLE IF NOT EXISTS migrations (migration VARCHAR(255) PRIMARY KEY)'); - $ran_migrations = $pdo->query('SELECT migration FROM migrations')->fetchAll(PDO::FETCH_COLUMN); - - $migration_files = glob(__DIR__ . '/migrations/*.sql'); - sort($migration_files); - - foreach ($migration_files as $file) { - $migration_name = basename($file); - if (!in_array($migration_name, $ran_migrations)) { - $sql = file_get_contents($file); - $pdo->exec($sql); - $stmt = $pdo->prepare('INSERT INTO migrations (migration) VALUES (?)'); - $stmt->execute([$migration_name]); - } - } - return $pdo; } diff --git a/index.php b/index.php index 7fcb675..e456312 100644 --- a/index.php +++ b/index.php @@ -1,9 +1,5 @@ fetch(PDO::FETCH_ASSOC); if ($user && password_verify($password, $user['password'])) { - error_log("login.php: Login successful for user ID: " . $user['id']); $_SESSION['user_id'] = $user['id']; $_SESSION['user_name'] = $user['name']; $_SESSION['user_role'] = $user['role']; - error_log("login.php: \$_SESSION after login: " . print_r($_SESSION, true)); header("Location: index.php"); exit; } else { $error_message = 'Invalid email or password.'; - error_log("login.php: " . $error_message); } } catch (PDOException $e) { $error_message = 'Database error: ' . $e->getMessage(); - error_log("login.php: " . $error_message); } } } diff --git a/run-migrations.php b/run-migrations.php deleted file mode 100644 index 79671b0..0000000 --- a/run-migrations.php +++ /dev/null @@ -1,23 +0,0 @@ -exec($sql); - echo "Successfully ran migration: " . basename($file) . "
"; - } catch (PDOException $e) { - echo "Error running migration: " . basename($file) . " - " . $e->getMessage() . "
"; - } -} - -// Self-destruct -unlink(__FILE__); - -echo "
All migrations have been processed. This script has been deleted.";