master
Prabit-Adhikari 6 months ago
commit 59948bbecd
  1. 139
      about.html
  2. 69
      contact.html
  3. 106
      forgot password.html
  4. 73
      games.html
  5. 234
      guess.html
  6. 210
      hangman.html
  7. 173
      homepage.php
  8. 169
      login.php
  9. 7
      logout.php
  10. 223
      math game.html
  11. 87
      profile.php
  12. 66
      quiz.css
  13. 152
      quiz.php
  14. 145
      quiz1.css
  15. 386
      register.html
  16. 48
      register_validation.php
  17. 33
      result.php
  18. 171
      services.html
  19. 113
      style.css
  20. 48
      track_streak.php
  21. 91
      verifyotp.html

@ -0,0 +1,139 @@
<?php
// About Page - about.php
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="About Us - Learn more about our mission, values, and services.">
<title>About Us</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #007bff;
color: white;
padding: 1rem 2rem;
text-align: center;
}
nav {
display: flex;
justify-content: center;
background-color: #333;
}
nav a {
color: white;
text-decoration: none;
padding: 1rem;
margin: 0 0.5rem;
}
nav a:hover {
background-color: #575757;
border-radius: 5px;
}
main {
padding: 2rem;
}
footer {
background-color: #007bff;
color: white;
text-align: center;
padding: 1rem;
position: fixed;
bottom: 0;
width: 100%;
}
.about-section {
max-width: 800px;
margin: 0 auto;
padding: 30px;
background-color: #f4f4f9;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.about-section h2 {
text-align: center;
color: #333;
}
.about-section p {
font-size: 18px;
color: #333;
line-height: 1.6;
}
.about-section ul {
margin-left: 20px;
font-size: 18px;
color: #333;
}
.btn-back {
display: inline-block;
padding: 10px 20px;
margin-top: 20px;
background-color: #007bff;
color: white;
text-decoration: none;
border-radius: 5px;
text-align: center;
font-size: 18px;
}
.btn-back:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<header>
<h1>About Us</h1>
<p>Learn more about our mission, values, and services.</p>
</header>
<nav>
<a href="homepage.php">Home</a>
<a href="about.php">About</a>
<a href="services.html">Services</a>
<a href="contact.html">Contact</a>
<a href="login.php">Log Out</a>
</nav>
<main>
<section class="about-section">
<h2>Who We Are</h2>
<p>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.</p>
<h3>Our Mission</h3>
<p>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.</p>
<h3>Our Values</h3>
<ul>
<li><strong>Integrity:</strong> We believe in being honest and transparent with our users at all times.</li>
<li><strong>Innovation:</strong> We are constantly evolving and finding new ways to improve our services and user experience.</li>
<li><strong>Customer-Centric:</strong> Our users' needs are our top priority, and we always strive to exceed their expectations.</li>
<li><strong>Collaboration:</strong> We work together as a team to build a platform that benefits everyone involved.</li>
</ul>
<h3>What We Offer</h3>
<p>Our platform offers a wide range of services, including:</p>
<ul>
<li>Quality content in various fields</li>
<li>Expert advice and resources</li>
<li>Personalized solutions tailored to user needs</li>
<li>Regular updates and improvements</li>
</ul>
<!-- Button to go back to the homepage -->
<a href="homepage.php" class="btn-back">Back to Home</a>
</section>
</main>
<footer>
<p>&copy; 2025 Info Path. All Rights Reserved.</p>
</footer>
</body>
</html>

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Contact Information Page">
<title>Contact Information</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #f9f9f9;
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: 50px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}
.text-center {
text-align: center;
}
.contact-info {
font-size: 1.2em;
margin-bottom: 30px;
}
.contact-info p {
margin: 10px 0;
}
.contact-info a {
color: #3498db;
text-decoration: none;
}
.btn {
display: inline-block;
padding: 10px 20px;
background-color: #3498db;
color: white;
border-radius: 5px;
text-decoration: none;
font-size: 16px;
text-align: center;
cursor: pointer;
}
.btn:hover {
background-color: #2980b9;
}
</style>
</head>
<body>
<div class="container">
<h1 class="text-center">Contact Information</h1>
<div class="contact-info">
<p><strong>Phone Number:</strong> +1 234567890</p>
<p><strong>Email Address:</strong> <a href="mailto:support@example.com">support@mail.com</a></p>
<p><strong>Office Address:</strong> 123 Street, City, Country</p>
<p><strong>Operating Hours:</strong> Monday to Friday, 9 AM to 6 PM</p>
</div>
<div class="text-center">
<a href="homepage.php" class="btn">Go Back to Homepage</a>
</div>
</div>
</body>
</html>

