From 59948bbecdd542c1e16f497ca8a08e4d4af6d931 Mon Sep 17 00:00:00 2001 From: Prabit-Adhikari Date: Mon, 13 Jan 2025 06:11:47 +0545 Subject: [PATCH] Hackathon --- about.html | 139 +++++++++++++++ contact.html | 69 +++++++ forgot password.html | 106 +++++++++++ games.html | 73 ++++++++ guess.html | 234 ++++++++++++++++++++++++ hangman.html | 210 ++++++++++++++++++++++ homepage.php | 173 ++++++++++++++++++ login.php | 169 ++++++++++++++++++ logout.php | 7 + math game.html | 223 +++++++++++++++++++++++ profile.php | 87 +++++++++ quiz.css | 66 +++++++ quiz.php | 152 ++++++++++++++++ quiz1.css | 145 +++++++++++++++ register.html | 386 ++++++++++++++++++++++++++++++++++++++++ register_validation.php | 48 +++++ result.php | 33 ++++ services.html | 171 ++++++++++++++++++ style.css | 113 ++++++++++++ track_streak.php | 48 +++++ verifyotp.html | 91 ++++++++++ 21 files changed, 2743 insertions(+) create mode 100644 about.html create mode 100644 contact.html create mode 100644 forgot password.html create mode 100644 games.html create mode 100644 guess.html create mode 100644 hangman.html create mode 100644 homepage.php create mode 100644 login.php create mode 100644 logout.php create mode 100644 math game.html create mode 100644 profile.php create mode 100644 quiz.css create mode 100644 quiz.php create mode 100644 quiz1.css create mode 100644 register.html create mode 100644 register_validation.php create mode 100644 result.php create mode 100644 services.html create mode 100644 style.css create mode 100644 track_streak.php create mode 100644 verifyotp.html diff --git a/about.html b/about.html new file mode 100644 index 0000000..c02f8c2 --- /dev/null +++ b/about.html @@ -0,0 +1,139 @@ + + + + + + + + + About Us + + + + +
+

About Us

+

Learn more about our mission, values, and services.

+
+ + + +
+
+

Who We Are

+

At Info Path, we are passionate about providing the best quality content and services to our users. Our goal is to create a platform that brings together individuals seeking valuable resources, ideas, and solutions. We are committed to user satisfaction, constant innovation, and continuous improvement.

+ +

Our Mission

+

Our mission is to empower individuals and businesses by offering valuable insights, services, and tools that make a real difference. We are driven by the desire to provide our users with resources that help them achieve success in their personal and professional lives.

+ +

Our Values

+
    +
  • Integrity: We believe in being honest and transparent with our users at all times.
  • +
  • Innovation: We are constantly evolving and finding new ways to improve our services and user experience.
  • +
  • Customer-Centric: Our users' needs are our top priority, and we always strive to exceed their expectations.
  • +
  • Collaboration: We work together as a team to build a platform that benefits everyone involved.
  • +
+ +

What We Offer

+

Our platform offers a wide range of services, including:

+
    +
  • Quality content in various fields
  • +
  • Expert advice and resources
  • +
  • Personalized solutions tailored to user needs
  • +
  • Regular updates and improvements
  • +
+ + + Back to Home +
+
+ + + + + diff --git a/contact.html b/contact.html new file mode 100644 index 0000000..79da2c8 --- /dev/null +++ b/contact.html @@ -0,0 +1,69 @@ + + + + + + + Contact Information + + + + +
+

Contact Information

+
+

Phone Number: +1 234567890

+

Email Address: support@mail.com

+

Office Address: 123 Street, City, Country

+

Operating Hours: Monday to Friday, 9 AM to 6 PM

+
+ +
+ + + diff --git a/forgot password.html b/forgot password.html new file mode 100644 index 0000000..6706af0 --- /dev/null +++ b/forgot password.html @@ -0,0 +1,106 @@ + + + + + + Forgot Password + + + +
+

Forgot Password

+
+ + + +
+
+ Return to Login +
+ + + diff --git a/games.html b/games.html new file mode 100644 index 0000000..386e905 --- /dev/null +++ b/games.html @@ -0,0 +1,73 @@ + + + + + + + Game Selection + + + + + +

Select Your Game

+ +
+ + + +
+ + + + diff --git a/guess.html b/guess.html new file mode 100644 index 0000000..5b543a2 --- /dev/null +++ b/guess.html @@ -0,0 +1,234 @@ + + + + + + + Guess the Number Game + + + + + +

Guess the Number Game

+
+

Guess a number between 0 and 100:

