mirror of
https://github.com/myronblair/parkerslingshotrentals
synced 2026-07-27 16:42:32 -05:00
Fix security issues from code review: remove plaintext password comment, enable TLS verification, harden booking ref entropy, fix XSS/injection in signature emails, fix broken waiver link, consolidate duplicated auth/file-serving logic, add missing document view links, sync schema.sql with live DB
This commit is contained in:
+3
-5
@@ -23,15 +23,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $booking && !$error) {
|
||||
if (!$file || $file['error'] !== UPLOAD_ERR_OK) {
|
||||
$error = 'Upload failed — please try again or check file size.';
|
||||
} else {
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
$mime = $finfo->file($file['tmp_name']);
|
||||
$allowed = ['image/jpeg','image/png','application/pdf'];
|
||||
if (!in_array($mime, $allowed)) {
|
||||
$mime = detectAllowedMime($file['tmp_name']);
|
||||
if (!$mime) {
|
||||
$error = 'Only JPG, PNG, or PDF files are accepted.';
|
||||
} elseif ($file['size'] > 10 * 1024 * 1024) {
|
||||
$error = 'File must be under 10 MB.';
|
||||
} else {
|
||||
$ext = ['image/jpeg'=>'jpg','image/png'=>'png','application/pdf'=>'pdf'][$mime];
|
||||
$ext = ALLOWED_DOC_MIMES[$mime];
|
||||
$dir = __DIR__ . '/uploads/' . $ref;
|
||||
if (!is_dir($dir)) mkdir($dir, 0750, true);
|
||||
$fname = $type . '_' . date('YmdHis') . '.' . $ext;
|
||||
|
||||
Reference in New Issue
Block a user