@ -0,0 +1,106 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Forgot Password</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
text-align: center;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
}
h2 {
margin-bottom: 20px;
}
form {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}
input[type="email"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
background-color: #007bff;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
#message {
margin-top: 10px;
font-size: 14px;
color: #333;
}
.return-btn {
background-color: #f0f0f0;
color: #007bff;
border: 1px solid #ccc;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
text-decoration: none;
display: inline-block;
margin-top: 10px;
}
.return-btn:hover {
background-color: #e0e0e0;
}
</style>
</head>
<body>
<div class="container">
<h2>Forgot Password</h2>
<form id="forgotPasswordForm">
<label for="email">Enter your email address:</label>
<input type="email" id="email" name="email" placeholder="Enter your email" required>
<button type="button" onclick="sendOtp()">Send OTP</button>
</form>
<div id="message"></div>
<a href="login.php" class="return-btn">Return to Login</a>
</div>
<script>
function sendOtp() {
const email = document.getElementById("email").value;
const message = document.getElementById("message");
if (email) {
message.textContent = 'An OTP has been sent to ' + email + '. Please check your email.';
// Simulate sending OTP and redirect to OTP verification page
setTimeout(function() {
window.location.href = 'verifyotp.html'; // Redirect to OTP verification page
}, 2000); // Redirect after 2 seconds
} else {
message.textContent = "Please enter a valid email address.";
}
}
</script>
</body>
</html>

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Selection</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
padding: 50px;
}
h1 {
font-size: 36px;
color: #333;
margin-bottom: 40px;
}
.game-option {
font-size: 24px;
margin: 20px;
padding: 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
width: 300px;
}
.game-option:hover {
background-color: #45a049;
}
.game-container {
display: flex;
flex-direction: column;
align-items: center;
}
.game-container button {
margin: 10px;
padding: 15px 30px;
font-size: 18px;
cursor: pointer;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
}
.game-container button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<h1>Select Your Game</h1>
<div class="game-container">
<button class="game-option" onclick="window.location.href='math game.html'">Math Battle</button>
<button class="game-option" onclick="window.location.href='hangman.html'">Hangman</button>
<button class="game-option" onclick="window.location.href='guess.html'">Guess it</button>
</div>
</body>
</html>

@ -0,0 +1,234 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Guess the Number Game</title>
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(to right, #ff7e5f, #feb47b);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
text-align: center;
flex-direction: column;
color: white;
}
h1 {
font-size: 36px;
margin-bottom: 20px;
}
.game-container {
width: 300px;
padding: 20px;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}
input, .btn {
padding: 10px;
font-size: 16px;
margin: 10px 0;
border-radius: 5px;
}
input {
width: 60%;
border: 1px solid #ccc;
background-color: #fff;
color: #333;
}
input:focus {
outline: none;
border-color: #0779e4;
}
.btn {
width: 100%;
background-color: #0779e4;
color: white;
border: none;
cursor: pointer;
}
.btn:hover {
background-color: #005bb5;
}
.feedback {
margin: 10px 0;
font-size: 18px;
font-weight: bold;
}
.attempts, .score, .timer {
font-size: 20px;
margin-top: 20px;
}
.game-over {
font-size: 24px;
color: #ff6347;
margin-top: 30px;
}
.hidden {
display: none;
}
.timer {
font-size: 24px;
color: yellow;
margin-top: 20px;
}
@media (max-width: 500px) {
.game-container {
width: 250px;
}
h1 {
font-size: 28px;
}
input, .btn {
font-size: 14px;
}
.attempts, .score, .timer {
font-size: 16px;
}
.game-over {
font-size: 20px;
}
}
</style>
</head>
<body>
<h1>Guess the Number Game</h1>
<div class="game-container" id="game-container">
<p>Guess a number between 0 and 100:</p>
<input type="number" id="guessInput" min="0" max="100" placeholder="Enter a number" />
<button class="btn" id="submitGuessButton">Submit Guess</button>
<p id="feedback" class="feedback"></p>
<p id="attempts" class="attempts">Attempts: 0</p>
<p id="score" class="attempts">Score: 0</p>
<p id="timer" class="timer">Time Left: 30s</p>
<button class="btn hidden" id="nextLevelButton" onclick="nextLevel()">Next Level</button>
<button class="btn hidden" id="restartButton" onclick="restartGame()">Play Again</button>
<p id="gameOverMessage" class="game-over hidden">Game Over! Your Final Score: 0</p>
</div>
<script>
let secretNumber;
let attempts;
let score;
let gameOver;
let timer;
let timeLeft;
let maxNumber = 100; // Max number is fixed at 100
function startGame() {
secretNumber = Math.floor(Math.random() * (maxNumber + 1)); // Generate number between 0 and 100
attempts = 0;
score = 0;
gameOver = false;
timeLeft = 30;
document.getElementById('feedback').textContent = '';
document.getElementById('attempts').textContent = `Attempts: ${attempts}`;
document.getElementById('score').textContent = `Score: ${score}`;
document.getElementById('timer').textContent = `Time Left: ${timeLeft}s`;
document.getElementById('guessInput').disabled = false;
document.getElementById('submitGuessButton').disabled = false;
document.getElementById('gameOverMessage').classList.add('hidden');
document.getElementById('restartButton').classList.add('hidden');
document.getElementById('nextLevelButton').classList.add('hidden');
// Start the timer
timer = setInterval(function () {
if (timeLeft > 0) {
timeLeft--;
document.getElementById('timer').textContent = `Time Left: ${timeLeft}s`;
} else {
gameOver = true;
clearInterval(timer);
endGame();
}
}, 1000);
}
function checkGuess() {
const guess = parseInt(document.getElementById('guessInput').value);
if (gameOver || isNaN(guess)) return;
attempts++;
if (guess === secretNumber) {
score += 10; // Add points for correct guess
document.getElementById('feedback').textContent = `Congratulations! You guessed it right! The number was ${secretNumber}.`;
document.getElementById('feedback').style.color = 'green';
document.getElementById('feedback').style.fontWeight = 'bold';
gameOver = true;
document.getElementById('nextLevelButton').classList.remove('hidden'); // Show next level button
clearInterval(timer); // Stop the timer
} else if (Math.abs(guess - secretNumber) <= 10) {
document.getElementById('feedback').textContent = `Close to the answer! Your guess is within 10 of the number.`;
document.getElementById('feedback').style.color = 'orange';
} else if (guess < secretNumber) {
document.getElementById('feedback').textContent = 'Too low! Try again.';
document.getElementById('feedback').style.color = 'red';
} else if (guess > secretNumber) {
document.getElementById('feedback').textContent = 'Too high! Try again.';
document.getElementById('feedback').style.color = 'red';
}
document.getElementById('attempts').textContent = `Attempts: ${attempts}`;
document.getElementById('score').textContent = `Score: ${score}`;
if (gameOver) {
document.getElementById('guessInput').disabled = true;
document.getElementById('submitGuessButton').disabled = true;
}
}
function nextLevel() {
// No change to maxNumber because range stays between 0 and 100
document.getElementById('nextLevelButton').classList.add('hidden');
startGame(); // Restart game with same range
}
function endGame() {
document.getElementById('guessInput').disabled = true;
document.getElementById('submitGuessButton').disabled = true;
document.getElementById('gameOverMessage').textContent = `Game Over! The correct number was ${secretNumber}. Your Final Score: ${score}`;
document.getElementById('gameOverMessage').classList.remove('hidden');
document.getElementById('restartButton').classList.remove('hidden');
}
function restartGame() {
startGame();
}
// Start a new game when the page loads
startGame();
// Event listener for the submit guess button
document.getElementById('submitGuessButton').addEventListener('click', checkGuess);
</script>
</body>
</html>

