/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/distributed.php (27043B)
'/', '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'; 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 { // ✅ 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'] ?? ''); // ✅ 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); } } // ✅ OPTIMIZED: Cache distributed scholars list for 5 minutes (rarely changes) $distCacheKey = 'distributed_scholars_all'; $distributedScholars = LocalSimpleCache::get($distCacheKey); if ($distributedScholars === false) { // Get all distributed scholars with their details $distStmt = $pdo->query(" SELECT a.name, a.applicant_id, u.user_id, a.scheme_name, a.payment_status, a.scholarship_amount, COALESCE(ref.ref_count, 0) AS ref_count FROM applicants a JOIN users u ON a.applicant_id = u.applicant_id LEFT JOIN ( SELECT referred_by_user_id, COUNT(*) AS ref_count FROM applicants WHERE referred_by_user_id IS NOT NULL AND referred_by_user_id <> '' GROUP BY referred_by_user_id ) ref ON ref.referred_by_user_id = u.user_id WHERE a.payment_status = 'Distributed' ORDER BY a.name ASC LIMIT 1000 "); $distributedScholars = $distStmt->fetchAll(PDO::FETCH_ASSOC); LocalSimpleCache::set($distCacheKey, $distributedScholars, 300); // Cache for 5 minutes } // ✅ OPTIMIZED: Cache partially distributed scholars $partialCacheKey = 'partial_distributed_scholars'; $partialDistributedScholars = LocalSimpleCache::get($partialCacheKey); if ($partialDistributedScholars === false) { // Get partially distributed scholars (those with at least one completed step but not fully distributed) $partialStmt = $pdo->query(" SELECT a.name, a.applicant_id, u.user_id, a.scheme_name, a.payment_status, a.payment_step1_status, a.payment_step2_status, a.payment_step3_status, a.payment_step1_amount, a.payment_step2_amount, a.payment_step3_amount, COALESCE(ref.ref_count, 0) AS ref_count FROM applicants a JOIN users u ON a.applicant_id = u.applicant_id LEFT JOIN ( SELECT referred_by_user_id, COUNT(*) AS ref_count FROM applicants WHERE referred_by_user_id IS NOT NULL AND referred_by_user_id <> '' GROUP BY referred_by_user_id ) ref ON ref.referred_by_user_id = u.user_id WHERE (a.payment_step1_status = 'Completed' OR a.payment_step2_status = 'Completed' OR a.payment_step3_status = 'Completed') AND a.payment_status != 'Distributed' ORDER BY a.name ASC LIMIT 500 "); $partialDistributedScholars = $partialStmt->fetchAll(PDO::FETCH_ASSOC); LocalSimpleCache::set($partialCacheKey, $partialDistributedScholars, 300); // Cache for 5 minutes } // Variable already set in cache block above } catch (Exception $e) { $error_message = $e->getMessage(); } ?> Total Scholarship Distribution - Student Dashboard - Savitr Foundation Scholarship
Savitr Foundation
Welcome, Scholar ID:
 

Total Scholarship Distribution

No scholarships distributed yet.

Fully Distributed Scholarships

Name Scholar ID Scheme Amount Student Support
       ₹   students

Partially Distributed Scholarships

Name Scholar ID Scheme Completed Steps Amount Distributed Student Support
       /3  ₹   students