mirror of
https://github.com/myronblair/parkerslingshotrentals
synced 2026-06-30 17:50:31 -05:00
b3b831e4a0
Admin portal overhaul:
- Fix require_once path (was admin/db.php, should be ../db.php) — this was
the root cause of the login always redirecting back to the login page
- Fix session save path to /home/parkerslingshotrentals.com/sessions so the
web user (parke1909) can actually read sessions back (the system default
/var/lib/php/sessions was write-only for non-root)
- Fix AJAX unauthenticated response: return 401 JSON instead of login HTML
- Fresh bcrypt hash for admin password (Parker2026!)
- Add 3 new DB columns: insurance_verified, deposit_received, license_verified
- Replace flat bookings table with expandable per-customer flow panel:
click any row to open a 3-column detail drawer showing:
(1) full contact info + admin notes
(2) 6-step booking flow checklist with inline toggle buttons for steps
that admin marks (insurance, deposit, license)
(3) send-reminder email builder — pick which pending items to include,
send customer a personalized nudge with waiver link + instructions
- Progress dots in table row update live when admin toggles a step
- Stats row now includes waiver, insurance, deposit counts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
2.3 KiB
PHP
57 lines
2.3 KiB
PHP
<?php
|
|
define('PARKER_DB_HOST', 'localhost');
|
|
define('PARKER_DB_NAME', 'parker_db');
|
|
define('PARKER_DB_USER', 'parker_user');
|
|
define('PARKER_DB_PASS', 'Pk4rk3r_2026!Tx');
|
|
|
|
define('ADMIN_USER', 'admin');
|
|
define('ADMIN_PASS', '$2y$10$ynnk3RfarOD7VIJizC30kuXqu6tQ3gotNrlp5y33afh5fPOgnAMU6'); // Parker2026!
|
|
define('ADMIN_SESSION_KEY', 'parker_admin_auth');
|
|
|
|
define('SENDGRID_API_KEY', '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');
|
|
define('MAIL_FROM', 'noreply@parkerslingshotrentals.com');
|
|
define('MAIL_FROM_NAME', 'Parker County Slingshot Rentals');
|
|
define('ADMIN_EMAIL', 'info@parkerslingshotrentals.com');
|
|
|
|
define('PACKAGES', [
|
|
'half-day' => ['label' => 'Half Day (4 hrs)', 'amount' => 99.00, 'days' => 0],
|
|
'full-day' => ['label' => 'Full Day (8 hrs)', 'amount' => 169.00, 'days' => 0],
|
|
'weekend' => ['label' => 'Weekend (48 hrs)', 'amount' => 299.00, 'days' => 1],
|
|
]);
|
|
|
|
function db(): PDO {
|
|
static $pdo;
|
|
if (!$pdo) {
|
|
$pdo = new PDO(
|
|
'mysql:host=' . PARKER_DB_HOST . ';dbname=' . PARKER_DB_NAME . ';charset=utf8mb4',
|
|
PARKER_DB_USER, PARKER_DB_PASS,
|
|
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]
|
|
);
|
|
}
|
|
return $pdo;
|
|
}
|
|
|
|
function generateRef(): string {
|
|
return 'PSR-' . strtoupper(substr(uniqid(), -6));
|
|
}
|
|
|
|
function sendEmail(string $to, string $toName, string $subject, string $html): bool {
|
|
if (!SENDGRID_API_KEY || strpos(SENDGRID_API_KEY, 'YOUR_KEY') !== false) return false;
|
|
$payload = json_encode([
|
|
'personalizations' => [['to' => [['email' => $to, 'name' => $toName]]]],
|
|
'from' => ['email' => MAIL_FROM, 'name' => MAIL_FROM_NAME],
|
|
'subject' => $subject,
|
|
'content' => [['type' => 'text/html', 'value' => $html]],
|
|
]);
|
|
$ch = curl_init('https://api.sendgrid.com/v3/mail/send');
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => $payload,
|
|
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . SENDGRID_API_KEY, 'Content-Type: application/json'],
|
|
CURLOPT_TIMEOUT => 15, CURLOPT_SSL_VERIFYPEER => false,
|
|
]);
|
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_exec($ch); curl_close($ch);
|
|
return $code === 202;
|
|
}
|