@ -0,0 +1,210 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hangman Game</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
padding: 50px;
}
h1 {
font-size: 36px;
color: #333;
}
.difficulty {
font-size: 20px;
margin: 20px 0;
}
.btn {
font-size: 18px;
padding: 10px 20px;
cursor: pointer;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
margin: 5px;
}
.btn:hover {
background-color: #45a049;
}
.input-box {
margin-top: 20px;
}
.word {
font-size: 40px;
margin: 20px;
}
.result {
font-size: 24px;
margin: 20px;
}
.score {
font-size: 24px;
margin: 10px;
}
.guesses {
font-size: 18px;
margin: 10px;
}
#try-again-btn,
#go-back-btn {
display: none;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
background-color: #ff6347;
color: white;
border: none;
border-radius: 5px;
margin-top: 20px;
}
#try-again-btn:hover,
#go-back-btn:hover {
background-color: #e55347;
}
</style>
</head>
<body>
<h1>Hangman Game</h1>
<div class="difficulty">
<button class="btn" onclick="startGame('easy')">Easy</button>
<button class="btn" onclick="startGame('medium')">Medium</button>
<button class="btn" onclick="startGame('hard')">Hard</button>
</div>
<div class="game-container">
<div class="word" id="wordDisplay">_ _ _ _ _</div>
<div class="score" id="score">Score: 0</div>
<div class="guesses" id="guessedLetters">Guessed Letters: </div>
<div class="input-box">
<input type="text" id="letterInput" maxlength="1" placeholder="Enter a letter" />
<button class="btn" onclick="guessLetter()">Guess</button>
</div>
<div class="result" id="result"></div>
<!-- Try Again and Go Back buttons -->
<button id="try-again-btn" class="btn" onclick="tryAgain()">Try Again</button>
<button id="go-back-btn" class="btn" onclick="goBack()">Go Back</button>
</div>
<script>
let words = {
easy: ["apple", "banana", "grape"],
medium: ["orange", "strawberry", "pineapple"],
hard: ["watermelon", "pomegranate", "blueberry"]
};
let selectedWord = "";
let guessedLetters = [];
let incorrectGuesses = 0;
let maxIncorrectGuesses = 6;
let score = 0;
let wordDisplay = document.getElementById('wordDisplay');
let scoreDisplay = document.getElementById('score');
let guessedLettersDisplay = document.getElementById('guessedLetters');
let resultDisplay = document.getElementById('result');
let letterInput = document.getElementById('letterInput');
function startGame(difficulty) {
incorrectGuesses = 0;
guessedLetters = [];
score = 0;
resultDisplay.textContent = '';
guessedLettersDisplay.textContent = 'Guessed Letters: ';
let randomIndex = Math.floor(Math.random() * words[difficulty].length);
selectedWord = words[difficulty][randomIndex];
wordDisplay.textContent = "_ ".repeat(selectedWord.length).trim();
scoreDisplay.textContent = "Score: " + score;
letterInput.value = '';
document.getElementById('try-again-btn').style.display = 'none'; // Hide "Try Again"
document.getElementById('go-back-btn').style.display = 'none'; // Hide "Go Back"
}
function guessLetter() {
let guessedLetter = letterInput.value.toLowerCase();
if (!guessedLetter || guessedLetters.includes(guessedLetter)) {
return;
}
guessedLetters.push(guessedLetter);
guessedLettersDisplay.textContent = "Guessed Letters: " + guessedLetters.join(", ");
if (selectedWord.includes(guessedLetter)) {
updateWordDisplay();
score++;
scoreDisplay.textContent = "Score: " + score;
} else {
incorrectGuesses++;
if (incorrectGuesses >= maxIncorrectGuesses) {
resultDisplay.textContent = `Game Over! The word was "${selectedWord}". Your final score is ${score}.`;
resultDisplay.style.color = 'red';
disableGame();
}
}
letterInput.value = '';
checkGameStatus();
}
function updateWordDisplay() {
let displayedWord = selectedWord.split('').map(letter => guessedLetters.includes(letter) ? letter : '_').join(' ');
wordDisplay.textContent = displayedWord;
if (!displayedWord.includes('_')) {
resultDisplay.textContent = `You Win! The word was "${selectedWord}". Your score is ${score}.`;
resultDisplay.style.color = 'green';
disableGame();
}
}
function checkGameStatus() {
if (incorrectGuesses >= maxIncorrectGuesses) {
resultDisplay.textContent = `Game Over! The word was "${selectedWord}". Your score is ${score}.`;
resultDisplay.style.color = 'red';
disableGame();
}
}
function disableGame() {
letterInput.disabled = true;
document.querySelectorAll(".btn").forEach(btn => btn.disabled = true);
document.getElementById('try-again-btn').style.display = 'inline-block'; // Show "Try Again"
document.getElementById('go-back-btn').style.display = 'inline-block'; // Show "Go Back"
}
function tryAgain() {
// Restart the game by calling startGame with the current difficulty
const currentDifficulty = document.querySelector(".difficulty .btn:active").textContent.toLowerCase();
startGame(currentDifficulty);
}
function goBack() {
// Go back to the previous page or homepage
window.history.back(); // Uncomment this for going back to the previous page
// Or you can redirect to a homepage like:
// window.location.href = 'index.html'; // Uncomment and replace with your homepage URL
}
</script>
</body>
</html>