+ + + +

Attempts: 0

+

Score: 0

+

Time Left: 30s

+ + + +
+ + + + + + diff --git a/hangman.html b/hangman.html new file mode 100644 index 0000000..d817a9c --- /dev/null +++ b/hangman.html @@ -0,0 +1,210 @@ + + + + + + + Hangman Game + + + + + +

Hangman Game

+ +
+ + + +
+ +
+
_ _ _ _ _
+
Score: 0
+
Guessed Letters:
+
+ + +
+
+ + + + +
+ + + + + + diff --git a/homepage.php b/homepage.php new file mode 100644 index 0000000..e601f19 --- /dev/null +++ b/homepage.php @@ -0,0 +1,173 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// Get the logged-in user's email from the session +$email = $_SESSION["loggedInUser"]; + +// Create SQL query using prepared statements +$sql = "SELECT username, email, streak FROM registration WHERE email = ?"; +$stmt = $conn->prepare($sql); + +// Check if the statement was prepared successfully +if (!$stmt) { + die("SQL Error: " . $conn->error); +} + +// Bind the parameter +$stmt->bind_param("s", $email); + +// Execute the query +$stmt->execute(); + +// Get the result of the query +$result = $stmt->get_result(); + +// Check if the user exists +if ($result->num_rows > 0) { + // Fetch the user's data + $user = $result->fetch_assoc(); + $userName = $user['username']; + $userEmail = $user['email']; + $userStreak = $user['streak']; +} else { + // If no user found, set default values + $userName = "Guest"; + $userEmail = "Not Found"; + $userStreak = 0; +} + +// Close the statement and connection +$stmt->close(); +$conn->close(); +?> + + + + + + + + User Profile + + + + +
+

Welcome to Info Path

+

Your one-stop destination for quality content and services.

+
+ + + +
+
+

Home

+

Explore our latest updates and featured content.

+
+
+

About

+

Learn more about us.

+
+
+

Services

+

Discover what we offer to meet your needs.

+
+
+

Contact

+

Get in touch with us for any inquiries.

+
+ + +
+
+

User Profile

+

Name:

+

Email:

+

Streak:

