From f51ddd9779dab4f0d7ffd89be4b94920584921a9 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 22 Oct 2025 16:57:42 +0000 Subject: [PATCH] V1.2 --- assets/css/custom.css | 1 + assets/js/main.js | 1 + db/config.php | 19 +-- db/db.php | 17 ++ db/migrations/001_create_providers_table.sql | 9 ++ index.php | 157 +------------------ register.php | 105 +++++++++++++ templates/footer.php | 5 + templates/header.php | 36 +++++ 9 files changed, 186 insertions(+), 164 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 db/db.php create mode 100644 db/migrations/001_create_providers_table.sql create mode 100644 register.php create mode 100644 templates/footer.php create mode 100644 templates/header.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..b179ee3 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1 @@ +/* Custom Styles */ \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..8c84b99 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1 @@ +// Custom Scripts \ No newline at end of file diff --git a/db/config.php b/db/config.php index cc9229f..14bf3d8 100644 --- a/db/config.php +++ b/db/config.php @@ -1,17 +1,6 @@ PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - ]); - } - return $pdo; -} +define('DB_NAME', 'coursehub'); +define('DB_USER', 'root'); +define('DB_PASS', 'root'); +?> \ No newline at end of file diff --git a/db/db.php b/db/db.php new file mode 100644 index 0000000..649f3d4 --- /dev/null +++ b/db/db.php @@ -0,0 +1,17 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, + ]; + try { + return new PDO($dsn, DB_USER, DB_PASS, $options); + } catch (PDOException $e) { + throw new PDOException($e->getMessage(), (int)$e->getCode()); + } +} +?> \ No newline at end of file diff --git a/db/migrations/001_create_providers_table.sql b/db/migrations/001_create_providers_table.sql new file mode 100644 index 0000000..1c34526 --- /dev/null +++ b/db/migrations/001_create_providers_table.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS providers ( + id INT AUTO_INCREMENT PRIMARY KEY, + provider_name VARCHAR(255) NOT NULL, + contact_name VARCHAR(255) NOT NULL, + email VARCHAR(255) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL, + status VARCHAR(50) NOT NULL DEFAULT 'pending', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/index.php b/index.php index 7205f3d..3b83c74 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,9 @@ - -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
- - - +
+

Welcome to coursehub

+

The best place to find and offer courses.

+ Register as a Provider +
+ + \ No newline at end of file diff --git a/register.php b/register.php new file mode 100644 index 0000000..21610ac --- /dev/null +++ b/register.php @@ -0,0 +1,105 @@ +prepare($sql); + $stmt->execute([$email]); + if ($stmt->fetch()) { + $errors[] = 'Email already exists.'; + } else { + $sql = "INSERT INTO providers (provider_name, contact_name, email, password) VALUES (?, ?, ?, ?)"; + $stmt = $pdo->prepare($sql); + $hashed_password = password_hash($password, PASSWORD_DEFAULT); + $stmt->execute([$provider_name, $contact_name, $email, $hashed_password]); + $success = true; + } + } catch (PDOException $e) { + $errors[] = 'Database error: ' . $e->getMessage(); + } + } +} +?> + + +
+
+
+
+ Provider Registration +
+
+ +
+
    + +
  • + +
+
+ + +
+ Registration successful! Your account is pending approval. +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+
+ + diff --git a/templates/footer.php b/templates/footer.php new file mode 100644 index 0000000..51f2f04 --- /dev/null +++ b/templates/footer.php @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/templates/header.php b/templates/header.php new file mode 100644 index 0000000..be82c32 --- /dev/null +++ b/templates/header.php @@ -0,0 +1,36 @@ + + + + + + coursehub + + + + + + + + + + + + +
\ No newline at end of file