@ -0,0 +1,173 @@
<?php
// Start the session and check if the user is logged in
session_start();
// Check if the user is logged in
if (!isset($_SESSION["loggedInUser"])) {
header("Location: login.php"); // Redirect to login page if not logged in
exit();
}
// Database connection
$conn = new mysqli('localhost', 'root', '', 'user'); // Replace with your database credentials
if ($conn->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();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Welcome to our homepage. Explore our services, products, and more.">
<title>User Profile</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #007bff;
color: white;
padding: 1rem 2rem;
text-align: center;
}
nav {
display: flex;
justify-content: center;
background-color: #333;
}
nav a {
color: white;
text-decoration: none;
padding: 1rem;
margin: 0 0.5rem;
}
nav a:hover {
background-color: #575757;
border-radius: 5px;
}
main {
padding: 2rem;
}
footer {
background-color: #007bff;
color: white;
text-align: center;
padding: 1rem;
position: fixed;
bottom: 0;
width: 100%;
}
.profile-card {
width: 50%;
margin: 30px auto;
padding: 20px;
background-color: #f4f4f9;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.profile-card h2 {
text-align: center;
}
.profile-card p {
font-size: 18px;
color: #333;
}
.profile-card strong {
color: #007bff;
}
</style>
</head>
<body>
<header>
<h1>Welcome to Info Path</h1>
<p>Your one-stop destination for quality content and services.</p>
</header>
<nav>
<a href="homepage.php">Home</a>
<a href="about.html">About</a>
<a href="services.html">Services</a>
<a href="contact.html">Contact</a>
<a href="login.php">Log Out</a>
</nav>
<main>
<section id="home">
<h2>Home</h2>
<p>Explore our latest updates and featured content.</p>
</section>
<section id="about">
<h2>About</h2>
<p>Learn more about us.</p>
</section>
<section id="services">
<h2>Services</h2>
<p>Discover what we offer to meet your needs.</p>
</section>
<section id="contact">
<h2>Contact</h2>
<p>Get in touch with us for any inquiries.</p>
</section>
<!-- User Profile Section -->
<section id="profile">
<div class="profile-card">
<h2>User Profile</h2>
<p><strong>Name:</strong> <?php echo htmlspecialchars($userName); ?></p>
<p><strong>Email:</strong> <?php echo htmlspecialchars($userEmail); ?></p>
<p><strong>Streak:</strong> <?php echo htmlspecialchars($userStreak); ?></p>
</div>
</section>
</main>
<footer>
<p>&copy; 2025 Your Website Name. All Rights Reserved.</p>
</footer>
</body>
</html>

