328 Vue

Scratch-Card Result Checker — PHP/MySQL Complete Source

Quick description / usage notes

  1. Install & database

    • Create the MySQL database and tables by running the SQL in sql/init.sql (e.g., in phpMyAdmin or mysql -u root -p < sql/init.sql).

    • Update DB credentials in db.php if your MySQL user/password are different.

  2. Files of interest

    • index.php — public result-check page (students enter registration number + scratch PIN).

    • check_result.php — validates the PIN, marks it used, and displays the student's results.

    • admin/login.php & admin/dashboard.php — simple admin area to add students, add results, and generate scratch cards.

    • sql/init.sql — SQL to create the database and insert sample data and a sample scratch PIN (SAMPLEPIN1234).

    • config.php — contains a simple admin username/password (admin/admin123) used by the demo admin login. Change this for production.

    • assets/style.css, assets/script.js — styling and minimal client-side checks.

  3. How it works (workflow)

    • Admin: log in at admin/login.php, add student records and their results, then generate scratch cards. Scratch card PINs are stored in the scratch_cards table, initially unused.

    • admin username and password: 
      username: admin
      password: admin123
    • Student: go to index.php, enter registration number and one scratch card PIN. If valid and unused, the server marks the PIN used and shows the student’s results (subjects, scores, total, average).

    • Security notes: This is a simple educational demo. For real deployments:

      • Hash and store admin passwords securely (use password_hash).

      • Protect admin endpoints with stronger auth and CSRF tokens.

      • Rate-limit public result checks to prevent brute force.

      • Use HTTPS and secure database credentials (not hard-coded).

  4. Quick sample data

    • Two students added in sql/init.sql (REG2025/001 and REG2025/002) with sample results.

    • Sample PIN: SAMPLEPIN1234 (unused) — try it on index.php with REG2025/001.

If you'd like, I can:

  • Add email delivery for cards, printable card templates, or printable PDF export of generated pins.

  • Replace the simple admin auth with a secure user table and password hashing.

  • Add pagination and CSV export for cards or student lists.

Tell me which enhancements you want in comment section and I’ll update the code.

Download file here...

Mise Ă  niveau vers Pro
Choisissez le forfait qui vous convient
Lire la suite
Flowisetech Salut , For easy access