redirectToLogin('Session expired. Please log in again.'); } // Calculate user age $userAge = null; if ($user['date_of_birth']) { $birthDate = new DateTime($user['date_of_birth']); $today = new DateTime(); $userAge = $today->diff($birthDate)->y; } // Format join date $joinDateFormatted = date('F j, Y', strtotime($user['created_at'])); // Initialize database try { $db = new Database(); $pdo = $db->getConnection(); } catch (Exception $e) { logError('Database connection failed in dashboard.php: ' . $e->getMessage()); die('System error. Please try again later.'); } // Check and award onboarding points (only once) if ($user['email_verified'] && !$user['onboarding_completed'] && !$user['onboarding_points_awarded']) { try { // Double-check to prevent race conditions $stmt = $pdo->prepare("SELECT onboarding_points_awarded FROM users WHERE id = ? AND onboarding_points_awarded = 0"); $stmt->execute([$user['id']]); $canAward = $stmt->fetch(); if ($canAward) { $pdo->beginTransaction(); // Award onboarding points $stmt = $pdo->prepare("INSERT INTO user_points (user_id, points, total_earned) VALUES (?, 10.00, 10.00) ON DUPLICATE KEY UPDATE points = points + 10.00, total_earned = total_earned + 10.00"); $stmt->execute([$user['id']]); // Add transaction record $stmt = $pdo->prepare("INSERT INTO point_transactions (user_id, transaction_type, points, source, description) VALUES (?, 'earned', 10.00, 'onboarding', 'Welcome bonus for email verification and first login')"); $stmt->execute([$user['id']]); // Mark onboarding as completed and points as awarded $stmt = $pdo->prepare("UPDATE users SET onboarding_completed = 1, onboarding_points_awarded = 1 WHERE id = ?"); $stmt->execute([$user['id']]); $pdo->commit(); logError('Onboarding points awarded', ['user_id' => $user['id'], 'points' => 10]); // Refresh user data to reflect changes $user = getCurrentUser(); } } catch (Exception $e) { $pdo->rollback(); logError('Error awarding onboarding points', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } } // Get user points $userPoints = ['points' => 0, 'total_earned' => 0, 'total_redeemed' => 0]; try { $stmt = $pdo->prepare("SELECT points, total_earned, total_redeemed FROM user_points WHERE user_id = ?"); $stmt->execute([$user['id']]); $pointsData = $stmt->fetch(); if ($pointsData) { $userPoints = $pointsData; } } catch (Exception $e) { logError('Error fetching user points', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } // Get profiler completion status $profilerSections = [ 'personal_background' => 'Personal Background', 'household_family' => 'Household & Family', 'shopping_lifestyle' => 'Shopping & Lifestyle', 'technology_digital' => 'Technology & Digital', 'travel_transportation' => 'Travel & Transportation', 'health_fitness' => 'Health & Fitness', 'entertainment_media' => 'Entertainment & Media', 'food_dining' => 'Food & Dining', 'financial_services' => 'Financial Services', 'communication_payments' => 'Communication & Payments' ]; $profilerCompletion = []; try { $stmt = $pdo->prepare("SELECT section, completion_percentage, is_completed, points_awarded FROM profiler_completion WHERE user_id = ?"); $stmt->execute([$user['id']]); while ($row = $stmt->fetch()) { $profilerCompletion[$row['section']] = $row; } } catch (Exception $e) { logError('Error fetching profiler completion', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } // Get mobile verification status $mobileVerified = false; $mobileNumber = ''; try { $stmt = $pdo->prepare("SELECT mobile_number, is_verified FROM mobile_verifications WHERE user_id = ?"); $stmt->execute([$user['id']]); $mobileData = $stmt->fetch(); if ($mobileData) { $mobileVerified = $mobileData['is_verified']; $mobileNumber = $mobileData['mobile_number']; } } catch (Exception $e) { logError('Error fetching mobile verification', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } // Get user's support tickets for the support section $userTickets = []; try { $stmt = $pdo->prepare(" SELECT st.*, (SELECT COUNT(*) FROM support_messages sm WHERE sm.ticket_id = st.id) as message_count, (SELECT sm.created_at FROM support_messages sm WHERE sm.ticket_id = st.id ORDER BY sm.created_at DESC LIMIT 1) as last_reply FROM support_tickets st WHERE st.user_id = ? ORDER BY st.created_at DESC LIMIT 10 "); $stmt->execute([$user['id']]); $userTickets = $stmt->fetchAll(); } catch (Exception $e) { logError('Error fetching user tickets', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } // Get recent point transactions $recentTransactions = []; try { $stmt = $pdo->prepare(" SELECT transaction_type, points, source, description, created_at, status FROM point_transactions WHERE user_id = ? ORDER BY created_at DESC LIMIT 20 "); $stmt->execute([$user['id']]); $recentTransactions = $stmt->fetchAll(); } catch (Exception $e) { logError('Error fetching transactions', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } // Get redemption requests $redemptionRequests = []; try { $stmt = $pdo->prepare(" SELECT request_id, points_redeemed, amount_inr, upi_id, status, created_at, processed_at FROM redemption_requests WHERE user_id = ? ORDER BY created_at DESC "); $stmt->execute([$user['id']]); $redemptionRequests = $stmt->fetchAll(); } catch (Exception $e) { logError('Error fetching redemption requests', ['user_id' => $user['id'], 'error' => $e->getMessage()]); } ?> Dashboard - Relevant Reflex

