X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=doubler.php;h=c1b3b91a6ede2251280abda4083589d942a6fec9;hp=579a4afb4f605d0ed19d090d2d1a35a66e2c7b69;hb=d1922ab361b5e104b7c14b28c76d1c47651635ef;hpb=c8d76610eb94093d4eed4fcd8a6cb72e74c8f6d8 diff --git a/doubler.php b/doubler.php index 579a4afb4f..c1b3b91a6e 100644 --- a/doubler.php +++ b/doubler.php @@ -10,14 +10,9 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Punkteverdoppler * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2016 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -39,14 +34,14 @@ require('inc/libs/security_functions.php'); // Init start time -$GLOBALS['startTime'] = microtime(true); +$GLOBALS['__start_time'] = microtime(TRUE); -// Set module -$GLOBALS['module'] = 'doubler'; -$GLOBALS['output_mode'] = '0'; +// Set module and output mode +$GLOBALS['__module'] = 'doubler'; +$GLOBALS['__output_mode'] = '0'; -// Load the required file(s) -require('inc/config-global.php'); +// Initialize application +require('inc/init.php'); // Set content type setContentType('text/html'); @@ -62,33 +57,33 @@ $content = array( // Begin with doubler script... if (isFormSent()) { // Secure points (so only integer/double values are allowed - setPostRequestParameter('points', bigintval(postRequestParameter('points'))); + setPostRequestElement('points', bigintval(postRequestElement('points'))); // Begin with doubling process - if ((isPostRequestParameterSet('userid')) && (isPostRequestParameterSet('password')) && (isPostRequestParameterSet('points'))) { + if ((isPostRequestElementSet('userid')) && (isPostRequestElementSet('password')) && (isPostRequestElementSet('points'))) { // Probe for nickname extension and if a nickname was entered - if (isNickNameUsed(postRequestParameter('userid'))) { + if (isNicknameUsed(postRequestElement('userid'))) { // Nickname in URL, so load the id - fetchUserData(postRequestParameter('userid'), 'nickname'); + fetchUserData(postRequestElement('userid'), 'nickname'); } else { // Direct userid entered - fetchUserData(postRequestParameter('userid')); + fetchUserData(postRequestElement('userid')); } // Is the data valid? - if (!isUserDataValid()) { + if (!isValidUserData()) { // Output message that the userid is not okay - loadTemplate('admin_settings_saved', false, '{--DOUBLER_USERID_INVALID--}'); + displayMessage('{--DOUBLER_USERID_INVALID--}'); } // END - if // Remove any dots and unwanted chars from the points - setPostRequestParameter('points', bigintval(round(convertCommaToDot(postRequestParameter('points'))))); + setPostRequestElement('points', bigintval(round(convertCommaToDot(postRequestElement('points'))))); // Probe for enough points - $probe_points = ((postRequestParameter('points') >= getConfig('doubler_min')) && (postRequestParameter('points') <= getConfig('doubler_max'))); + $probe_points = ((postRequestElement('points') >= getDoublerMin()) && (postRequestElement('points') <= getDoublerMax())); // Check all together - if ((isUserDataValid()) && (getUserData('password') == generateHash(postRequestParameter('password'), substr(getUserData('password'), 0, -40))) && (getUserData('status') == 'CONFIRMED') && ($probe_points)) { + if ((isValidUserData()) && (getUserData('password') == generateHash(postRequestElement('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'); @@ -96,41 +91,43 @@ if (isFormSent()) { $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) { + if (($points - getConfig('doubler_left') - postRequestElement('points') * getDoublerCharge() / 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')", + // Create doubling "account" with *DOUBLED* points + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,%s,%s,'%s', UNIX_TIMESTAMP(), 'N','N')", array( getUserData('userid'), - makeDatabaseUserId(determineReferalId()), - bigintval(postRequestParameter('points') * 2) + convertZeroToNull(determineReferralId()), + bigintval(postRequestElement('points') * 2), + determineRealRemoteAddress() ), __FILE__, __LINE__); - // Subtract entered points - subtractPoints('doubler', getUserData('userid'), postRequestParameter('points')); + // Subtract entered points and ignore return status + subtractPoints('doubler', getUserData('userid'), postRequestElement('points')); // Add points to "total payed" including charge - $points = postRequestParameter('points') - postRequestParameter('points') * getConfig('doubler_charge') / 100; + $points = postRequestElement('points') - postRequestElement('points') * getDoublerCharge() / 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'))) { + // Add second line for the referral but only when userid != refid + if ((isValidId(determineReferralId())) && (determineReferralId() != 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')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES (%s,0,%s,'%s',UNIX_TIMESTAMP(),'N','Y')", array( - makeDatabaseUserId(determineReferalId()), - bigintval(postRequestParameter('points') * 2 * getConfig('doubler_ref') / 100) + convertZeroToNull(determineReferralId()), + (postRequestElement('points') * 2 * getDoublerRef() / 100), + determineRealRemoteAddress() ), __FILE__, __LINE__); - // And that's why we don't want to you more than one referal level of doubler-points. ^^^ + // And that's why we don't want to you more than one referral level of doubler-points. ^^^ } // END - if // Update usage counter updateConfiguration('doubler_counter', 1, '+'); // Set constant - $content['message'] = loadTemplate('doubler_reflink', true, postRequestParameter('userid')); + $content['message'] = loadTemplate('doubler_reflink', TRUE, postRequestElement('userid')); } else { // Not enougth points left $content['message'] = '{--DOUBLER_FORM_NO_POINTS_LEFT--}'; @@ -144,50 +141,45 @@ if (isFormSent()) { } elseif (getUserData('status') == 'LOCKED') { // Account is locked by admin / holiday! $content['message'] = '{--DOUBLER_FORM_STATUS_LOCKED--}'; - } elseif (postRequestParameter('points') < getConfig('doubler_min')) { + } elseif (postRequestElement('points') < getDoublerMin()) { // Not enougth points entered $content['message'] = '{--DOUBLER_FORM_POINTS_MIN--}'; - } elseif (postRequestParameter('points') > getConfig('doubler_max')) { + } elseif (postRequestElement('points') > getDoublerMax()) { // Too much points entered $content['message'] = '{--DOUBLER_FORM_POINTS_MAX--}'; - } elseif (isNickNameUsed(postRequestParameter('userid'))) { + } elseif (isNicknameUsed(postRequestElement('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')) { + } elseif (!isPostRequestElementSet('userid')) { // Login not entered $content['message'] = '{--DOUBLER_FORM_404_LOGIN--}'; - } elseif (!isPostRequestParameterSet('password')) { + } elseif (!isPostRequestElementSet('password')) { // Password not entered $content['message'] = '{--DOUBLER_FORM_404_PASSWORD--}'; - } elseif (!isPostRequestParameterSet('points')) { + } elseif (!isPostRequestElementSet('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'); +if (getDoublerSendMode() == 'DIRECT') { + loadInclude('inc/mails/doubler_mails.php'); +} // END - if // 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); +loadPageHeader(); -if (isUserDataValid()) { +if (isValidUserData()) { // Transfer userid/nickname to constant $content['refid'] = getUserData('userid'); } else { // Transfer userid/nickname to constant - $content['refid'] = determineReferalId(); + $content['refid'] = determineReferralId(); } // Text "Enter login" @@ -200,16 +192,16 @@ if (isExtensionActive('nickname')) { } // Which mail-send-mode did the admin setup? -$content['payout_time'] = '{--DOUBLER_PAYOUT_TIME_' . getConfig('doubler_send_mode') . '--}'; +$content['payout_time'] = '{--DOUBLER_PAYOUT_TIME_' . getDoublerSendMode() . '--}'; // 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); +loadTemplate('doubler_index', FALSE, $content); // Output footer -loadIncludeOnce('inc/footer.php'); +loadPageFooter(); // [EOF] ?>