A simple, secure PHP+MySQL web application for distributing digital learning materials (PDFs, docs, multimedia, etc.) to users. Each material is protected by its own password; no user registration required. Admins can upload, manage, and delete materials via a dedicated dashboard.
- No user registration: Anyone with a file’s password can download it.
- Per-file password protection: Each material is protected by its own password.
- Supported file types: PDF, TXT, DOC, DOCX, MD, HTML, MP3, MP4.
- Admin dashboard: Secure login for admins to upload new materials, set/download passwords, and delete files.
- Clean, responsive UI: Modern look for both users and admins.
- Security best practices: Passwords hashed, prepared statements, upload validation.
- PHP 7.4 or higher
- MySQL/MariaDB
- Web server (Apache/Nginx)
- Composer (not required, but recommended for future extension)
-
Clone/download the repo
-
Create the database and tables
-
Import the provided
schema.sql:mysql -u youruser -p yourdb < schema.sql
-
-
Configure database connection
-
Edit
config.phpand update these lines as needed:define('DB_HOST', 'localhost'); define('DB_NAME', 'your_database'); define('DB_USER', 'your_db_user'); define('DB_PASS', 'your_db_password');
-
-
Set folder permissions
-
The
uploads/directory should exist and be writable by the web server.mkdir uploads chmod 755 uploads # If you have permission issues, try chmod 777 uploads (not recommended for production)
-
-
Create your first admin user
-
Generate a password hash:
<?php echo password_hash('yourpassword', PASSWORD_DEFAULT); ?>
-
Insert into the database:
INSERT INTO admins (username, password_hash) VALUES ('admin', 'paste-the-hash-here');
-
-
(Optional) Increase upload size for large files
-
Edit your
php.ini:upload_max_filesize = 200M post_max_size = 200M max_execution_time = 300
-
-
Public users:
- Visit the main page (
index.php) to see the list of available learning materials. - Click "Download" for a material and enter the password provided by the admin/teacher to receive the file.
- Visit the main page (
-
Admins:
- Go to
/admin/login.phpand log in. - Use the dashboard to upload new materials, set passwords (share with users), or delete outdated files.
- Go to
/
|-- config.php
|-- index.php
|-- download.php
|-- uploads/ # Uploaded materials live here
|-- admin/
| |-- login.php
| |-- dashboard.php
| |-- upload.php
| |-- logout.php
|-- schema.sql
|-- README.md
- Passwords are hashed. Never store or share them in plain text.
- Uploads are validated. Only allowed file types are accepted.
- No user data is stored. Only admin and file info.
- Keep your PHP up to date and disable
display_errorsin production. - Back up your uploads and database regularly.
- To change accepted file types, edit the
$allowedarray inadmin/upload.php. - To further style the interface, edit the
<style>sections in each.phpfile.
MIT License — Free for personal, educational, and commercial use.
Developed by choon105
Inspired by simplicity and user privacy.