+
+
+
+ + + + + diff --git a/login.php b/login.php new file mode 100644 index 0000000..449eb1a --- /dev/null +++ b/login.php @@ -0,0 +1,169 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); + } + + if (!empty($_POST['email']) && !empty($_POST['password'])) { + $email = mysqli_real_escape_string($conn, $_POST['email']); + $password = mysqli_real_escape_string($conn, $_POST['password']); + + // Check user in registration table + $userCheck = mysqli_query($conn, "SELECT * FROM registration WHERE email='$email' AND password='$password'"); + + if ($userCheck && mysqli_num_rows($userCheck) > 0) { + $_SESSION['loggedInUser'] = $email; + $_SESSION['show_message'] = 'Logged In Successfully'; + + // Check if user exists in streak table + $streakCheck = mysqli_query($conn, "SELECT * FROM user_streak WHERE email='$email'"); + + $currentDate = date("Y-m-d"); + if (mysqli_num_rows($streakCheck) > 0) { + // User exists, update streak + $streakRow = mysqli_fetch_assoc($streakCheck); + $lastLoginDate = $streakRow['login_date']; + $streak = $streakRow['streak']; + + // Check if the user logged in on consecutive days + $lastLoginTimestamp = strtotime($lastLoginDate); + $currentTimestamp = strtotime($currentDate); + + $dateDiff = ($currentTimestamp - $lastLoginTimestamp) / (60 * 60 * 24); // Difference in days + + if ($dateDiff == 1) { + // User logged in consecutive days, increment streak + $newStreak = $streak + 1; + } elseif ($dateDiff > 1) { + // User missed a day, reset streak + $newStreak = 1; + } else { + // User logged in today again, no change to streak + $newStreak = $streak; + } + + // Update streak and last login date + $updateStreak = "UPDATE user_streak SET streak='$newStreak', login_date='$currentDate' WHERE email='$email'"; + + if (mysqli_query($conn, $updateStreak)) { + echo "Streak updated!"; + } else { + echo "Error updating streak: " . mysqli_error($conn); + } + } else { + // User doesn't exist, insert new streak record + $insertStreak = "INSERT INTO user_streak (email, streak, login_date) VALUES ('$email', 1, '$currentDate')"; + if (mysqli_query($conn, $insertStreak)) { + echo "New streak started!"; + } else { + echo "Error inserting streak: " . mysqli_error($conn); + } + } + + // Redirect to homepage after successful login + header('Location: homepage.php'); + } else { + $_SESSION['show_message'] = 'Invalid Email or Password'; + } + } else { + $_SESSION['show_message'] = 'All fields are required'; + } +} +?> + + + + + + + + Login Form + + + + +
+ +
+ + + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..e95af49 --- /dev/null +++ b/logout.php @@ -0,0 +1,7 @@ + diff --git a/math game.html b/math game.html new file mode 100644 index 0000000..1a6af6d --- /dev/null +++ b/math game.html @@ -0,0 +1,223 @@ + + + + + + + Math Battle Game + + + + + + +
+

Math Battle Game

+
+ Score: 0 +
+
+ Time Left: 10 seconds +
+
What is 5 + 3?
+
+ +
+ +
+
+ + +
+ + + + + + diff --git a/profile.php b/profile.php new file mode 100644 index 0000000..631fa39 --- /dev/null +++ b/profile.php @@ -0,0 +1,87 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +$email = trim($_SESSION["loggedInUser"]); + +// Fetch the user details from the registration table +$sql = "SELECT * FROM registration WHERE email = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("s", $email); +$stmt->execute(); +$result = $stmt->get_result(); + +// Get user details +if ($result->num_rows > 0) { + $user = $result->fetch_assoc(); + $user_id = $user['id']; +} else { + echo "No user found."; + exit(); +} + +// Get the streak +$streak = 0; +$today = date('Y-m-d'); +$last_login = null; + +// Get the login dates of the user +$sql = "SELECT login_date FROM user_streaks WHERE user_id = ? ORDER BY login_date DESC"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("i", $user_id); +$stmt->execute(); +$streak_result = $stmt->get_result(); + +// Calculate the streak +while ($row = $streak_result->fetch_assoc()) { + if (!$last_login) { + $last_login = $row['login_date']; + $streak++; + } else { + $diff = (strtotime($last_login) - strtotime($row['login_date'])) / (60 * 60 * 24); // Difference in days + if ($diff == 1) { + $streak++; + $last_login = $row['login_date']; + } else if ($diff > 1) { + break; // Streak breaks if the difference is more than 1 day + } + } +} + +// Display the profile page +?> + + + + + + + User Profile + + +

User Profile

+ +

Email:

+

Name:

+

Country:

+

Date of Birth:

+

Streak: days

+ + + +close(); +$conn->close(); +?> diff --git a/quiz.css b/quiz.css new file mode 100644 index 0000000..73c0a89 --- /dev/null +++ b/quiz.css @@ -0,0 +1,66 @@ +body { + font-family: Arial, sans-serif; + background-color: #f4f7f6; + color: #333; + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + text-align: center; +} + +.results-container { + background-color: #fff; + padding: 30px; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + max-width: 400px; + width: 100%; +} + +.results-container h1 { + font-size: 2.5em; + margin-bottom: 20px; + color: #4caf50; +} + +.results-container p { + font-size: 1.5em; + margin: 10px 0; +} + +.results-container .retry-button { + display: inline-block; + padding: 12px 24px; + margin-top: 20px; + font-size: 1.2em; + color: #fff; + background-color: #2196f3; + text-decoration: none; + border-radius: 5px; + transition: background-color 0.3s ease; +} + +.results-container .retry-button:hover { + background-color: #1976d2; +} + +.results-container .comments { + font-size: 1.2em; + margin: 20px 0; + font-style: italic; +} + +.results-container .excellent { + color: #4caf50; +} + +.results-container .good { + color: #ff9800; +} + +.results-container .try-again { + color: #f44336; +} diff --git a/quiz.php b/quiz.php new file mode 100644 index 0000000..d1db31f --- /dev/null +++ b/quiz.php @@ -0,0 +1,152 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// Fetch 5 random questions from the database +$sql = "SELECT * FROM questions ORDER BY RAND() LIMIT 5"; +$result = $conn->query($sql); + +$questions = []; +while ($row = $result->fetch_assoc()) { + $questions[] = $row; +} + +// Store correct answers in session +$correct_answers = []; +foreach ($questions as $index => $question) { + $correct_answers[] = $question['correct_option']; +} +$_SESSION['correct_answers'] = $correct_answers; + +// Initialize the score if it's not already in session +if (!isset($_SESSION['score'])) { + $_SESSION['score'] = 0; +} + +if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $current_question_index = $_POST['current_question_index']; + $answer = $_POST['answer']; + + // Check if the answer is correct and increment the score + if (isset($_SESSION['correct_answers'][$current_question_index]) && $answer == $_SESSION['correct_answers'][$current_question_index]) { + $_SESSION['score']++; // Increment score in session + } + + // Move to the next question or finish if it's the last question + $next_question_index = $current_question_index + 1; + if ($next_question_index < count($questions)) { + echo json_encode([ + 'next_question_index' => $next_question_index, + 'score' => $_SESSION['score'], + 'next_question' => $questions[$next_question_index] + ]); + } else { + // Redirect to the result page after the last question + header("Location: result.php"); + exit(); + } + exit; +} +?> + + + + + + + Quiz Application + + + +
+

Welcome to the Quiz!

+
+ +
+
+ + + + diff --git a/quiz1.css b/quiz1.css new file mode 100644 index 0000000..091ea62 --- /dev/null +++ b/quiz1.css @@ -0,0 +1,145 @@ +/* General styling for the body */ +body { + font-family: Arial, sans-serif; + background-color: #f4f7fc; + margin: 0; + padding: 0; + color: #333; +} + +.quiz-container { + width: 50%; + margin: 0 auto; + background-color: #ffffff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); + margin-top: 50px; + text-align: center; +} + +h1 { + font-size: 28px; + margin-bottom: 20px; + color: #333; +} + +#quiz-form { + margin-top: 20px; +} + +form { + display: block; + margin-bottom: 20px; +} + +p { + font-size: 18px; + margin-bottom: 10px; +} + +label { + display: block; + font-size: 16px; + margin-bottom: 8px; + text-align: left; /* Ensure left alignment */ + padding-left: 20px; /* Adding padding to align left better */ +} + +input[type="radio"] { + margin-right: 10px; + vertical-align: middle; /* Align radio buttons with text */ +} + +button { + background-color: #4CAF50; + color: white; + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 18px; + margin-top: 20px; + transition: background-color 0.3s ease; +} + +button:hover { + background-color: #45a049; +} + +button:active { + background-color: #388e3c; +} + +.retry-button { + background-color: #007bff; + color: white; + text-decoration: none; + padding: 10px 20px; + border-radius: 5px; + display: inline-block; + margin-top: 20px; + font-size: 18px; + transition: background-color 0.3s ease; +} + +.retry-button:hover { + background-color: #0056b3; +} + +.retry-button:active { + background-color: #003d7a; +} + +/* Add spacing between questions */ +.quiz-container form { + margin-bottom: 20px; +} + +/* Improve spacing between options */ +label { + margin-bottom: 12px; +} + +/* Styling for the results page */ +.results-container { + text-align: center; + padding: 20px; +} + +.results-container h1 { + font-size: 32px; + color: #333; +} + +.results-container p { + font-size: 20px; + color: #555; +} + +.results-container .retry-button { + background-color: #28a745; + color: white; +} + +.results-container .retry-button:hover { + background-color: #218838; +} + +.results-container .retry-button:active { + background-color: #1e7e34; +} +.submit-link { + display: inline-block; + padding: 10px 20px; + background-color: #007bff; + color: white; + text-decoration: none; + border-radius: 5px; + text-align: center; + margin-top: 20px; +} + +.submit-link:hover { + background-color: #0056b3; +} diff --git a/register.html b/register.html new file mode 100644 index 0000000..250bbfc --- /dev/null +++ b/register.html @@ -0,0 +1,386 @@ + + + + + + Registration Page + + + + +
+
+

Personal Information

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + diff --git a/register_validation.php b/register_validation.php new file mode 100644 index 0000000..87dc260 --- /dev/null +++ b/register_validation.php @@ -0,0 +1,48 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $username = isset($_POST['username']) ? $_POST['username'] : ''; + $email = isset($_POST['email']) ? $_POST['email'] : ''; + $dob = isset($_POST['dob']) ? $_POST['dob'] : ''; + $password = isset($_POST['password']) ? $_POST['password'] : ''; + $country = isset($_POST['country']) ? $_POST['country'] : ''; + $profession = isset($_POST['profession']) ? $_POST['profession'] : ''; + $gender = isset($_POST['gender']) ? $_POST['gender'] : ''; +// Capture form data +$username = $_POST['username']; +$email = $_POST['email']; +$dob = $_POST['dob']; +$password = $_POST['password']; +$country = $_POST['country']; +$profession = $_POST['profession']; +$gender = $_POST['gender']; + +// Insert data into the database +$sql = "INSERT INTO registration (username, email, dob, password, country, profession, gender) + VALUES ('$username', '$email', '$dob', '$password', '$country', '$profession', '$gender')"; + +if ($conn->query($sql) === TRUE) { +} +else { + echo "Error: " . $sql . "
" . $conn->error; +} +} +$conn->close(); +?> + + +

Continue to Login

+ + diff --git a/result.php b/result.php new file mode 100644 index 0000000..af9d848 --- /dev/null +++ b/result.php @@ -0,0 +1,33 @@ + + + + + + + + Quiz result + + + +
+

Your Quiz result

+

Your score is: / 5

+ + Excellent! You got all answers right!

"; + } elseif ($score >= 3) { + echo "

Good job! You have a solid understanding.

"; + } else { + echo "

Better luck next time! Keep practicing!

"; + } + ?> + + Retry Quiz +
+ + diff --git a/services.html b/services.html new file mode 100644 index 0000000..c913953 --- /dev/null +++ b/services.html @@ -0,0 +1,171 @@ + + + + + + + + Our Services + + + + + + + +
+
+

Our Services

+
+
+ +
+
+
+ +

Daily Rewards

+

Be active to gain something special.

+
+ + +
+ +

Rapid Quiz

+

Test Your Knowledge.

+
+ +
+ +

AI Chatbot

+

Under Development

+
+ +
+ +

Mock Exams

+

Improve your Studies.

+
+ +
+ +

Library

+

Know the World

+
+ + +
+ +

Games

+

Have Fun Studying

+
+
+
+ + + Go Back +
+ + + + diff --git a/style.css b/style.css new file mode 100644 index 0000000..63e1e9d --- /dev/null +++ b/style.css @@ -0,0 +1,113 @@ +/* General Styling */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins', sans-serif; +} + +body { + background-color: #f4f4f9; + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; +} + +/* Wrapper Styling */ +.wrapper { + width: 100%; + max-width: 400px; + background-color: #ffffff; + padding: 40px; + border-radius: 10px; + box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); + text-align: center; +} + +h1 { + font-size: 32px; + margin-bottom: 20px; + color: #333; +} + +/* Input Box Styling */ +.input-box { + position: relative; + margin-bottom: 20px; +} + +.input-box input { + width: 100%; + padding: 15px 40px 15px 20px; + font-size: 18px; + border-radius: 50px; + border: 1px solid #ddd; + outline: none; + background-color: #f9f9f9; +} + +.input-box i { + position: absolute; + top: 50%; + left: 10px; + transform: translateY(-50%); + font-size: 20px; + color: #777; +} + +/* Remember me and Forgot password section */ +.remember-forgot { + display: flex; + justify-content: space-between; + margin-bottom: 20px; + font-size: 14px; + color: #777; +} + +.remember-forgot label { + display: flex; + align-items: center; +} + +.remember-forgot a { + color: #3498db; + text-decoration: none; +} + +.remember-forgot a:hover { + text-decoration: underline; +} + +/* Button Styling */ +.btn { + width: 100%; + padding: 15px; + background-color: #3498db; + color: #fff; + border: none; + border-radius: 50px; + font-size: 18px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.btn:hover { + background-color: #2980b9; +} + +/* Register link section */ +.register-link { + margin-top: 20px; + font-size: 14px; + color: #777; +} + +.register-link a { + color: #3498db; + text-decoration: none; +} + +.register-link a:hover { + text-decoration: underline; +} diff --git a/track_streak.php b/track_streak.php new file mode 100644 index 0000000..c061bdf --- /dev/null +++ b/track_streak.php @@ -0,0 +1,48 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +$email = trim($_SESSION["loggedInUser"]); + +// Fetch the user details from the registration table +$sql = "SELECT * FROM registration WHERE email = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("s", $email); +$stmt->execute(); +$result = $stmt->get_result(); + +// Get user details +if ($result->num_rows > 0) { + $user = $result->fetch_assoc(); + $user_id = $user['id']; +} else { + echo "No user found."; + exit(); +} + +// Insert login date into user_streaks table +$today = date('Y-m-d'); + +// Check if the user logged in today +$checkStreak = $conn->query("SELECT * FROM user_streaks WHERE user_id = $user_id AND login_date = '$today'"); +if ($checkStreak->num_rows == 0) { + // Insert new login date + $conn->query("INSERT INTO user_streaks (user_id, login_date) VALUES ($user_id, '$today')"); +} + +$stmt->close(); +$conn->close(); +?> diff --git a/verifyotp.html b/verifyotp.html new file mode 100644 index 0000000..25b5f1c --- /dev/null +++ b/verifyotp.html @@ -0,0 +1,91 @@ + + + + + + OTP Verification + + + +
+

OTP Verification

+
+ + + +
+
+
+ + +