'', ); // Begin with doubler script... if (isFormSent()) { // Secure points (so only integer/double values are allowed setPostRequestParameter('points', bigintval(postRequestParameter('points'))); // Begin with doubling process if ((isPostRequestParameterSet('userid')) && (isPostRequestParameterSet('password')) && (isPostRequestParameterSet('points'))) { // Probe for nickname extension and if a nickname was entered if (isNickNameUsed(postRequestParameter('userid'))) { // Nickname in URL, so load the id fetchUserData(postRequestParameter('userid'), 'nickname'); } else { // Direct userid entered fetchUserData(postRequestParameter('userid')); } // Is the data valid? if (!isUserDataValid()) { // Output message that the userid is not okay displayMessage('{--DOUBLER_USERID_INVALID--}'); } // END - if // Remove any dots and unwanted chars from the points setPostRequestParameter('points', bigintval(round(convertCommaToDot(postRequestParameter('points'))))); // Probe for enough points $probe_points = ((postRequestParameter('points') >= getConfig('doubler_min')) && (postRequestParameter('points') <= getConfig('doubler_max'))); // Check all together if ((isUserDataValid()) && (getUserData('password') == generateHash(postRequestParameter('password'), substr(getUserData('password'), 0, -40))) && (getUserData('status') == 'CONFIRMED') && ($probe_points)) { // Nickname resolved to a unique userid or direct userid entered by the member $GLOBALS['local_doubler_userid'] = getUserData('userid'); // Calulcate points $points = getTotalPoints(getUserData('userid')); // So let's continue with probing his points amount if (($points - getConfig('doubler_left') - postRequestParameter('points') * getConfig('doubler_charge') / 100) >= 0) { // Enough points are left so let's continue with the doubling process // Create doubling "account" width *DOUBLED* points SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')", array( getUserData('userid'), makeDatabaseUserId(determineReferalId()), bigintval(postRequestParameter('points') * 2) ), __FILE__, __LINE__); // Subtract entered points subtractPoints('doubler', getUserData('userid'), postRequestParameter('points')); // Add points to "total payed" including charge $points = postRequestParameter('points') - postRequestParameter('points') * getConfig('doubler_charge') / 100; updateConfiguration('doubler_points', $points, '+'); incrementConfigEntry('doubler_points', $points); // Add second line for the referal but only when userid != refid if ((isValidUserId(determineReferalId())) && (determineReferalId() != getUserData('userid'))) { // Okay add a refid line and apply refid percents SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')", array( makeDatabaseUserId(determineReferalId()), bigintval(postRequestParameter('points') * 2 * getConfig('doubler_ref') / 100) ), __FILE__, __LINE__); // And that's why we don't want to you more than one referal level of doubler-points. ^^^ } // END - if // Update usage counter updateConfiguration('doubler_counter', 1, '+'); // Set constant $content['message'] = loadTemplate('doubler_reflink', true, postRequestParameter('userid')); } else { // Not enougth points left $content['message'] = '{--DOUBLER_FORM_NO_POINTS_LEFT--}'; } } elseif (getUserData('status') == 'CONFIRMED') { // Account is unconfirmed! $content['message'] = '{--DOUBLER_FORM_WRONG_PASS--}'; } elseif (getUserData('status') == 'UNCONFIRMED') { // Account is unconfirmed! $content['message'] = '{--DOUBLER_FORM_STATUS_UNCONFIRMED--}'; } elseif (getUserData('status') == 'LOCKED') { // Account is locked by admin / holiday! $content['message'] = '{--DOUBLER_FORM_STATUS_LOCKED--}'; } elseif (postRequestParameter('points') < getConfig('doubler_min')) { // Not enougth points entered $content['message'] = '{--DOUBLER_FORM_POINTS_MIN--}'; } elseif (postRequestParameter('points') > getConfig('doubler_max')) { // Too much points entered $content['message'] = '{--DOUBLER_FORM_POINTS_MAX--}'; } elseif (isNickNameUsed(postRequestParameter('userid'))) { // Cannot resolv nickname -> userid $content['message'] = '{--DOUBLER_FORM_404_NICKNAME--}'; } else { // Wrong password or account not found $content['message'] = '{--DOUBLER_FORM_404_MEMBER--}'; } } elseif (!isPostRequestParameterSet('userid')) { // Login not entered $content['message'] = '{--DOUBLER_FORM_404_LOGIN--}'; } elseif (!isPostRequestParameterSet('password')) { // Password not entered $content['message'] = '{--DOUBLER_FORM_404_PASSWORD--}'; } elseif (!isPostRequestParameterSet('points')) { // points not entered $content['message'] = '{--DOUBLER_FORM_404_POINTS--}'; } } // END - if (isFormSet()) // Shall I check for points immediately? if (getConfig('doubler_send_mode') == 'DIRECT') loadInclude('inc/mails/doubler_mails.php'); // Output header loadIncludeOnce('inc/header.php'); // Banner in text $content['banner'] = loadTemplate('doubler_banner', true); // Load header/footer templates $content['header'] = loadTemplate('doubler_header', true); $content['footer'] = loadTemplate('doubler_footer', true); if (isUserDataValid()) { // Transfer userid/nickname to constant $content['refid'] = getUserData('userid'); } else { // Transfer userid/nickname to constant $content['refid'] = determineReferalId(); } // Text "Enter login" if (isExtensionActive('nickname')) { // Choose login/nickname $content['enter_login'] = '{--GUEST_ENTER_LOGIN_NICKNAME--}'; } else { // Simple login id $content['enter_login'] = '{--GUEST_ENTER_LOGIN--}'; } // Which mail-send-mode did the admin setup? $content['payout_time'] = '{--DOUBLER_PAYOUT_TIME_' . getConfig('doubler_send_mode') . '--}'; // Generate table with already payed out doubles $content['payout_history'] = generateDoublerTable(0, 'Y', 'N', 'DESC'); // Output neccessary form for this loadTemplate('doubler_index', false, $content); // Output footer loadIncludeOnce('inc/footer.php'); // [EOF] ?>