A test login system built in 4 hours with vanilla PHP, featuring user registration, login, and file uploads.
Note: This code is a demonstration of my skills and is not perfect.
- PHP: 7.0 or above
- MySQL: 5.7 or above
- PHP Modules:
- php-mysql
- php-pdo
-
Clone the repository:
git clone https://github.com/kimek/playground-vanilla-php-login.git cd playground-vanilla-php-login
-
Set up the database:
- Create a new MySQL database, tables, user:
mysql -u your_username -p < migration/migration.sql
- Create a new MySQL database, tables, user:
-
Configure the application:
- If you would like to use custom DB credentials, update
config.php
.
- If you would like to use custom DB credentials, update
-
Ensure required PHP modules are installed:
- You can check for installed modules using the following command:
php -m
- To install missing modules, use:
sudo apt-get install php-mysql php-pdo
- You can check for installed modules using the following command:
-
Start your local development server:
php -S localhost:8000
-
Access the application:
- Open your web browser and navigate to http://localhost:8000
- User Registration
- User Login
- File Upload
public/index.php
- Main entry point for the application.public/api.php
- Vanilla api script.public/assets/
- Contains stylesheets and JavaScript files.public/uploads/
- File upload folder.config/config.php
- Configuration file for database.migration/migration.sql
- Contains the SQL schema for setting up the database.src/controllers/userSystem.php
- Login and registration handling script.src/inc/file_handling.php
- File upload handling script.src/inc/json_helper.php
- Json helper for api.src/inc/db_connection.php
- DB handling script.src/view/
- Basic page content.
If you wish to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for more information.
For any questions or inquiries, please create contribution issue ticket.