RegisterVar("TITLE", _LANG_MEMBERS_TITLE); $tml->RegisterVar("FNAME", $user->Get("fname")); if($user->IsLoggedIn()) { if($_GET["action"] == "logout") { $user->Logoff(); header("Location: " . _SITE_URL . "/index.php?sid=" . $session->ID); } else { $tml->loadFromFile("pages/header"); $tml->Parse(); $tml->RegisterVar("FNAME", $user->Get("fname")); $tml->RegisterVar("SNAME", $user->Get("sname")); $tml->RegisterVar("EMAIL", $user->Get("email")); $tml->RegisterVar("UID", $user->Get("id")); $total_earnings = $user->Get("clickthrus") + $user->Get("ptc") + $user->Get("paidsignups") + $user->Get("leads_sales") + $user->Get("credits") + $user->Get("games") + $user->Get("bonus") + $referral_earnings - $user->Get("debits") - $method["fee"]; $total_pearnings = $preferral_earnings + $user->Get("points") - $user->Get("dpoints"); $tml->RegisterVar("TOTAL_EARNINGS", number_format($total_earnings, 4, ",", "")); $tml->RegisterVar("TOTAL_PEARNINGS", _MEMBER_POINTS == "YES" ? number_format($total_pearnings, 4, ",", "") : -1); $tml->RegisterVar("POINT_EARNINGS", _MEMBER_POINTS == "YES" ? number_format($point_earnings, 4, ".", "") : -1); $tml->RegisterVar("SIGNUP", date(_SITE_DATESTAMP, $user->Get("regdate"))); $tml->RegisterVar("lastlogin", date(_SITE_DATESTAMP)); $method = $db->Fetch("SELECT method, fee, minimum FROM payment_methods WHERE id='" . $user->Get("payment_method") . "'"); $tml->RegisterVar("CLICKTHRUS", number_format($user->Get("clickthrus"), 4, ",", "")); $tml->RegisterVar("PTC", number_format($user->Get("ptc"), 4, ",", "")); $tml->RegisterVar("PAIDSIGNUPS", number_format($user->Get("paidsignups"), 4, ",", "")); $tml->RegisterVar("LEADS_SALES", number_format($user->Get("leads_sales"), 4, ",", "")); $tml->RegisterVar("GAMES", number_format($user->Get("games"), 4, ",", "")); $tml->RegisterVar("CREDITS", number_format($user->Get("credits"), 4, ",", "")); $tml->RegisterVar("BONUS", number_format($user->Get("bonus"), 4, ",", "")); $tml->RegisterVar("DEBITS", number_format($user->Get("debits"), 4, ",", "")); $tml->RegisterVar("POINTS", _MEMBER_POINTS == "YES" ? number_format($user->Get("points"), 2, ".", "") : ""); $tml->RegisterVar("DPOINTS", _MEMBER_POINTS == "YES" ? number_format($user->Get("dpoints"), 2, ".", "") : ""); $tml->RegisterVar("SHOWINACTIVE", (_REFERRAL_LOGGEDIN != 0 || _REFERRAL_EARNED != 0) && _REFERRAL_WITHIN != 0 && _REFERRAL_TYPE == "CREDITS" ? 1 : 0); $data = unserialize($user->Get("referral_data")); $loopData = Array(); $referral_earnings = 0; $preferral_earnings = 0; for($i = 1; $i - 1 < $referrals->GetLevelData($user->Get("premium")); $i++) { if((_REFERRAL_LOGGEDIN != 0 || _REFERRAL_EARNED != 0) && _REFERRAL_WITHIN != 0 && _REFERRAL_TYPE == "CREDITS") { $numI = count($referrals->GetNumReferrals($user->Get("id"), $i, 0)); $loopData = Array( "NumIReferrals" => $numI, "NumReferrals" => count($referrals->GetNumReferrals($user->Get("id"), $i, 1)), "LevelIEarnings" => number_format(($referrals->GetLevelData($user->Get("premium"), $i) * $numI), 4, ",", ""), "PLevelEarnings" => _MEMBER_POINTS == "YES" ? number_format($data["plevel_$i"], 2, ",", "") : -1, "LevelEarnings" => number_format($data["level_$i"], 4, ".", ""), ); } else { $loopData = Array( "NumReferrals" => count($referrals->GetNumReferrals($user->Get("id"), $i, 1)), "PLevelEarnings" => _MEMBER_POINTS == "YES" ? number_format($data["plevel_$i"], 2, ",", "") : -1, "LevelEarnings" => number_format($data["level_$i"], 4, ",", ""), ); } $referral_earnings += $data["level_$i"]; $preferral_earnings += $data["plevel_$i"]; $tml->RegisterLoop("levelData", ($i - 1), $loopData); } $tml->RegisterVar("METHOD", $method["method"]); $tml->RegisterVar("FEE", $method["fee"]); $total_earnings = $user->Get("clickthrus") + $user->Get("ptc") + $user->Get("paidsignups") + $user->Get("leads_sales") + $user->Get("credits") + $user->Get("games") + $user->Get("bonus") + $referral_earnings - $user->Get("debits") - $method["fee"]; $total_pearnings = $preferral_earnings + $user->Get("points") - $user->Get("dpoints"); $tml->RegisterVar("TOTAL_PEARNINGS", _MEMBER_POINTS == "YES" ? number_format($total_pearnings, 4, ",", "") : -1); $tml->RegisterVar("TOTAL_EARNINGS", number_format($total_earnings, 4, ",", "")); $tml->RegisterVar("PAYMENT_BUTTON", $total_earnings >= $method["minimum"] && $total_earnings >= 0.01); $tml->RegisterVar("TRANSFER", _MEMBER_TRANSFER); $tml->RegisterVar("TRANSFERFEE", _MEMBER_TRANSFERFEE); $tml->loadFromFile("pages/members2"); $tml->Parse(); $tml->loadFromFile("pages/footer"); $tml->Parse(); $tml->Output(); } } elseif($_SERVER["REQUEST_METHOD"] == "POST") { if($_POST["action"] == "login") { if(!$_POST["email"] || !$_POST["password"]) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_ERROR_FIELDEMPTY)); elseif(!$user->IsEmail($_POST["email"])) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_MEMBERS_BADUSERNAME)); elseif(!$user->IsPassword($_POST["email"], $_POST["password"])) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_MEMBERS_BADPASSWORD)); elseif(!$user->IsActive($_POST["email"])) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_MEMBERS_NOTACTIVATED)); $user->Login($_POST["email"], $_POST["password"], $_POST["public"] == "on" ? 2 : 1); header("Location: " . _SITE_URL . "/members.php?sid=" . $session->ID); } elseif($_POST["action"] == "resend") { if(!$_POST["email"]) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_ERROR_FIELDEMPTY)); elseif(!$user->IsEmail($_POST["email"])) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_MEMBERS_BADUSERNAME)); $user->ResendPassword($_POST["email"]); $main->printText(_LANG_MEMBERS_PASSWORDRESENT); } elseif($_POST["action"] == "cancel") { if(!$_POST["email"] || !$_POST["password"]) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_ERROR_FIELDEMPTY)); elseif(!$user->IsEmail($_POST["email"])) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_MEMBERS_BADUSERNAME)); elseif(!$user->IsPassword($_POST["email"], $_POST["password"])) exit($error->Report(_LANG_MEMBERS_TITLE, _LANG_MEMBERS_BADPASSWORD)); if($_POST["confirm"] == "yes") { $user->Remove($db->Fetch("SELECT id FROM users WHERE email='" . $_POST["email"] . "' AND password='" . $_POST["password"] . "'")); $main->printText(_LANG_MEMBERS_ACCOUNTDELETED); } else { $tml->loadFromFile("pages/header"); $tml->Parse(); $tml->RegisterVar("EMAIL", $_POST["email"]); $tml->RegisterVar("PASSWORD", $_POST["password"]); $tml->RegisterVar("FNAME", $user->Get("fname")); $tml->loadFromFile("pages/unsubscribe"); $tml->Parse(); $tml->loadFromFile("pages/footer"); $tml->Parse(); $tml->Output(); } } else $error->Fatal(_LANG_MEMBERS_TITLE, _LANG_ERROR_ERROROCCURED); } else { $tml->RegisterVar("UID", $user->Get("id")); $tml->loadFromFile("pages/header"); $tml->Parse(); $tml->loadFromFile("pages/members1"); $tml->Parse(); $tml->loadFromFile("pages/footer"); $tml->Parse(); $tml->Output(); } ?>