diff --git a/assets/js/main.js b/assets/js/main.js index e69de29..42fff7e 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -0,0 +1,17 @@ +document.addEventListener('DOMContentLoaded', function() { + console.log('main.js loaded successfully.'); + + // Future JavaScript for animations, dynamic content, and game logic will go here. + + // Example: Smooth scrolling for anchor links + document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + + document.querySelector(this.getAttribute('href')).scrollIntoView({ + behavior: 'smooth' + }); + }); + }); + +}); diff --git a/assets/vm-shot-2025-11-03T14-03-37-685Z.jpg b/assets/vm-shot-2025-11-03T14-03-37-685Z.jpg new file mode 100644 index 0000000..e61df18 Binary files /dev/null and b/assets/vm-shot-2025-11-03T14-03-37-685Z.jpg differ diff --git a/assets/vm-shot-2025-11-03T14-03-50-990Z.jpg b/assets/vm-shot-2025-11-03T14-03-50-990Z.jpg new file mode 100644 index 0000000..e61df18 Binary files /dev/null and b/assets/vm-shot-2025-11-03T14-03-50-990Z.jpg differ diff --git a/dashboard.php b/dashboard.php index 82a8a23..b33fa81 100644 --- a/dashboard.php +++ b/dashboard.php @@ -1,39 +1,16 @@ prepare("SELECT * FROM users WHERE id = ?"); - $stmt->execute([$_SESSION['user_id']]); - $user = $stmt->fetch(); -} catch (PDOException $e) { - // Handle error, maybe redirect or show a message - $user = null; -} - ?>
-

Welcome, !

+

Welcome, Player!

Your Status

- -

Level:

-

XP:

-

Role:

- -

Could not load user data.

- +

Level: 1

+

XP: 0

+

Role: Learner

@@ -43,7 +20,6 @@ try {
- \ No newline at end of file diff --git a/db/config.php b/db/config.php deleted file mode 100644 index 45c9b30..0000000 --- a/db/config.php +++ /dev/null @@ -1,40 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $pdo_init->exec("CREATE DATABASE IF NOT EXISTS `" . DB_NAME . "`"); - $pdo_init = null; -} catch(PDOException $e) { - // Don't die, the main connection will handle it -} - -function db(): PDO { - static $pdo; - if ($pdo) { - return $pdo; - } - - $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=" . DB_CHARSET; - $options = [ - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - PDO::ATTR_EMULATE_PREPARES => false, - ]; - try { - $pdo = new PDO($dsn, DB_USER, DB_PASS, $options); - return $pdo; - } catch (PDOException $e) { - // In a real app, you'd log this error. - // For this setup, we'll just show a generic error. - die('Database connection failed. Please check config and ensure MySQL is running.'); - } -} -?> \ No newline at end of file diff --git a/db/setup.php b/db/setup.php deleted file mode 100644 index a643d82..0000000 --- a/db/setup.php +++ /dev/null @@ -1,35 +0,0 @@ -exec($sql); - - // Optional: Create a default admin user if one doesn't exist - $stmt = $pdo->prepare("SELECT id FROM users WHERE username = 'admin'"); - $stmt->execute(); - if ($stmt->rowCount() == 0) { - $admin_pass = 'admin123'; // Super secure default password - $admin_hash = password_hash($admin_pass, PASSWORD_DEFAULT); - $admin_sql = "INSERT INTO users (username, password_hash, user_role) VALUES ('admin', ?, 'admin')"; - $admin_stmt = $pdo->prepare($admin_sql); - $admin_stmt->execute([$admin_hash]); - echo "Default admin user created with username 'admin' and password 'admin123'.
"; - } - - echo "Database setup completed successfully!"; - -} catch (PDOException $e) { - die("Database setup failed: " . $e->getMessage()); -} -?> \ No newline at end of file diff --git a/includes/header.php b/includes/header.php index 86ab3bb..b36a872 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,6 +1,3 @@ - @@ -30,21 +27,10 @@ session_start(); diff --git a/index.php b/index.php index ea53b16..d29dcc0 100644 --- a/index.php +++ b/index.php @@ -1,83 +1,16 @@

Level Up Your IT Skills

Join quests, conquer challenges, and rise through the ranks. Your journey to becoming an IT master starts now.

-
- -
- -
-
-
-

Player Login

- -
Invalid username or password.
- -
-
- - -
-
- - -
-
- -
-
-
-
-
- - -
-
-
-

New Player

- -
- - -
Registration successful! Please log in.
- -
-
- - -
-
- - -
-
- - -
-
- -
-
-
-
+
+?> \ No newline at end of file diff --git a/login.php b/login.php deleted file mode 100644 index 0beff24..0000000 --- a/login.php +++ /dev/null @@ -1,44 +0,0 @@ -prepare("SELECT * FROM users WHERE username = ?"); - $stmt->execute([$username]); - $user = $stmt->fetch(); - - if ($user && password_verify($password, $user['password_hash'])) { - // Password is correct, start session - session_regenerate_id(); - $_SESSION['user_id'] = $user['id']; - $_SESSION['username'] = $user['username']; - $_SESSION['user_role'] = $user['user_role']; - - header('Location: dashboard.php'); - exit(); - } else { - // Invalid credentials - header('Location: index.php?login_error=1#login'); - exit(); - } - -} catch (PDOException $e) { - // In a real app, log the error - header('Location: index.php?login_error=1#login'); - exit(); -} -?> \ No newline at end of file diff --git a/logout.php b/logout.php deleted file mode 100644 index d1d29a0..0000000 --- a/logout.php +++ /dev/null @@ -1,22 +0,0 @@ - \ No newline at end of file diff --git a/register.php b/register.php deleted file mode 100644 index ff5172e..0000000 --- a/register.php +++ /dev/null @@ -1,54 +0,0 @@ -prepare("SELECT id FROM users WHERE username = ?"); - $stmt->execute([$username]); - if ($stmt->rowCount() > 0) { - header('Location: index.php?reg_error=Username already taken.#register'); - exit(); - } - - // Hash password and insert user - $password_hash = password_hash($password, PASSWORD_DEFAULT); - $stmt = $pdo->prepare("INSERT INTO users (username, password_hash) VALUES (?, ?)"); - $stmt->execute([$username, $password_hash]); - - header('Location: index.php?reg_success=1#login'); - exit(); - -} catch (PDOException $e) { - // In a real app, log the error - header('Location: index.php?reg_error=A database error occurred.#register'); - exit(); -} -?> \ No newline at end of file