diff --git a/login page.html b/login page.html
index 638f46f..2786973 100644
--- a/login page.html
+++ b/login page.html
@@ -1,5 +1,6 @@
+
@@ -234,7 +250,8 @@
-
+
+
@@ -281,18 +298,50 @@
document.getElementById('signupForm').style.display = 'block';
}
+ // Login handler: validate input and show messages
+ function handleLogin() {
+ const username = document.getElementById('mainUsername').value.trim();
+ const password = document.getElementById('mainPassword').value.trim();
+ const successEl = document.getElementById('mainMessage');
+ const errorEl = document.getElementById('mainError');
+
+ // Reset messages
+ successEl.classList.remove('show');
+ errorEl.classList.remove('show');
+
+ if (!username || !password) {
+ errorEl.textContent = 'Please enter both username and password.';
+ errorEl.classList.add('show');
+ return;
+ }
+
+ // Simulate login (replace with real auth as needed)
+ if (username.toLowerCase() === 'admin' && password === 'admin') {
+ successEl.textContent = `Welcome back, ${username}! Redirecting...`;
+ successEl.classList.add('show');
+ setTimeout(() => {
+ alert('Logged in as ' + username + '. (Simulated)');
+ // Example: redirect to game/dashboard page
+ // window.location.href = 'dashboard.html';
+ }, 800);
+ } else {
+ errorEl.textContent = 'Invalid username or password.';
+ errorEl.classList.add('show');
+ }
+ }
+
// Signup Form Handler
- document.getElementById('signupForm').addEventListener('submit', function(e) {
+ document.getElementById('signupForm').addEventListener('submit', function (e) {
e.preventDefault();
const username = document.getElementById('signupUsername').value;
const email = document.getElementById('signupEmail').value;
const password = document.getElementById('signupPassword').value;
-
+
if (username && email && password) {
const message = document.getElementById('signupMessage');
message.textContent = `✓ Account created successfully for ${username}!`;
message.classList.add('show');
-
+
setTimeout(() => {
alert(`Account created!\nUsername: ${username}\nEmail: ${email}`);
// Add your redirect here
@@ -302,4 +351,5 @@
});
+
\ No newline at end of file