diff --git a/backend/app/Controllers/CurriculumController.php b/backend/app/Controllers/CurriculumController.php
index 52b76b6..a5ccc3e 100644
--- a/backend/app/Controllers/CurriculumController.php
+++ b/backend/app/Controllers/CurriculumController.php
@@ -73,9 +73,10 @@ class CurriculumController
error_reporting(E_ALL);
ob_start();
- // Execute the script logic natively by setting argv
- $argv = ['curriculum_worker.php', $taskId];
- $_SERVER['argv'] = $argv;
+ // CRITICAL: Set $GLOBALS['argv'] so the required worker script can access $argv[1]
+ // (In a web request, $argv is empty — we must set it globally before requiring the worker)
+ $GLOBALS['argv'] = ['curriculum_worker.php', $taskId];
+ $_SERVER['argv'] = $GLOBALS['argv'];
require $scriptPath;
diff --git a/backend/app/Views/StudentPortal.php b/backend/app/Views/StudentPortal.php
index fe01635..15397e3 100644
--- a/backend/app/Views/StudentPortal.php
+++ b/backend/app/Views/StudentPortal.php
@@ -637,7 +637,7 @@ class StudentPortal
-
+
@@ -1119,15 +1119,9 @@ class StudentPortal
document.addEventListener('DOMContentLoaded', async () => {
const token = localStorage.getItem('saqel_student_jwt');
- const cachedUser = localStorage.getItem('saqel_student_user');
if (token) {
- if (cachedUser) {
- try {
- const u = JSON.parse(cachedUser);
- renderDashboard(u);
- } catch (e) {}
- }
+ // Always verify session with server — don't render from cache directly
initWebSocket(token);
await checkStudentSession(token);
}
diff --git a/backend/app/Views/TeacherPortal.php b/backend/app/Views/TeacherPortal.php
index 3e20505..301d984 100644
--- a/backend/app/Views/TeacherPortal.php
+++ b/backend/app/Views/TeacherPortal.php
@@ -391,10 +391,8 @@ class TeacherPortal