File manager - Edit - /home/webtrixia/appvetta.webtrixia.com/uploads/test-busy.php
Back
<?php define('ROOT', __DIR__); require ROOT.'/config/config.php'; require ROOT.'/src/helpers/Core.php'; require ROOT.'/src/controllers/controllers.php'; Auth::start(); $user = Auth::user(); if (!$user) { echo "Not logged in"; exit; } $cu = DB::row('SELECT * FROM clinic_users WHERE user_id=?', [$user->id]); echo "User: {$user->name} ({$user->role})\n"; echo "Clinic user: " . json_encode($cu) . "\n"; // Simulate toggle-busy POST $_POST['date'] = date('Y-m-d'); $_POST['time'] = '11:30'; $_POST['csrf'] = $_SESSION['csrf'] ?? 'test'; // Check busy_slots table $existing = DB::all('SELECT * FROM busy_slots WHERE clinic_id=?', [$cu->clinic_id ?? 0]); echo "Current busy slots: " . json_encode($existing) . "\n"; // Try insert directly if ($cu) { try { DB::run('INSERT INTO busy_slots (clinic_id, slot_date, slot_time, created_by) VALUES (?,?,?,?)', [$cu->clinic_id, date('Y-m-d'), '11:30', $user->id]); echo "INSERT OK\n"; // Delete it DB::run('DELETE FROM busy_slots WHERE clinic_id=? AND slot_date=? AND slot_time=?', [$cu->clinic_id, date('Y-m-d'), '11:30']); echo "DELETE OK\n"; } catch (Exception $e) { echo "DB ERROR: " . $e->getMessage() . "\n"; } }
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings