redirectToLogin('Session expired. Please log in again.'); } $userId = $user['id']; $memberRef = 'RR' . str_pad($userId, 7, '0', STR_PAD_LEFT); $refLink = 'https://relevantreflex.com/signup.php?mref=' . $memberRef; try { $db = new Database(); $pdo = $db->getConnection(); } catch (Exception $e) { die('System error.'); } // Points balance $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([$userId]); $p = $stmt->fetch(); if ($p) $userPoints = $p; } catch (Exception $e) {} // Referral stats & history $stats = ['total_clicks' => 0, 'total_signups' => 0, 'total_verified' => 0, 'total_earned' => 0]; $referrals = []; $paidAmounts = []; // referee_user_id => actual ₹ paid (from point_transactions) try { // Counts + survey commission (unchanged source columns) $s = $pdo->prepare(" SELECT COUNT(*) AS total_clicks, COALESCE(SUM(signup_completed), 0) AS total_signups, COALESCE(SUM(email_verified), 0) AS total_verified, COALESCE(SUM(survey_commission_earned), 0) AS survey_commission FROM member_referral_clicks WHERE referrer_user_id = ? "); $s->execute([$userId]); $row = $s->fetch(); $surveyCommission = 0; if ($row) { $stats['total_clicks'] = (int)$row['total_clicks']; $stats['total_signups'] = (int)$row['total_signups']; $stats['total_verified'] = (int)$row['total_verified']; $surveyCommission = (float)$row['survey_commission']; } // Actual signup-reward earnings from point_transactions (tier-accurate; covers default ₹5 + any tier amounts) $rs = $pdo->prepare(" SELECT COALESCE(SUM(points), 0) / 2 AS rupees FROM point_transactions WHERE user_id = ? AND source = 'member_referral' AND transaction_type = 'earned' "); $rs->execute([$userId]); $signupRewardRupees = (float)$rs->fetchColumn(); $stats['total_earned'] = round($signupRewardRupees + $surveyCommission, 2); // Per-row paid amount lookup (used to render correct "₹X Paid" badge per referral) $pa = $pdo->prepare(" SELECT reference_id, points FROM point_transactions WHERE user_id = ? AND source = 'member_referral' AND transaction_type = 'earned' "); $pa->execute([$userId]); while ($r = $pa->fetch()) { if (!empty($r['reference_id'])) { $paidAmounts[(int)$r['reference_id']] = (float)$r['points'] / 2; } } $h = $pdo->prepare(" SELECT id, ip_address, email, signup_completed, email_verified, signup_reward_paid, survey_commission_earned, clicked_at, signed_up_at, verified_at, referee_user_id FROM member_referral_clicks WHERE referrer_user_id = ? ORDER BY clicked_at DESC LIMIT 100 "); $h->execute([$userId]); $referrals = $h->fetchAll(); } catch (Exception $e) {} // ─── Tier config for this member (referrer) ─── // If admin has enabled tier-based bonus, "How It Works" + a banner reflect the actual amounts. $tierCfg = null; $tierEnabled = false; try { $tStmt = $pdo->prepare(" SELECT enabled, tier_2_amount, tier_3_amount, tier_4_amount, tier_5_amount FROM member_referral_tiers WHERE user_id = ? "); $tStmt->execute([$userId]); $tRow = $tStmt->fetch(); if ($tRow && (int)$tRow['enabled'] === 1) { $tierEnabled = true; $tierCfg = $tRow; } } catch (Exception $e) { /* table may not exist yet — flat ₹5 applies */ } // Determine which tier the NEXT verified referral will fall in (for the "How It Works" reward line) $nextRefIdx = $stats['total_verified'] + 1; $currentTierAmt = 5.00; $currentTierLabel = 'Tier 1 (1–100)'; if ($tierEnabled) { if ($nextRefIdx <= 100) { $currentTierAmt = 5.00; $currentTierLabel = 'Tier 1 (1–100, fixed)'; } elseif ($nextRefIdx <= 500) { $currentTierAmt = (float)$tierCfg['tier_2_amount']; $currentTierLabel = 'Tier 2 (101–500)'; } elseif ($nextRefIdx <= 1000) { $currentTierAmt = (float)$tierCfg['tier_3_amount']; $currentTierLabel = 'Tier 3 (501–1000)'; } elseif ($nextRefIdx <= 5000) { $currentTierAmt = (float)$tierCfg['tier_4_amount']; $currentTierLabel = 'Tier 4 (1001–5000)'; } else { $currentTierAmt = (float)$tierCfg['tier_5_amount']; $currentTierLabel = 'Tier 5 (5001+)'; } } $currentTierPts = (int)round($currentTierAmt * 2); // Format helper: drop ".00" if whole rupees $fmtRs = function ($v) { return ((float)$v == floor((float)$v)) ? number_format((float)$v, 0) : number_format((float)$v, 2); }; // Referral reward transactions $rewardHistory = []; try { $stmt = $pdo->prepare(" SELECT transaction_type, points, source, description, created_at FROM point_transactions WHERE user_id = ? AND source IN ('member_referral', 'member_referral_survey') ORDER BY created_at DESC LIMIT 50 "); $stmt->execute([$userId]); $rewardHistory = $stmt->fetchAll(); } catch (Exception $e) {} // Sidebar data $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','household_classification'=>'Household Classification (ISEC)']; $profilerCompletion = []; try { $stmt = $pdo->prepare("SELECT section, is_completed FROM profiler_completion WHERE user_id = ?"); $stmt->execute([$userId]); while ($r = $stmt->fetch()) $profilerCompletion[$r['section']] = $r; } catch (Exception $e) {} $completedSections = count(array_filter($profilerCompletion, fn($r) => $r['is_completed'])); $firstName = htmlspecialchars($user['first_name'] ?? explode('@', $user['email'])[0]); $initials = strtoupper(substr($user['first_name'] ?? $user['email'], 0, 1) . substr($user['last_name'] ?? '', 0, 1)); if (strlen($initials) < 2) $initials = strtoupper(substr($user['email'], 0, 2)); function maskEmail($email) { if (empty($email)) return '—'; $parts = explode('@', $email); if (count($parts) !== 2) return '—'; $name = $parts[0]; $domain = $parts[1]; $masked = substr($name, 0, 1) . str_repeat('*', max(1, strlen($name) - 1)); $dparts = explode('.', $domain); $maskedDomain = substr($dparts[0], 0, 1) . str_repeat('*', max(1, strlen($dparts[0]) - 1)); return $masked . '@' . $maskedDomain . '.' . ($dparts[1] ?? 'com'); } ?> Referral Programme — Relevant Reflex
Referral Programme
pts
Refer a Friend
Total Clicks
Signups
Verified
Total Earned
Your Referral Link

Share this link with anyone. When they register and verify their email, you earn rewards automatically.

 Your Tiered Referral Rewards

You're on a custom tier-based reward plan. Each verified-email signup you bring earns a different amount depending on how many you've already brought in. Keep going — your reward grows as you cross each tier!

Verified referrals so far:  ·  Your next referral will earn: ()
$t): $isActive = ($i === $activeTierIdx); ?>
Refs
Fixed for everyone
★ ACTIVE
How It Works
🔗
Share your link with friends, groups, or on social media
✍️
They register using your link and verify their email
You earn ₹ ( pts) —
You earn ₹5 (10 pts)
📋
Every time they complete a survey
You earn ₹5 (10 pts) more
💰
Rewards go directly into your points balance for redemption
 Where to Share Your Link
💬 Messaging Apps: WhatsApp groups, Telegram channels & groups, Instagram DMs
📱 Social Media: Facebook posts & stories, Instagram Reels/Shorts, YouTube video descriptions, Twitter/X threads
📣 Promotions: Digital ad banners, blog articles, email newsletters, LinkedIn posts
⚠️ Fair Use: Referral rewards are for genuine referrals only. Multiple clicks from the same IP are limited. Self-referrals are not counted. Abuse may result in reward reversal.
Click & Signup History
$r): ?>
#Referred EmailClickedSigned UpVerifiedSignup RewardSurvey Earnings
🔗
No referral clicks yet. Share your link to get started!
Not signed up
✓ Yes
Pending
✓ Verified
⏳ Pending
Paid Processing 0): ?> ₹0.00