Lab Report User Authentication System Using PHP
Lab Report User Authentication System Using PHP
Uttara University
Sector-14, Uttara Model Town, Dhaka-1230
Submitted by:
Lovely Akter
Roll No.: 2233091011
Registration No.: UU 233258127
Session: Spring - 2025
Date of Submission:
April 5, 2025
“I hereby declare that this lab report is a result of my own work and effort. I have
not copied or plagiarized any part of this report from any other source.”
Signature:
Lovely Akter
(You may insert your scanned signature image here if required.)
1. Introduction
This lab report presents the development of a User Authentication System using
PHP, which includes:
User Login
User Registration
2. Objectives
1. Implement a secure user login system using email or mobile number.
Mailgun / PHPMailer /
For sending OTPs via email
Custom Logic
4. System Architecture
[Client Browser]
↓
[HTML Forms + JS Validation]
↓
[PHP Backend Scripts]
↓
[Database (MySQL)]
5. Database Design
Table: users
Field Name Type Description
Table: otp
Field Name Type Description
6. Functional Modules
6.1 User Login
Features:
Allow login via Email OR Mobile Number
<?php
session_start();
include('db.php');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];
Features:
Collect Basic Info: Name, DOB, Gender
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = $_POST['username'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$dob = $_POST['dob'];
$gender = $_POST['gender'];
$address = $_POST['address'];
Features:
Ask for identity (username/email/phone)
<?php
include('db.php');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$identity = $_POST['identity']; // can be username, email or phone
if ($user) {
$otp = rand(100000, 999999);
$pdo->prepare("INSERT INTO otp (user_id, otp_code, expires_at) VALUE
S (?, ?, NOW() + INTERVAL 5 MINUTE)")
->execute([$user['id'], $otp]);
9. Screenshots (Optional)
(Attach screenshots of registration form, login page, OTP screen, etc.)
10. Conclusion
A fully functional User Authentication System has been developed using PHP
with support for:
Dual-login (email/mobile)
11. References
PHP Manual – https://www.php.net/manual/
Would you like me to generate a downloadable Word (.docx) or PDF file version of
this report? I can help you create it and provide instructions to download it.