=========================================================================
 POLICY.FIT — SETUP GUIDE
=========================================================================
This is a complete PHP + MySQL website, ready to upload to any standard
cPanel shared hosting account. Follow the steps in order.

-------------------------------------------------------------------------
STEP 1 — Create the database in cPanel
-------------------------------------------------------------------------
1. Log in to cPanel.
2. Open "MySQL Databases".
3. Under "Create New Database", type a name (e.g. policyfit) and click
   Create Database. cPanel will show the full name, something like
   yourcpaneluser_policyfit — write this down.
4. Under "MySQL Users" > "Add New User", create a username and a strong
   password. Write both down.
5. Under "Add User To Database", choose the user and database you just
   created, click Add, then tick "ALL PRIVILEGES" and click
   "Make Changes".

You should now have three values noted down: the full database name, the
full database username, and the password.

-------------------------------------------------------------------------
STEP 2 — Edit config.php
-------------------------------------------------------------------------
Open config.php in any text editor and fill in the four values from
Step 1:

    define('DB_HOST', 'localhost');
    define('DB_NAME', 'yourcpaneluser_policyfit');
    define('DB_USER', 'yourcpaneluser_dbuser');
    define('DB_PASS', 'your_database_password');

DB_HOST is almost always "localhost" on cPanel — leave it as-is unless
your host told you otherwise. Nothing else in this file needs editing;
the site automatically detects its own domain.

-------------------------------------------------------------------------
STEP 3 — Upload the files
-------------------------------------------------------------------------
1. In cPanel, open "File Manager" and go into public_html (or the
   subfolder for your domain, if it's an addon domain).
2. Upload the provided .zip file, then right-click it and choose
   "Extract". Delete the .zip afterwards if you like.
   (Alternative: upload every file with an FTP client such as FileZilla,
   keeping the same folder structure — the assets folder must stay a
   subfolder.)
3. When done, public_html should directly contain: index.php,
   adminji.php, config.php, db.php, helpers.php, schema.sql, .htaccess,
   robots.txt, and an assets folder with style.css, site.js, admin.js.

-------------------------------------------------------------------------
STEP 4 — Import the database
-------------------------------------------------------------------------
1. In cPanel, open "phpMyAdmin".
2. Click on your database name in the left sidebar.
3. Click the "Import" tab.
4. Click "Choose File" and select schema.sql.
5. Click "Go" at the bottom.

You should see a success message and 7 new tables in the sidebar.

-------------------------------------------------------------------------
STEP 5 — Visit the site
-------------------------------------------------------------------------
Open your domain in a browser. You should see the Policy.fit homepage
with starter banners, tools and games already filled in.

If instead you see a short "Almost there…" message, it means either
config.php still has the placeholder database details, or schema.sql
hasn't been imported yet — double check Steps 2 and 4.

-------------------------------------------------------------------------
STEP 6 — Log in to the admin panel
-------------------------------------------------------------------------
Go to:  https://yourdomain.com/adminji

  Username: admin
  Password: admin123

There is no visible link to this page anywhere on the public site by
design — it only opens when this exact address is typed. As a backup
shortcut, tapping the "© Policy.fit" footer text 5 times quickly also
opens it.

IMPORTANT — the very first thing to do after logging in is open the
Settings tab and change the admin password to something private, using
the "Change admin password" form.

From the admin panel you can:
  - Banners tab: add/edit/delete/reorder the auto-swiping top banners.
  - Sections tab: add unlimited sections, and inside each one, add
    unlimited categories (tools/games/policies). Each category has an
    icon (emoji or an image URL), a title, an optional link, and a
    hidden description that is invisible on the page but present in the
    page's HTML for search engines (SEO).
  - Users tab: see everyone who has signed up on the public site, and
    remove accounts if needed.
  - Settings tab: change the site title/tagline, turn banner auto-swipe
    on or off and set its speed, and change the admin password.

-------------------------------------------------------------------------
HOW THINGS WORK (good to know)
-------------------------------------------------------------------------
- All content (sections, categories, banners, settings) lives in the
  database and is edited entirely from the admin panel — no code
  editing needed for day-to-day updates.
- Passwords (both the admin password and every visitor's password) are
  stored as one-way secure hashes, never as plain text.
- The admin panel and visitor login are protected against repeated
  wrong-password attempts: after 5 failed tries from the same device,
  further attempts are blocked for 15 minutes.
- robots.txt and a "noindex" tag keep /adminji out of Google.

-------------------------------------------------------------------------
GOING LIVE WITH HTTPS
-------------------------------------------------------------------------
Most cPanel hosts issue a free SSL certificate automatically within a
few minutes to a few hours of the domain pointing to them (look for
"SSL/TLS Status" or "AutoSSL" in cPanel). Once you see the padlock icon
working on your domain, open .htaccess, find the two lines under
"Force HTTPS" and remove the # from the start of each line. This makes
the site always redirect to the secure https:// version.

-------------------------------------------------------------------------
TROUBLESHOOTING
-------------------------------------------------------------------------
Blank white page
  Almost always a database connection problem. Re-check the four DB_
  values in config.php character-by-character against cPanel's "MySQL
  Databases" page.

"Almost there…" message
  The database connected, but schema.sql hasn't been imported yet (or
  was only partially imported). Repeat Step 4.

Admin login says "Incorrect username or password"
  Make sure you're using admin / admin123 if this is your first login.
  If you already changed the password and forgot it, open phpMyAdmin,
  open the `admins` table, edit the row, and set the password_hash
  column's value to exactly: PENDING_SETUP — then reload the admin
  login page once (this resets it back to admin123 automatically) and
  log in again.

Images not showing for a banner or category
  Check the image URL opens correctly in a new browser tab by itself —
  it must be a direct link to an image file (ending in .jpg/.png/etc),
  not a link to a webpage that merely contains the image.

Need to see the exact PHP error while testing
  In config.php, temporarily set APP_DEBUG to true, reload the page to
  see the error, then set it back to false. Never leave this on for
  visitors — it can reveal technical details about your server.
