From 74ec2be88b9f7a706861154f9ee818e54b7f8a2f Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 31 Oct 2025 02:29:37 +0000 Subject: [PATCH] Ali Khan --- assets/css/custom.css | 20 +++ assets/js/main.js | 45 +++++++ contact.php | 38 ++++++ index.php | 299 ++++++++++++++++++++++-------------------- 4 files changed, 258 insertions(+), 144 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 contact.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..4b33e39 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,20 @@ +body { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.hero-section { + background: linear-gradient(45deg, #0d6efd, #6f42c1); + padding: 100px 0; +} + +.navbar-brand { + font-size: 1.5rem; +} + +.card { + transition: transform 0.2s ease-in-out; +} + +.card:hover { + transform: translateY(-5px); +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..17ef70c --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,45 @@ +document.addEventListener('DOMContentLoaded', function () { + const contactForm = document.getElementById('contactForm'); + const contactToast = new bootstrap.Toast(document.getElementById('contactToast')); + const toastBody = document.querySelector('#contactToast .toast-body'); + + contactForm.addEventListener('submit', function (e) { + e.preventDefault(); + e.stopPropagation(); + + if (!contactForm.checkValidity()) { + contactForm.classList.add('was-validated'); + return; + } + + const formData = new FormData(contactForm); + const submitButton = contactForm.querySelector('button[type="submit"]'); + const originalButtonText = submitButton.innerHTML; + submitButton.disabled = true; + submitButton.innerHTML = ` Sending...`; + + fetch('contact.php', { + method: 'POST', + body: formData + }) + .then(response => response.json()) + .then(data => { + if (data.success) { + toastBody.textContent = 'Your message has been sent successfully!'; + contactForm.reset(); + contactForm.classList.remove('was-validated'); + } else { + toastBody.textContent = 'An error occurred: ' + (data.error || 'Please try again.'); + } + contactToast.show(); + }) + .catch(error => { + toastBody.textContent = 'A network error occurred. Please try again.'; + contactToast.show(); + }) + .finally(() => { + submitButton.disabled = false; + submitButton.innerHTML = originalButtonText; + }); + }); +}); diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..29bcbbb --- /dev/null +++ b/contact.php @@ -0,0 +1,38 @@ + false, 'error' => 'Invalid request method.']); + exit; +} + +require_once __DIR__ . '/mail/MailService.php'; + +$name = trim($_POST['name'] ?? ''); +$email = trim($_POST['email'] ?? ''); +$message = trim($_POST['message'] ?? ''); + +if (empty($name) || empty($email) || empty($message)) { + echo json_encode(['success' => false, 'error' => 'Please fill out all fields.']); + exit; +} + +if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + echo json_encode(['success' => false, 'error' => 'Invalid email format.']); + exit; +} + +// The recipient email address. You can change this to a configurable variable later. +// If left null, it will use the MAIL_TO from the .env file. +$to = null; +$subject = 'New Contact Form Message from Jalwa Game'; + +$res = MailService::sendContactMessage($name, $email, $message, $to, $subject); + +if (!empty($res['success'])) { + echo json_encode(['success' => true]); +} else { + // Avoid exposing detailed mail server errors to the client. + error_log('MailService Error: ' . ($res['error'] ?? 'Unknown error')); + echo json_encode(['success' => false, 'error' => 'Failed to send message. Please try again later.']); +} diff --git a/index.php b/index.php index 7205f3d..5e6ed07 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,161 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + Jalwa Game Prediction + + + + + + + + + + + -
-
-

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 Jalwa Game Prediction

+

Your skill in number prediction could lead to victory. Join us now!

+ Get Started +
+
+ +
+
+

How It Works

+
+
+
+
+ +
1. Register
+

Create your account in a few simple steps to start playing.

+
+
+
+
+
+
+ +
2. Predict
+

Submit your number prediction for the upcoming game round.

+
+
+
+
+
+
+ +
3. Win
+

Check the results. If your number matches, you win!

+
+
+
+
+
+
+ +
+
+

Past Results

+ 'Round 101', 'number' => 42, 'date' => '2025-10-30'], + ['round' => 'Round 100', 'number' => 7, 'date' => '2025-10-29'], + ['round' => 'Round 99', 'number' => 88, 'date' => '2025-10-28'], + ['round' => 'Round 98', 'number' => 13, 'date' => '2025-10-27'], + ]; + ?> +
+ + + + + + + + + + + + + + + + + +
RoundWinning NumberDate
+
+
+
+ +
+
+
+
+

Contact Us

+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+

© Jalwa Game. All Rights Reserved.

+
+
+ +
+
-
- + + + - + \ No newline at end of file