Welcome to Your Survey Dashboard!

Complete your profile, earn points, and participate in paid surveys from trusted research companies.

Available Points

Value

0

Available Surveys

Complete your profile to unlock

$name) { if (isset($profilerCompletion[$key]) && $profilerCompletion[$key]['is_completed']) { $completedSections++; } } echo round(($completedSections / count($profilerSections)) * 100); ?>%

Profile Complete

/ sections

Total Earned

Since

Quick Actions

Complete Your Profile

Earn up to 70 points by completing all profile sections

Redeem Rewards

Convert your points to cash rewards via UPI

Need Help?

Get support for any questions or issues

Available Surveys

Complete Your Profile First!

To receive targeted survey invitations, please complete all sections in the "Know Me Better" profiler. This helps us match you with relevant surveys that fit your demographics and interests.

Current Progress: / sections completed

Know Me Better Complete All Sections to Earn 60 Points!

Help us understand you better to send more relevant survey opportunities. Each completed section earns you 5 points!

Mobile Verification

Your mobile number is verified! Verify your mobile number to receive survey notifications and earn 10 points.

We'll send you an OTP to verify your number.
10 Points Earned!
$sectionName): $completion = isset($profilerCompletion[$sectionKey]) ? $profilerCompletion[$sectionKey] : null; $isCompleted = $completion && $completion['is_completed']; $percentage = $completion ? $completion['completion_percentage'] : 0; $pointsAwarded = $completion && $completion['points_awarded']; ?>
%
Completed on 0): ?> % completed Not started
5 Points

Rewards & Points

Available Points

Current Value

Total Earned

Lifetime Earnings

Total Redeemed

Total Withdrawn
Redeem Points
= 200): ?>

You can redeem your points for cash via UPI transfer. Minimum redemption: 200 points (₹100)

Minimum Redemption Required

You need at least 200 points (₹100) to redeem. You currently have points.

Need more points to redeem.

Recent Transactions

No transactions yet. Complete your profile sections to start earning points!

+ Points - Points

Source:

Redemption History

No redemptions yet.

( points)

UPI:

Profile Information

Basic Information

Email:

Gender:

Date of Birth:

Age: years

Postcode:

Member Since:

Basic profile information cannot be changed after registration for security reasons.

Survey Panel Member

Verified

Support Center

Create Ticket

Get help with account, points, or technical issues

Create New Ticket
How It Works

Learn about our survey panel and earning process

View Guide
Contact Us

Direct email support for urgent matters

Contact Form
Your Recent Support Tickets

You haven't created any support tickets yet. If you need help, click "Create New Ticket" above.

Created: | Last Reply:

messages