/home/u764571690/domains/savitrfoundation.com/public_html/scholar/pages
NameSizeModeActions
cache/-0755rm
css/-0755rm
.htaccess26180644editdlrm
ack.php252830644editdlrm
bank.php190330644editdlrm
daily_quiz.php1073980644editdlrm
dashboard.php272430644editdlrm
distributed.php270430644editdlrm
help.php228580644editdlrm
institute.php169280644editdlrm
invite.php262230644editdlrm
leaderboard.php376840644editdlrm
personal.php154320644editdlrm
status.php302530644editdlrm
tasks.php710750644editdlrm
Edit: /home/u764571690/domains/savitrfoundation.com/public_html/scholar/pages/dashboard.php (27243B)
'/', 'domain' => '', // Empty for localhost compatibility 'secure' => false, // Allow HTTP for localhost 'httponly' => true, 'samesite' => 'Lax', 'lifetime' => 2592000 // 30 days cookie lifetime ]); session_start(); } // Correct path to db.php require_once __DIR__ . '/../db.php'; // ✅ PERFORMANCE: Local cache class for pages/cache directory class LocalSimpleCache extends SimpleCache { private static $cacheDir = __DIR__ . '/cache'; private static $defaultTTL = 300; public static function init() { if (!file_exists(self::$cacheDir)) { @mkdir(self::$cacheDir, 0755, true); } } public static function get($key) { self::init(); $file = self::$cacheDir . '/' . md5($key) . '.cache'; if (!file_exists($file)) return false; $data = @unserialize(file_get_contents($file)); if ($data === false) return false; if (time() > $data['expires']) { @unlink($file); return false; } return $data['value']; } public static function set($key, $value, $ttl = null) { self::init(); $ttl = $ttl ?? self::$defaultTTL; $file = self::$cacheDir . '/' . md5($key) . '.cache'; $data = ['value' => $value, 'expires' => time() + $ttl, 'created' => time()]; $fp = @fopen($file, 'c+'); if ($fp === false) return @file_put_contents($file, serialize($data)) !== false; $lockAcquired = false; for ($i = 0; $i < 10; $i++) { if (flock($fp, LOCK_EX | LOCK_NB)) { $lockAcquired = true; break; } usleep(500000); } if ($lockAcquired) { ftruncate($fp, 0); fwrite($fp, serialize($data)); flock($fp, LOCK_UN); fclose($fp); return true; } else { fclose($fp); return @file_put_contents($file, serialize($data)) !== false; } } public static function delete($key) { self::init(); $file = self::$cacheDir . '/' . md5($key) . '.cache'; return @unlink($file); } } // Check if user is logged in if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true) { header('Location: ../student'); exit(); } $applicantId = (int)($_SESSION['applicant_id'] ?? 0); $userId = $_SESSION['user_id'] ?? ''; $userName = $_SESSION['user_name'] ?? 'Student'; try { // ✅ PERFORMANCE: Cache dashboard data for 2 minutes (frequently accessed) $dashboardCacheKey = 'dashboard_data_' . $applicantId; $dashboardData = LocalSimpleCache::get($dashboardCacheKey); if ($dashboardData === false) { // ✅ OPTIMIZED: Single query to fetch applicant and user data together $stmt = $pdo->prepare(" SELECT a.*, u.user_id, u.bank_verified FROM applicants a LEFT JOIN users u ON a.applicant_id = u.applicant_id WHERE a.applicant_id = ? LIMIT 1 "); $stmt->execute([$applicantId]); $applicant = $stmt->fetch(PDO::FETCH_ASSOC); if (!$applicant) { throw new Exception('Application not found'); } $bankVerified = $applicant['bank_verified'] ?? null; $scholarId = $applicant['user_id'] ?? ($_SESSION['user_id'] ?? ''); // ✅ OPTIMIZED: Fetch documents with limit (only recent ones needed) $docStmt = $pdo->prepare("SELECT * FROM documents WHERE applicant_id = ? ORDER BY uploaded_at DESC LIMIT 10"); $docStmt->execute([$applicantId]); $documents = $docStmt->fetchAll(PDO::FETCH_ASSOC); // Store in cache $dashboardData = [ 'applicant' => $applicant, 'bankVerified' => $bankVerified, 'scholarId' => $scholarId, 'documents' => $documents ]; LocalSimpleCache::set($dashboardCacheKey, $dashboardData, 120); // Cache for 2 minutes } else { $applicant = $dashboardData['applicant']; $bankVerified = $dashboardData['bankVerified']; $scholarId = $dashboardData['scholarId']; $documents = $dashboardData['documents']; } // ✅ OPTIMIZED: Cache announcements for 5 minutes (static data) $cacheKey = 'announcements_active_' . date('Y-m-d-H'); $announcements = LocalSimpleCache::get($cacheKey); if ($announcements === false) { $annStmt = $pdo->query("SELECT id, title, message, created_at FROM announcements WHERE is_active = 1 ORDER BY created_at DESC LIMIT 5"); $announcements = $annStmt->fetchAll(PDO::FETCH_ASSOC); LocalSimpleCache::set($cacheKey, $announcements, 300); // Cache for 5 minutes } // Referral: build referral link and load referred applicants $referralLink = ''; $referredApplicants = []; if (!empty($scholarId)) { $baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; $referralLink = $baseUrl . '/scholarshipapply?ref=' . urlencode($scholarId); try { // ✅ OPTIMIZED: Only fetch essential fields, limit results $refStmt = $pdo->prepare("SELECT applicant_id, application_id, name, status, applied_at FROM applicants WHERE referred_by_user_id = ? ORDER BY applied_at DESC LIMIT 50"); $refStmt->execute([$scholarId]); $referredApplicants = $refStmt->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e) { $referredApplicants = []; } } // Map scholarship scheme to WhatsApp group link via settings table $scheme = strtolower(trim($applicant['scheme_name'] ?? '')); $whatsappGroupLink = ''; $whatsappGroupName = ''; // ✅ OPTIMIZED: Cache settings for 1 hour (rarely changes) $settingsCacheKey = 'settings_all'; $settingsRows = LocalSimpleCache::get($settingsCacheKey); if ($settingsRows === false) { try { $settingsRows = $pdo->query("SELECT `key`, `value` FROM settings")->fetchAll(PDO::FETCH_KEY_PAIR); LocalSimpleCache::set($settingsCacheKey, $settingsRows, 3600); // Cache for 1 hour } catch (Exception $e) { $settingsRows = []; } } if ($scheme !== '') { if (strpos($scheme, 'udaan') !== false) { $whatsappGroupLink = $settingsRows['whatsapp_udaan'] ?? ''; $whatsappGroupName = 'Udaan Scholarship'; } elseif (strpos($scheme, 'samaan') !== false) { $whatsappGroupLink = $settingsRows['whatsapp_samaan'] ?? ''; $whatsappGroupName = 'Samaan Shiksha'; } elseif (strpos($scheme, 'shiksha') !== false || strpos($scheme, 'sahara') !== false) { // Shiksha Sahara: separate groups for boys and girls $gender = strtolower(trim($applicant['gender'] ?? '')); if ($gender === 'male') { $whatsappGroupLink = $settingsRows['whatsapp_shiksha_boys'] ?? ''; $whatsappGroupName = 'Shiksha Sahara (Boys)'; } else { $whatsappGroupLink = $settingsRows['whatsapp_shiksha_girls'] ?? ''; $whatsappGroupName = 'Shiksha Sahara (Girls)'; } } } } catch (Exception $e) { $error_message = $e->getMessage(); } ?> Dashboard - Student Dashboard - Savitr Foundation Scholarship | Savitra Foundation Student Corner
Savitr Foundation
Welcome, Scholar ID:
Logout
 
Scholar ID:
Application Status
Bank Status
your Support
Scholarship Amount
सभी Scholars कृपया अपना पूरा डेटा Cross-Check कर लें। किसी भी तरह की दिक्कत/गलती हो तो अपनी क्वेरी 7772056856 पर व्हाट्सऐप मैसेज करके ठीक करवा लें।

Join Your Scholarship WhatsApp Group

Scheme:
Stay updated with latest announcements and support
Join Group

Announcements

  • : ()
No announcements.