Open mahin993 opened 7 months ago
Retrieved data
<!DOCTYPE html>
/ Add your existing styles here /
/ Modal styles / .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); }
.modal-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); }
.close { position: absolute; top: 10px; right: 10px; font-size: 20px; cursor: pointer; }
New commt
<!DOCTYPE html>
<!DOCTYPE html>
Login
Register
// login php <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get the posted data $username = $_POST["username"]; $password = $_POST["password"];
} else { echo "Invalid request method"; } ?>
// register php
<?php if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get the posted data $regUsername = $_POST["regUsername"]; $regPassword = $_POST["regPassword"];
} else { echo "Invalid request method"; } ?>
//index.php
<!DOCTYPE html>
Employee ID: " . $row['employee_id'] . "
"; echo "Employee Name: " . $row['employee_name'] . "
"; // Add other employee details as needed } } else { echo "No employee data available."; } // Add a logout button echo ''; } else { // Display login and registration forms include 'login.php'; include 'register.php'; } ?>//login php
Login
// register php
Register
//config.php
<?php $servername = "localhost"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } ?>
//login_process.php
<?php session_start();
include 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") { $username = $_POST["username"]; $password = $_POST["password"];
} else { echo "Invalid request method"; } ?>
//register_process.php
<?php include 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") { $regUsername = $_POST["regUsername"]; $regPassword = $_POST["regPassword"];
} else { echo "Invalid request method"; } ?>
// logout.php
<?php session_start();
// Destroy the session and redirect to login page session_destroy(); header("Location: index.php"); exit(); ?>
//style.css
body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; }
.form-container { background-color: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); margin: 10px; }
button { padding: 10px; cursor: pointer; background-color: #4CAF50; color: white; border: none; border-radius: 4px; }
button:hover { background-color: #45a049; }