@ -0,0 +1,169 @@
<?php
session_start();
// Check if the user is logged in
if (isset($_POST['loginBtn'])) {
// Database connection
$conn = new mysqli('localhost', 'root', '', 'user'); // Replace with your database credentials
if ($conn->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';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Login to your account.">
<title>Login Form</title>
<style>
html, body {
font-family: Arial, Helvetica, sans-serif;
}
.text-center {
text-align: center;
}
.login-card {
display: block;
margin: 30px auto 0px auto;
width: 30%;
border: 1px solid #ccc;
box-shadow: 3px 3px 9px 3px #ddd;
padding: 20px;
}
.input-box {
width: 95%;
margin-top: 10px;
margin-bottom: 20px;
}
.input-box input {
width: 100%;
display: block;
border: 1px solid #777;
border-radius: 4px;
padding: 8px 8px;
}
.submit-btn {
width: 100%;
padding: 10px;
background-color: blue;
color: #fff;
outline: 0;
border-radius: 6px;
margin-bottom: 10px;
cursor: pointer;
}
.alert {
background-color: skyblue;
padding: 14px 20px;
color: #fff;
}
</style>
</head>
<body>
<div>
<div class="login-card">
<?php
if (isset($_SESSION['show_message'])) {
echo '<h4 class="alert">' . $_SESSION['show_message'] . '</h4>';
unset($_SESSION['show_message']);
}
?>
<h2 class="text-center">Login Form</h2>
<hr>
<br/>
<form action="" method="POST">
<div class="input-box">
<label>Email Address</label>
<input type="email" name="email" />
</div>
<div class="input-box">
<label>Password</label>
<input type="password" name="password" />
</div>
<div>
<button name="loginBtn" class="submit-btn">Login Now</button>
</div>
<div class="text-center">
<br/>
<a href="register.html">Don't have an account? Register now</a>
<br/><br/>
<a href="forgot_password.html">Forgot Password?</a>
</div>
</form>
</div>
</div>
</body>
</html>

@ -0,0 +1,7 @@
<?php
session_start();
session_unset();
session_destroy();
header("Location: views/login.php");
exit();
?>

@ -0,0 +1,223 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Math Battle Game</title>
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
text-align: center;
}
.container {
margin-top: 50px;
}
.score, .timer {
font-size: 24px;
margin-bottom: 20px;
}
.question {
font-size: 32px;
margin: 20px 0;
}
.input-box {
margin: 20px 0;
}
.input-box input {
padding: 10px;
font-size: 18px;
width: 200px;
}
.btn {
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
background-color: #0779e4;
color: white;
border: none;
border-radius: 5px;
}
.btn:hover {
background-color: #005bb5;
}
.result {
font-size: 24px;
margin: 20px 0;
}
.final-score {
font-size: 36px;
color: green;
margin-top: 20px;
}
#try-again-btn, #go-back-btn {
display: none;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
background-color: #ff6347;
color: white;
border: none;
border-radius: 5px;
margin-top: 20px;
}
#try-again-btn:hover, #go-back-btn:hover {
background-color: #e55347;
}
</style>
</head>
<body>
<div class="container">
<h1>Math Battle Game</h1>
<div class="score">
Score: <span id="score">0</span>
</div>
<div class="timer">
Time Left: <span id="timer">10</span> seconds
</div>
<div class="question" id="question">What is 5 + 3?</div>
<div class="input-box">
<input type="number" id="answer" placeholder="Enter your answer">
</div>
<button class="btn" onclick="checkAnswer()">Submit</button>
<div class="result" id="result"></div>
<div id="final-score" class="final-score"></div>
<button id="try-again-btn" class="btn" onclick="tryAgain()">Try Again</button>
<button id="go-back-btn" class="btn" onclick="goBack()">Go Back</button>
</div>
<script>
let score = 0;
let timeLeft = 10;
let questionCount = 0;
const totalQuestions = 10;
let timerInterval;
let correctAnswer;
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function generateQuestion() {
const num1 = getRandomNumber(1, 20);
const num2 = getRandomNumber(1, 20);
const operators = ['+', '-', '*'];
const operator = operators[Math.floor(Math.random() * operators.length)];
return {
question: `${num1} ${operator} ${num2}`,
answer: eval(`${num1} ${operator} ${num2}`)
};
}
function displayNewQuestion() {
const questionData = generateQuestion();
document.getElementById('question').textContent = `What is ${questionData.question}?`;
return questionData.answer;
}
function startTimer() {
timeLeft = 10;
document.getElementById('timer').textContent = timeLeft;
timerInterval = setInterval(function () {
timeLeft--;
document.getElementById('timer').textContent = timeLeft;
if (timeLeft <= 0) {
clearInterval(timerInterval);
handleTimeout();
}
}, 1000);
}
function handleTimeout() {
document.getElementById('result').textContent = 'Time is up! You lose a point.';
document.getElementById('result').style.color = 'red';
score = Math.max(0, score - 1);
document.getElementById('score').textContent = score;
correctAnswer = displayNewQuestion();
startTimer();
questionCount++;
if (questionCount >= totalQuestions) {
endGame();
}
}
function checkAnswer() {
const userAnswer = Number(document.getElementById('answer').value);
clearInterval(timerInterval);
const resultElement = document.getElementById('result');
if (userAnswer === correctAnswer) {
resultElement.textContent = 'Correct!';
resultElement.style.color = 'green';
score++;
} else {
resultElement.textContent = 'Wrong! Try again.';
resultElement.style.color = 'red';
}
document.getElementById('score').textContent = score;
document.getElementById('answer').value = '';
correctAnswer = displayNewQuestion();
startTimer();
questionCount++;
if (questionCount >= totalQuestions) {
endGame();
}
}
function endGame() {
document.getElementById('question').textContent = 'Game Over!';
document.getElementById('result').textContent = '';
document.getElementById('timer').style.display = 'none';
document.getElementById('final-score').textContent = `Your Final Score is: ${score}`;
document.getElementById('try-again-btn').style.display = 'inline-block'; // Show "Try Again" button
document.getElementById('go-back-btn').style.display = 'inline-block'; // Show "Go Back" button
}
function tryAgain() {
// Reset the game
score = 0;
timeLeft = 10;
questionCount = 0;
document.getElementById('score').textContent = score;
document.getElementById('timer').style.display = 'block';
document.getElementById('final-score').textContent = '';
document.getElementById('try-again-btn').style.display = 'none'; // Hide "Try Again" button
document.getElementById('go-back-btn').style.display = 'none'; // Hide "Go Back" button
correctAnswer = displayNewQuestion();
startTimer();
}
function goBack() {
// Go back to the previous page or homepage
window.history.back(); // This will take the user to the previous page
// Or you can redirect to a homepage like:
// window.location.href = 'index.html'; // Uncomment and replace with your homepage
}
// Initialize the first question and start the timer
correctAnswer = displayNewQuestion();
startTimer();
</script>
</body>
</html>

