Skip to content

choon105/simple-material-dist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Materials Distribution System

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.


Features

  • 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.

Installation

1. Requirements

  • PHP 7.4 or higher
  • MySQL/MariaDB
  • Web server (Apache/Nginx)
  • Composer (not required, but recommended for future extension)

2. Setup

  1. Clone/download the repo

  2. Create the database and tables

    • Import the provided schema.sql:

      mysql -u youruser -p yourdb < schema.sql
  3. Configure database connection

    • Edit config.php and 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');
  4. 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)
  5. 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');
  6. (Optional) Increase upload size for large files

    • Edit your php.ini:

      upload_max_filesize = 200M
      post_max_size = 200M
      max_execution_time = 300
      

Usage

  • 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.
  • Admins:

    1. Go to /admin/login.php and log in.
    2. Use the dashboard to upload new materials, set passwords (share with users), or delete outdated files.

File Structure

/
|-- config.php
|-- index.php
|-- download.php
|-- uploads/           # Uploaded materials live here
|-- admin/
|     |-- login.php
|     |-- dashboard.php
|     |-- upload.php
|     |-- logout.php
|-- schema.sql
|-- README.md

Security & Best Practices

  • 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_errors in production.
  • Back up your uploads and database regularly.

Customization

  • To change accepted file types, edit the $allowed array in admin/upload.php.
  • To further style the interface, edit the <style> sections in each .php file.

License

MIT License — Free for personal, educational, and commercial use.


Credits

Developed by choon105
Inspired by simplicity and user privacy.

About

A very simple material distribution system for avmc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages