This project is an OTP (One-Time Password) System built with PHP and MySQL. It allows users to request an OTP for actions such as login, registration, or verification. The OTP is sent via email or SMS (depending on the implementation), ensuring secure and validated actions.
- π§ OTP Generation: Generates a unique OTP and sends it to the userβs registered email address.
- π OTP Validation: Validates the OTP entered by the user against the generated one.
- π Expiry Time: OTPs have a set expiry time for added security.
- π‘οΈ Secure Authentication: Ensures the authenticity of user actions (login, registration) using OTP.
- π Database Integration: MySQL stores OTPs and tracks their expiry time for validation.
- π₯οΈ User Interface: A simple and user-friendly interface to request and verify OTPs.
Before running this project, ensure you have the following installed:
- PHP (>=7.4) π₯οΈ
- MySQL ποΈ
- A web server (e.g., Apache or Nginx) π
- A database client (e.g., phpMyAdmin, MySQL Workbench, or command-line client) π§
- Mail server configuration for sending OTP emails (can use SMTP, PHPMailer, etc.)
-
Clone the Repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name -
Set Up the Database:
-
Open your MySQL client.
-
Create a new database:
CREATE DATABASE otp_system;
-
Import the provided
database.sqlfile:mysql -u username -p otp_system < database.sql
-
-
Configure the Project:
-
Open the
config.phpfile. -
Update the database connection details:
define('DB_HOST', 'localhost'); define('DB_USER', 'your_database_username'); define('DB_PASS', 'your_database_password'); define('DB_NAME', 'otp_system');
-
Set up your SMTP settings (for sending emails) in
mailer.phpor similar file.
-
-
Run the Project:
- Place the project files in your web server's root directory (e.g.,
htdocsfor XAMPP). - Start your web server and navigate to
http://localhost/your-repo-name.
- Place the project files in your web server's root directory (e.g.,
/your-repo-name
βββ config.php # Database configuration
βββ otp-request.php # OTP request form
βββ otp-validate.php # OTP validation script
βββ database.sql # Database schema
βββ mailer.php # Email sending functionality
βββ README.md # Project documentation
This project is licensed under the MIT License. Feel free to use and modify it as per your needs. π οΈ
Contributions are welcome! Feel free to submit issues or pull requests for improvements or bug fixes. π‘

