Security best practices
A marketplace handles customers' data and money, so security is part of the design.
Built into the script
- Prepared statements for all database queries - protection against SQL injection.
- Hashed passwords (
password_hash) for administrators, owners and customers. - CSRF tokens on forms of the website and the owner panel, and secure session cookies (HttpOnly, SameSite).
- Login throttling - repeated failed logins lock the session for 10 minutes.
- Uploads are accepted only as images, resized and re-encoded with GD, and the upload folders do not execute scripts.
- Sanitised HTML in descriptions and articles that restaurants write.
- Verified payments - the script asks Stripe or PayPal whether a payment succeeded and never trusts the return address; Stripe webhooks are checked with the signing secret.
- Private order links with a long secret token.
- Permissions for administrators by group.
- Card details are entered on the payment provider's pages and never reach your server.
Your checklist
- Use HTTPS on the whole site (free certificates are available from most hosts). Rename
ADMIN/_.htaccessto force HTTPS in the admin panel. - Delete
install.php. - Change the default administrator password and the demo logins.
- Remove the demo restaurants and demo users before going live.
- Set
$DEBUG_MODE=falseinconfig.phpin production so errors are not shown to visitors. - Keep PHP updated and back up the database regularly.
- Use the live Stripe and PayPal keys only on HTTPS and keep test and live keys apart.
Last updated