@ -0,0 +1,87 @@
<?php
session_start();
// Check if the user is logged in
if (!isset($_SESSION["loggedInUser"])) {
header("Location: login.php");
exit();
}
$conn = new mysqli('localhost', 'root', '', 'user'); // Your database credentials
// Check connection
if ($conn->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
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Profile</title>
</head>
<body>
<h1>User Profile</h1>
<p><strong>Email:</strong> <?php echo htmlspecialchars($user['email']); ?></p>
<p><strong>Name:</strong> <?php echo htmlspecialchars($user['name']); ?></p>
<p><strong>Country:</strong> <?php echo htmlspecialchars($user['country']); ?></p>
<p><strong>Date of Birth:</strong> <?php echo htmlspecialchars($user['dob']); ?></p>
<p><strong>Streak:</strong> <?php echo $streak; ?> days</p>
</body>
</html>
<?php
$stmt->close();
$conn->close();
?>

@ -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;
}

@ -0,0 +1,152 @@
<?php
session_start();
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "user";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->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;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz Application</title>
<link rel="stylesheet" type="text/css" href="quiz1.css">
</head>
<body>
<div class="quiz-container">
<h1>Welcome to the Quiz!</h1>
<div id="quiz-form">
<!-- Questions will appear dynamically here -->
</div>
</div>
<script>
const questions = <?php echo json_encode($questions); ?>;
const totalQuestions = questions.length;
let currentQuestionIndex = 0;
let score = <?php echo isset($_SESSION['score']) ? $_SESSION['score'] : 0; ?>;
// Function to display a question
function displayQuestion() {
const question = questions[currentQuestionIndex];
const quizForm = document.getElementById('quiz-form');
// Check if it's the last question
const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
quizForm.innerHTML = `
<form id="quiz-form-${currentQuestionIndex}">
<p>${question.question}</p>
<label>
<input type="radio" name="answer" value="A" required>
${question.option_a}
</label><br>
<label>
<input type="radio" name="answer" value="B">
${question.option_b}
</label><br>
<label>
<input type="radio" name="answer" value="C">
${question.option_c}
</label><br>
<label>
<input type="radio" name="answer" value="D">
${question.option_d}
</label><br>
${
isLastQuestion
? `<a href="result.php" class="submit-link">Submit</a>`
: `<button type="submit">Next</button>`
}
</form>
`;
document.getElementById(`quiz-form-${currentQuestionIndex}`).addEventListener('submit', function(event) {
event.preventDefault();
const selectedAnswer = document.querySelector(`input[name="answer"]:checked`);
if (selectedAnswer) {
const answer = selectedAnswer.value;
// Send the current answer and question index to PHP via AJAX
fetch('quiz.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `answer=${answer}&current_question_index=${currentQuestionIndex}`
})
.then(response => response.json())
.then(data => {
score = data.score;
if (data.next_question_index < totalQuestions) {
currentQuestionIndex = data.next_question_index;
displayQuestion();
} else {
window.location.href = 'result.php'; // Redirect after the last question
}
});
} else {
alert('Please select an answer!');
}
});
}
// Start the quiz by displaying the first question
displayQuestion();
</script>
</body>
</html>

