REGISTRATION
REGISTRATION
<?php
// Database connection
if ($conn->connect_error) {
$username = trim($_POST['username']);
$phone_number = trim($_POST['phone_number']);
$account_type = trim($_POST['account_type']);
$password = trim($_POST['password']);
// Basic validation
exit;
if (!preg_match('/^\d{10}$/', $phone_number)) {
exit;
}
// Hash the password securely
$checkStmt->execute();
$result = $checkStmt->get_result();
if ($result->num_rows > 0) {
$checkStmt->close();
exit;
if ($stmt->execute()) {
} else {
header("Location: dashboard.php"); // Employee/employer
dashboard
exit;
} else {
$stmt->close();
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min
.css" rel="stylesheet">
<link
href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-
icons.css" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
.card {
border-radius: 10px;
button {
font-weight: bold;
.bi-cloud {
font-size: 3rem;
color: orange;
</style>
</head>
<body>
<h3>Register</h3>
</div>
<div class="mb-3">
<label for="username"
class="form-label">Username</label>
</div>
<div class="mb-3">
</div>
<div class="mb-3">
<option value="admin">Admin</option>
<option value="employee">Employee</option>
<option value="employer">Employer</option>
</select>
</div>
<div class="mb-3">
<label for="password"
class="form-label">Password</label>
</div>
</form>
</div>
</div>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundl
e.min.js"></script>
</body>
</html>
LOGIN
<?php
// Database connection
if ($conn->connect_error) {
$username = trim($_POST['username']);
$account_type = trim($_POST['account_type']);
$password = trim($_POST['password']);
// Basic validation
} else {
if (!$stmt) {
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows > 0) {
$stmt->bind_result($hashed_password);
$stmt->fetch();
// Verify password
if (password_verify($password, $hashed_password)) {
header("Location: dashboard2.php");
header("Location: dashboard.php");
exit;
} else {
} else {
$stmt->close();
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/
css/all.min.css" rel="stylesheet">
<style>
body {
background: #f8f9fa;
.login-card {
background-color: white;
width: 100%;
max-width: 400px;
border-radius: 10px;
padding: 20px;
.login-card h3 {
font-weight: bold;
.input-group-text {
background-color: #feb47b;
color: white;
}
.btn-primary {
.btn-primary:hover {
a {
color: #ff7e5f;
a:hover {
text-decoration: underline;
</style>
</head>
<body>
<div class="mb-4">
</div>
<h3 class="mb-4">Login</h3>
</div>
<option value="admin">Admin</option>
<option value="employee">Employee</option>
<option value="employer">Employer</option>
</select>
</div>
</form>
<hr>
</div>
</div>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundl
e.min.js"></script>
</body>
</html>
Database check
);
Or this
);