Uploader
========

Version 1.0.0. Free to use under the Quintaphon Free License: you may change it
for your own sites, but you may not share, resell or redistribute it. Keep the
"Developed by Quintaphon Services" credit visible in the site footer. See LICENSE.txt.
Docs: https://quintaphon.com/docs/scripts/uploader/

A PHP file host. Visitors drop a file and get a short download link. An admin panel manages files, ads, theme color, login protection, and site settings.


Requirements
------------
- PHP 8.2 or newer
- Apache with mod_rewrite
- MySQL or MariaDB
- PHP extensions: mysqli, fileinfo, json, session and dom, plus zip for the built-in updater


Install
-------
1. Upload this folder to your web server (domain root or a subfolder).
2. Create an empty MySQL database, or let setup create one if the database user can do that.
3. Make sure the site folder and the files folder are writable.
4. Turn on HTTPS for the domain (Let's Encrypt or your host SSL). The script requires https:// for a public site.
5. Open /install/ in a browser.
6. Enter the site title, public URL (https:// on a live host), database details, admin path, username, and password.
7. Open the admin URL you chose and sign in.

After setup, the install page is locked. It only opens again for a signed-in admin. You can also delete the install folder; it is not needed again.


Admin
-----
The default admin path is /manage/ until you change it during setup.
Settings has these tabs:
- Site: name, URL, logo, theme color, time zone.
- SEO: titles and descriptions for every page type, short link length, hide from search engines.
- Uploads: file types, max size, upload cap, storage cap, automatic deletion of old files, the public Recent and Popular pages, the uploader location on file pages, blocked words.
- Admin URL: admin path, login captcha, Google sign-in.
- Account: username, password, contact email.
- Ads: ad code and ads.txt.
- Database: optimize or repair the tables.

The uploader location is off by default. When on, each uploader's IP is sent to ip-api.com (plain HTTP, free tier is for non-commercial use).

Forgot password emails the contact address on the Account page. The server must be able to send mail.
Google sign-in only accepts the Google account that matches that contact email.


Update
------
Download the new uploader.zip and open Settings > Update in the admin panel.
Upload the ZIP as it is (do not unzip it). The script backs up its current
files first, replaces only its own files, and keeps your settings, uploads,
logo, ads.txt, custom admin folder and .htaccess rules. If something cannot be
written, the backup is put back automatically. The last 5 backups are listed
on the same page with Restore buttons.


Security notes
--------------
- The install page locks itself after setup. Deleting the install folder is still a good idea.
- Use HTTPS on a live host. HTTP is only allowed on localhost or a local network.
- Use a strong admin password.
- Keep PHP error display off on a live host (this script already does that).
- Do not share the generated settings file from the site folder.
- The files folder is blocked from direct browsing. Downloads go through the short link.
- Behind Cloudflare, the visitor IP is read from CF-Connecting-IP, but only for requests that come from Cloudflare's published IP ranges.
- The script only rewrites the block between "# BEGIN Uploader" and "# END Uploader" in the root .htaccess. Put your own rules outside that block.
- _rebuild_min.php is a developer tool that only runs from the command line (php _rebuild_min.php).


License / credit
----------------
Developed by Quintaphon Services