@ -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;
}

@ -0,0 +1,386 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Page</title>
<style>
body {
font-family: 'Arial', sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f7f7f7;
margin: 0;
}
.container {
display: flex;
justify-content: space-between;
width: 850px;
padding: 20px;
background-color: #fff;
border-radius: 12px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}
.column {
width: 48%;
padding: 30px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
h2 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 10px;
font-size: 14px;
color: #555;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select {
width: 100%;
padding: 12px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 6px;
box-sizing: border-box;
font-size: 14px;
}
select {
cursor: pointer;
}
button {
background-color: #3690d0;
color: white;
padding: 12px 25px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
width: 100%;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #41aad6;
}
.button-secondary {
background-color: #f0f0f0;
color: #333;
border: 1px solid #ccc;
margin-top: 10px;
}
.button-secondary:hover {
background-color: #e6e6e6;
}
.form-footer {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="column">
<h2>Personal Information</h2>
<form method="POST" action="register_validation.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="dob">Date of Birth:</label>
<input type="date" id="dob" name="dob">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<label for="country">Country:</label>
<select id="country" name="country" required>
<option value="">Select Country</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia</option>
<option value="BA">Bosnia and Herzegovina</option>
<option value="BW">Botswana</option>
<option value="BR">Brazil</option>
<option value="IO">British Indian Ocean Territory</option>
<option value="BN">Brunei Darussalam</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CX">Christmas Island</option>
<option value="CC">Cocos (Keeling) Islands</option>
<option value="CO">Colombia</option>
<option value="KM">Comoros</option>
<option value="CG">Congo</option>
<option value="CD">Congo, the Democratic Republic of the</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CI">Côte d'Ivoire</option>
<option value="HR">Croatia</option>
<option value="CU">Cuba</option>
<option value="CW">Curaçao</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FK">Falkland Islands (Malvinas)</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="TF">French Southern Territories</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GG">Guernsey</option>
<option value="GN">Guinea</option>
<option value="GW">Guinea-Bissau</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HM">Heard Island and McDonald Islands</option>
<option value="VA">Holy See (Vatican City State)</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IR">Iran</option>
<option value="IQ">Iraq</option>
<option value="IE">Ireland</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="KR">Korea, Republic of</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Lao People's Democratic Republic</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macao</option>
<option value="MK">Macedonia, The former Yugoslav Republic of</option>
<option value="MG">Madagascar</option>
<option value="MW">Malawi</option>
<option value="MY">Malaysia</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="YT">Mayotte</option>
<option value="MX">Mexico</option>
<option value="FM">Micronesia (Federated States of)</option>
<option value="MD">Moldova (Republic of)</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="ME">Montenegro</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Namibia</option>
<option value="NR">Nauru</option>
<option value="NP">Nepal</option>
<option value="NL">Netherlands</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NU">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau</option>
<option value="PS">Palestinian Territory, Occupied</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PN">Pitcairn Islands</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="RE">Réunion</option>
<option value="RO">Romania</option>
<option value="RU">Russian Federation</option>
<option value="RW">Rwanda</option>
<option value="BL">Saint Barthélemy</option>
<option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
<option value="KN">Saint Kitts and Nevis</option>
<option value="LC">Saint Lucia</option>
<option value="MF">Saint Martin (French part)</option>
<option value="PM">Saint Pierre and Miquelon</option>
<option value="VC">Saint Vincent and the Grenadines</option>
<option value="WS">Samoa</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome and Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="RS">Serbia</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SX">Sint Maarten (Dutch part)</option>
<option value="SK">Slovakia</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="SO">Somalia</option>
<option value="ZA">South Africa</option>
<option value="GS">South Georgia and the South Sandwich Islands</option>
<option value="SS">South Sudan</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SJ">Svalbard and Jan Mayen</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syrian Arab Republic</option>
<option value="TW">Taiwan</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania (United Republic of)</option>
<option value="TH">Thailand</option>
<option value="TL">Timor-Leste</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad and Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TM">Turkmenistan</option>
<option value="TC">Turks and Caicos Islands</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States of America</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VE">Venezuela (Bolivarian Republic of)</option>
<option value="VN">Viet Nam</option>
<option value="WF">Wallis and Futuna</option>
<option value="EH">Western Sahara</option>
<option value="YE">Yemen</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
</select>
<label for="profession">Profession:</label>
<input type="text" id="profession" name="profession">
<label for="gender">Gender:</label>
<select id="gender" name="gender" required>
<option value="">Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
<button type="submit">Register</button>
</form>
<div class="form-footer">
<a href="login.php">
<button class="button-secondary">Return to Login</button>
</a>
</div>
</div>
</div>
</body>
</html>

@ -0,0 +1,48 @@
<?php
$servername = "localhost";
$username = "root"; // Default XAMPP username
$password = ""; // Default XAMPP password (usually empty)
$dbname = "user";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->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 . "<br>" . $conn->error;
}
}
$conn->close();
?>
<html>
<body>
<P ><a href="login.php">Continue to Login</a></P>
</body>
</html>

@ -0,0 +1,33 @@
<?php
session_start();
$score = isset($_SESSION['score']) ? $_SESSION['score'] : 0;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz result</title>
<link rel="stylesheet" href="quiz.css">
</head>
<body>
<div class="result-container">
<h1>Your Quiz result</h1>
<p>Your score is: <?php echo $score; ?> / 5</p>
<?php
// Optionally, you can add some comments based on the score
if ($score == 5) {
echo "<p>Excellent! You got all answers right!</p>";
} elseif ($score >= 3) {
echo "<p>Good job! You have a solid understanding.</p>";
} else {
echo "<p>Better luck next time! Keep practicing!</p>";
}
?>
<a href="quiz.php" class="retry-button">Retry Quiz</a>
</div>
</body>
</html>

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Our Services</title>
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="style.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header {
background: #333;
color: #fff;
padding-top: 30px;
min-height: 70px;
border-bottom: #0779e4 3px solid;
}
header a {
color: #fff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
header ul {
margin: 0;
padding: 0;
list-style: none;
line-height: 70px;
}
header li {
float: left;
display: inline;
padding: 0 20px;
}
.services {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px 0;
}
.service {
background: #fff;
padding: 20px;
margin: 10px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
flex: 1 1 calc(33% - 20px);
box-sizing: border-box;
}
.service i {
font-size: 50px;
color: #0779e4;
margin-bottom: 10px;
}
.service h3 {
margin: 10px 0;
}
.service p {
color: #666;
}
.btn-back {
display: inline-block;
padding: 10px 20px;
background-color: #0779e4;
color: white;
text-decoration: none;
border-radius: 5px;
text-align: center;
margin-top: 20px;
font-size: 18px;
}
.btn-back:hover {
background-color: #0056b3;
}
@media(max-width: 768px) {
.service {
flex: 1 1 calc(50% - 20px);
}
}
@media(max-width: 480px) {
.service {
flex: 1 1 100%;
}
}
</style>
</head>
<body>
<header>
<div class="container">
<h1>Our Services</h1>
</div>
</header>
<div class="container">
<div class="services">
<div class="service">
<i class='bx bx-code'></i>
<h3>Daily Rewards</h3>
<p>Be active to gain something special.</p>
</div>
<a href="quiz.php">
<div class="service">
<i class='bx bx-mobile-alt'></i>
<h3>Rapid Quiz</h3>
<p>Test Your Knowledge.</p>
</div></a>
<div class="service">
<i class='bx bx-server'></i>
<h3>AI Chatbot</h3>
<p>Under Development</p>
</div>
<div class="service">
<i class='bx bx-bar-chart'></i>
<h3>Mock Exams</h3>
<p>Improve your Studies.</p>
</div>
<div class="service">
<i class='bx bx-shield'></i>
<h3>Library</h3>
<p>Know the World</p>
</div>
<a href="games.html">
<div class="service">
<i class='bx bx-brush'></i>
<h3>Games</h3>
<p>Have Fun Studying</p>
</div>
</a>
</div>
<!-- Go Back Button -->
<a href="homepage.php" class="btn-back">Go Back</a>
</div>
</body>
</html>

@ -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;
}

@ -0,0 +1,48 @@
<?php
session_start();
// Check if the user is logged in
if (!isset($_SESSION["loggedInUser"])) {
header("Location: login.php");
exit();
}
// Database connection
$conn = new mysqli('localhost', 'root', '', 'user'); // Your database credentials
// Check connection
if ($conn->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();
?>

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OTP Verification</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
text-align: center;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
}
h2 {
margin-bottom: 20px;
}
form {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
background-color: #007bff;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
#message {
margin-top: 10px;
font-size: 14px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h2>OTP Verification</h2>
<form id="otpVerificationForm">
<label for="otp">Enter the OTP:</label>
<input type="text" id="otp" name="otp" placeholder="Enter the OTP" required>
<button type="button" onclick="verifyOtp()">Verify OTP</button>
</form>
<div id="message"></div>
</div>
<script>
function verifyOtp() {
const enteredOtp = document.getElementById("otp").value;
const message = document.getElementById("message");
const staticOtp = '7000'; // Static OTP
if (enteredOtp === staticOtp) {
message.textContent = 'OTP verified successfully. Redirecting to homepage...';
setTimeout(function() {
window.location.href = 'homepage.php'; // Redirect to homepage
}, 2000); // Redirect after 2 seconds
} else {
message.textContent = "Invalid OTP. Please try again.";
}
}
</script>
</body>
</html>
Loading…
Cancel
Save