} else {
LOAD_URL("shop_reseller.php?reseller=".bigintval($_GET['user']));
}
- }
- exit();
-} else {
- // Do nothing for now
- die();
-}
-//
+ } // END - if
+} // END - if
+
+// Load index page
+LOAD_URL("index.php");
+
+// [EOF]
?>
define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "524");
+define('CURR_SVN_REVISION', "525");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
}
// Debug message
- //DEBUG_LOG(__FUNCTION__.": ext_name={$ext_name},active={$active}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, " ext_name={$ext_name},active={$active}");
// Is this extension activated? (For admins we always have active extensions...)
return ($active == "Y");
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`sender_id` BIGINT(20) NOT NULL DEFAULT 0,
`timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00',
+`file` VARCHAR(255) NOT NULL DEFAULT '',
+`line` MEDIUMINT NOT NOT NULL DEFAULT 0,
`message` LONGTEXT,
`comment` TINYTEXT,
`status` ENUM('NEW','PENDING','ACCEPTED','FIXED','INVALID','DUBLICATE','SPAM') NOT NULL DEFAULT 'NEW',
}
// Version number
-$EXT_VERSION = "0.3.3";
+$EXT_VERSION = "0.3.4";
// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.1", "0.1.1", "0.1.2", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3");
+$EXT_VER_HISTORY = array("0.0", "0.1", "0.1.1", "0.1.2", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4");
switch ($EXT_LOAD_MODE)
{
break;
case "0.1.1": // SQL queries for v0.1.1
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_extensions SET ext_has_css='Y' WHERE ext_name='user' AND ext_has_css='N' LIMIT 1";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='user' AND `ext_has_css`='N' LIMIT 1";
// This update depends on sql_patches update!
$EXT_UPDATE_DEPENDS = "sql_patches";
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Mitglieder sind nun per Formular kontaktierbar (es wird eine EMail versendet), gesperrte und bestätigte Mitglieder-Accounts sind seperat oder gemeinsam auflistbar (seperat nur mit der Erweiterung <em>task</em>!)";
break;
+
+ case "0.3.4": // SQL queries for v0.3.4
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD `rand_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Mitglieder werden per Zufall als Referal-ID ausgewählt, die eine Mindestanzahl an bestätigten Mails haben, wenn die Ref-Id 0 ist.";
+ break;
}
break;
// Keep this extension always active!
$EXT_ALWAYS_ACTIVE = "Y";
-//
+// [EOF]
?>
}
// Log fatal messages away
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): message={$message}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}");
}
// Load a template file and return it's content (only it's name; do not use ' or ")
</pre>\n";
// Log the mail away
- if (defined('DEBUG_MAIL')) DEBUG_LOG(__FUNCTION__.":to={$TO},subject={$SUBJECT},msg={$MSG}");
+ if (defined('DEBUG_MAIL')) DEBUG_LOG(__FUNCTION__, __LINE__, "to={$TO},subject={$SUBJECT},msg={$MSG}");
} elseif (($HTML == "Y") && (EXT_IS_ACTIVE("html_mail"))) {
// Send mail as HTML away
SEND_HTML_EMAIL($TO, $SUBJECT, $MSG, $FROM);
} // END - if
// Debug log
- //DEBUG_LOG(__FUNCTION__.":dotted={$dotted},maxComma={$maxComma}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "dotted={$dotted},maxComma={$maxComma}");
// Translate it now
switch (GET_LANGUAGE()) {
// Has the whole value changed?
if ("".$ret."" != "".$num."") {
// Log the values
- DEBUG_LOG(__FUNCTION__.": num={$num},ret={$ret}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " num={$num},ret={$ret}");
} // END - if
// Return result
die("</pre>");
}
// Debug message logger
-function DEBUG_LOG ($message, $force=false) {
+function DEBUG_LOG ($file, $line, $message, $force=false) {
// Is debug mode enabled?
if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force)) {
// Log this message away
$fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
- fwrite($fp, date("d.m.Y|H:i:s", time())."|".strip_tags($message)."\n");
+ fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename(__FILE__)."|".__LINE__."|".strip_tags($message)."\n");
fclose($fp);
} // END - if
}
require($fqfn);
} else {
// Include not found!
- DEBUG_LOG(__FUNCTION__.":Include {$inc} not found. cache={$cache}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "Include {$inc} not found. cache={$cache}");
}
} // END - if
} // END - if
return false;
} elseif (!is_object($cacheInstance)) {
// No cache instance!
- DEBUG_LOG(__FUNCTION__.": No cache instance found.");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
return false;
} elseif ((!isset($_CONFIG['cache_admin_menu'])) || ($_CONFIG['cache_admin_menu'] == "N")) {
// Caching disabled (currently experiemental!)
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MORE_SELECTED);
} else {
// Debug log
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
}
}
+// Determines referal id and sets it
+function DETERMINE_REFID () {
+ global $_CONFIG, $CLICK, $_SERVER;
+
+ // Check if refid is set
+ if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
+ // The variable user comes from the click-counter script click.php and we only accept this here
+ $GLOBALS['refid'] = bigintval($_GET['user']);
+ } elseif (!empty($_POST['refid'])) {
+ // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
+ $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_POST['refid']));
+ } elseif (!empty($_GET['refid'])) {
+ // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
+ $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['refid']));
+ } elseif (!empty($_GET['ref'])) {
+ // Set refid=ref (the referal link uses such variable)
+ $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['ref']));
+ } elseif ((isSessionVariableSet('refid')) && (get_session('refid') != 0)) {
+ // Set session refid als global
+ $GLOBALS['refid'] = bigintval(get_session('refid'));
+ } elseif ((GET_EXT_VERSION("sql_patches") != "") && ($_CONFIG['def_refid'] > 0)) {
+ // Set default refid as refid in URL
+ $GLOBALS['refid'] = bigintval($_CONFIG['def_refid']);
+ } elseif ((GET_EXT_VERSION("user") >= "0.3.4") && ($_CONFIG['select_user_zero_refid']) == "Y") {
+ // Select a random user which has confirmed enougth mails
+ $GLOBALS['refid'] = SELECT_RANDOM_REFID();
+ } else {
+ // No default ID when sql_patches is not installed or none set
+ $GLOBALS['refid'] = 0;
+ }
+
+ // Set cookie when default refid > 0
+ if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((get_session('refid') == "0") && (isset($_CONFIG['def_refid'])) && ($_CONFIG['def_refid'] > 0))) {
+ // Set cookie
+ set_session('refid', $GLOBALS['refid']);
+ } // END - if
+}
//////////////////////////////////////////////////
// //
define('RECEIVE_MAILS', "Kann Mails empfangen");
define('REF_CLICKS', "Klicks auf Ref-Link");
define('TOTAL_LOGINS', "Logins gesamt");
-define('USED_POINTS', "Verwendete {!POINTS!}");
+define('USED_POINTS', "Ausgegebene {!POINTS!}");
define('MAILS_SENT', "Mails versendet");
define('HAS_JOINED', "Beigetreten am");
define('TOTAL_POINTS', "{!POINTS!} gesamt");
define('BONUS_EXTENSION_UPGRADE_2', "</U> oder neuer!");
define('_ON', "an");
define('CLICK_STATISTICS', "Mail-Statistik");
-define('ADMIN_SELECT_DEF_REFID', "Standart Referal-ID bei Anmeldung über keinen Ref-Link");
+define('ADMIN_SELECT_DEF_REFID', "Standart Referal-ID bei Anmeldung über <strong>keinen</strong> Ref-Link");
define('ADMIN_SELECT_REFID_TARGRT', "Ziel-Seite des Referal-Linkes");
define('ADMIN_REF_TARGET_REGISTER', "Zur Anmeldeseite");
define('ADMIN_REF_TARGET_INDEX', "Zur Eingangsseite");
define('ADMIN_RESET_PASSWORD', "Passwort vergessen?");
define('EMAIL_DETAILS', "Email-Details");
define('EMAIL_DETAILS_LINK', "Details anzeigen");
+define('ADMIN_CONFIG_REFID_TITLE', "Einstellungen zum Referal-Link");
+define('ADMIN_RANDOM_ZERO_REFID', "Soll per Zufall ein User nach folgenden Kriterien ausgewählt werden, wenn keine Standart-Refid eingestellt ist?");
+define('ADMIN_RAND_REFID_ENABLED', "Mitglieder per Zufall wählen");
+define('ADMIN_RAND_REFID_DISABLED', "Referal-Id 0 verwenden");
+define('ADMIN_RANDOM_MIN_CONFIRMED', "Wie viele bestätigte Mails muss ein Mitglied mindestens haben, um per Zufall ausgewählt zu werden?");
+define('EMAILS_RECEIVED', "Emails bereits empfangen");
+define('MAILS_CONFIRMED', "Emails bestätigt");
define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail <span class=\"data\">%s</span> bestätigt.");
define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail <span class=\"data\">%s</span> bestätigt.");
} else {
// Debug log
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): NO ENTRY FOUND! :-(<br />\n";
- DEBUG_LOG(__FUNCTION__.": uid={$uid},ref={$ref} - No entry found! :-(");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},ref={$ref} - No entry found! :-(");
}
// Free result
$performed = call_user_func_array($functionName, $urlData);
} else {
// Log invalid request
- DEBUG_LOG(__FUNCTION__.": action={$formData['action']},id={$formData['id']},function={$functionName}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " action={$formData['action']},id={$formData['id']},function={$functionName}");
}
// Return status
// Cache static reload lock
$SURFBAR_CACHE['surf_lock'] = $_CONFIG['surfbar_static_lock'];
- //DEBUG_LOG(__FUNCTION__.":Fixed surf lock is ".$_CONFIG['surfbar_static_lock']."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".$_CONFIG['surfbar_static_lock']."");
// Do we have dynamic model?
if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
$total = SURFBAR_GET_TOTAL_URLS();
// Do we have some URLs in lock? Admins can always surf on own URLs!
- //DEBUG_LOG(__FUNCTION__.":userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}");
$isFull = ((SURFBAR_GET_DATA('user_locks') == $total) && ($total > 0));
// Return result
if (empty($salt)) {
// Generate random hashed string
$SURFBAR_CACHE['salt'] = sha1(GEN_PASS(255));
- //DEBUG_LOG(__FUNCTION__.":newSalt=".SURFBAR_GET_SALT()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."");
} else {
// Use this as salt!
$SURFBAR_CACHE['salt'] = $salt;
- //DEBUG_LOG(__FUNCTION__.":oldSalt=".SURFBAR_GET_SALT()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "oldSalt=".SURFBAR_GET_SALT()."");
}
// ... and now the validation code
$valCode = GEN_RANDOM_CODE($length, sha1(SURFBAR_GET_SALT().":".$urlId), $GLOBALS['userid']);
- //DEBUG_LOG(__FUNCTION__.":valCode={$valCode}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}");
} // END - while
// Hash it with md5() and salt it with the random string
$valHashedCode = generatePassString($hashedCode);
// Return hashed value
- //DEBUG_LOG(__FUNCTION__.":finalValCode={$valHashedCode}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "finalValCode={$valHashedCode}");
return $valHashedCode;
}
// Check validation code
$code = SURFBAR_GENERATE_VALIDATION_CODE($urlId, $salt);
// Return result of checking hashes and salts
- //DEBUG_LOG(__FUNCTION__.":---".$code."|".$check."---");
- //DEBUG_LOG(__FUNCTION__.":+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "---".$code."|".$check."---");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++");
return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
}
// Lockdown the userid/id combination (reload lock)
// Pay points to the user and remove it from the sender
function SURFBAR_PAY_POINTS ($urlId) {
// Remove it from the URL owner
- //DEBUG_LOG(__FUNCTION__.":uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS()."");
if (SURFBAR_GET_USERID() > 0) {
SUB_POINTS(SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
} // END - if
// Book it to the user
- //DEBUG_LOG(__FUNCTION__.":uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD()."");
ADD_POINTS_REFSYSTEM($GLOBALS['userid'], SURFBAR_GET_DATA('reward'));
}
// Updates the statistics of current URL/userid
array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), $GLOBALS['userid']), __FILE__, __LINE__);
// Debug message
- //DEBUG_LOG(__FUNCTION__.":salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".$GLOBALS['userid']."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".$GLOBALS['userid']."");
// Was that okay?
if (SQL_AFFECTEDROWS() < 1) {
} // END - if
// Debug message
- //DEBUG_LOG(__FUNCTION__.":affectedRows=".SQL_AFFECTEDROWS()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "affectedRows=".SQL_AFFECTEDROWS()."");
// Return if the update was okay
return (SQL_AFFECTEDROWS() == 1);
}
// Check if the reload lock is active for given id
function SURFBAR_CHECK_RELOAD_LOCK ($urlId) {
- //DEBUG_LOG(__FUNCTION__.":id={$urlId}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "id={$urlId}");
// Ask the database
$result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
FROM "._MYSQL_PREFIX."_surfbar_locks
SQL_FREERESULT($result);
// Return check
- //DEBUG_LOG(__FUNCTION__.":cnt={$cnt},".SURFBAR_GET_DATA('surf_lock')."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "cnt={$cnt},".SURFBAR_GET_DATA('surf_lock')."");
return ($cnt == 1);
}
// Determine which user hash no more points left
while (list($uid, $notified) = SQL_FETCHROW($result)) {
// Get total points
$points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
- //DEBUG_LOG(__FUNCTION__.":uid={$uid},points={$points}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},points={$points}");
// Shall we add this to ignore?
if ($points <= $limit) {
// Ignore this one!
- //DEBUG_LOG(__FUNCTION__.":uid={$uid} has depleted points amount!");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid} has depleted points amount!");
$UIDs['uid'][$uid] = $uid;
$UIDs['points'][$uid] = $points;
$UIDs['notified'][$uid] = $notified;
SQL_FREERESULT($result);
// Debug message
- //DEBUG_LOG(__FUNCTION__.":UIDs::count=".count($UIDs)." (with own userid=".$GLOBALS['userid'].")");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".$GLOBALS['userid'].")");
// Return result
return $UIDs;
// Load all entries
while (list($lid, $url, $last) = SQL_FETCHROW($result)) {
// Debug message
- //DEBUG_LOG(__FUNCTION__.":next - lid={$lid},url={$url},rest=".(time() - $last)."/".SURFBAR_GET_DATA('surf_lock')."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$lid},url={$url},rest=".(time() - $last)."/".SURFBAR_GET_DATA('surf_lock')."");
// Skip entries that are too old
if (($last > (time() - SURFBAR_GET_DATA('surf_lock'))) && (!in_array($url, $ignored))) {
// Debug message
- //DEBUG_LOG(__FUNCTION__.":okay - lid={$lid},url={$url},last={$last}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "okay - lid={$lid},url={$url},last={$last}");
// Add only if missing or bigger
if ((!isset($IDs[$url])) || ($IDs[$url] > $last)) {
// Debug message
- //DEBUG_LOG(__FUNCTION__.":ADD - lid={$lid},url={$url},last={$last}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "ADD - lid={$lid},url={$url},last={$last}");
// Add this ID
$IDs[$url] = $last;
} // END - if
} else {
// Debug message
- //DEBUG_LOG(__FUNCTION__.":ignore - lid={$lid},url={$url},last={$last}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "ignore - lid={$lid},url={$url},last={$last}");
// Ignore these old entries!
$ignored[] = $url;
GROUP BY sbu.id", __FILE__, __LINE__);
// Log last query
- //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."");
// Fetch max rand
$maxRand = SQL_NUMROWS($result);
} // END - if
// And query the database
- //DEBUG_LOG(__FUNCTION__.":randNum={$randNum},maxRand={$maxRand},surfLock=".SURFBAR_GET_DATA('surf_lock')."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "randNum={$randNum},maxRand={$maxRand},surfLock=".SURFBAR_GET_DATA('surf_lock')."");
$result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.views_total, sbu.views_max, sbu.views_allowed, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed
FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu
LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs
}
// Is there an id number?
- //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."");
if (SQL_NUMROWS($result) == 1) {
// Load/cache data
- //DEBUG_LOG(__FUNCTION__.":count(".count($SURFBAR_CACHE).") - BEFORE");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - BEFORE");
$SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result));
- //DEBUG_LOG(__FUNCTION__.":count(".count($SURFBAR_CACHE).") - AFTER");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - AFTER");
// Determine waiting time
$SURFBAR_CACHE['time'] = SURFBAR_DETERMINE_WAIT_TIME();
// Is the last salt there?
if (is_null($SURFBAR_CACHE['last_salt'])) {
// Then repair it wit the static!
- //DEBUG_LOG(__FUNCTION__.":last_salt - FIXED!");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "last_salt - FIXED!");
$SURFBAR_CACHE['last_salt'] = "";
} // END - if
// Fix missing last_surfed
if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) {
// Fix it here
- //DEBUG_LOG(__FUNCTION__.":last_surfed - FIXED!");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "last_surfed - FIXED!");
$SURFBAR_CACHE['last_surfed'] = 0;
} // END - if
// Get base/fixed reward and costs
$SURFBAR_CACHE['reward'] = SURFBAR_DETERMINE_REWARD();
$SURFBAR_CACHE['costs'] = SURFBAR_DETERMINE_COSTS();
- //DEBUG_LOG(__FUNCTION__.":BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
// Only in dynamic model add the dynamic bonus!
if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
// Calculate dynamic reward/costs and add it
$SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
$SURFBAR_CACHE['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
- //DEBUG_LOG(__FUNCTION__.":DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
} // END - if
// Now get the id
SQL_FREERESULT($result);
// Return result
- //DEBUG_LOG(__FUNCTION__.":nextId={$nextId}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "nextId={$nextId}");
return $nextId;
}
// -----------------------------------------------------------------------------
// Private getter for data elements
function SURFBAR_GET_DATA ($element) {
global $SURFBAR_CACHE;
- //DEBUG_LOG(__FUNCTION__.":element={$element}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "element={$element}");
// Default is null
$data = null;
}
// Return result
- //DEBUG_LOG(__FUNCTION__.":element[$element]={$data}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "element[$element]={$data}");
return $data;
}
// Getter for reward from cache
require($INC);
}
+// Add links for selecting some users
function alpha($sortby, $colspan, $return=false)
{
global $_CONFIG;
OUTPUT_HTML($OUT);
}
}
-//
+
+// Add links for sorting
function SortLinks($letter, $sortby, $colspan, $return=false)
{
$OUT = "";
OUTPUT_HTML($OUT);
}
}
-//
+
+// Add page navigation
function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false)
{
if (!$show_form)
OUTPUT_HTML($OUT);
}
}
+
// Create email link to user's account
function USER_CREATE_EMAIL_LINK($email, $mod="admin")
{
// Return rewritten (?) email address
return $email;
}
-//
+
+// Selects a random user id as the new referal id if they have at least X confirmed mails in this run
+function SELECT_RANDOM_REFID () {
+ global $_CONFIG;
+
+ // Default is zero refid
+ $refid = 0;
+
+ // Is the extension version fine?
+ if (GET_EXT_VERSION("user") >= "0.3.4") {
+ // Get all user ids
+ $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true, " AND `rand_confirmed` >= ".$_CONFIG['user_min_confirmed']."");
+
+ // Do we have at least one?
+ if ($totalUsers > 0) {
+ // Then choose random number
+ $randNum = mt_rand(0, ($totalUsers - 1));
+
+ // Look for random user
+ $result = SQL_QUERY_ESC("SELECT `userid` FROM `"._MYSQL_PREFIX."_user_data` WHERE `status`='CONFIRMED' AND `rand_confirmed` >= %s ORDER BY `rand_confirmed` DESC LIMIT %s, 1",
+ array($_CONFIG['user_min_confirmed'], $randNum), __FILE__, __LINE__);
+
+ // Do we have one entry there?
+ if (SQL_NUMROWS($result) == 1) {
+ // Use that userid as new referal id
+ list($refid) = SQL_FETCHROW($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ } // END - if
+ } // END - if
+
+ // Return result
+ return $refid;
+}
+
+// [EOF]
?>
//* DEBUG: */ echo "mode={$mode},points={$points}<br />\n";
if (!in_array($mode, array('payout', 'withdraw'))) {
// Log error and abort
- DEBUG_LOG(__FUNCTION__.":uid={$GLOBALS['userid']},mode={$mode},points={$points}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$GLOBALS['userid']},mode={$mode},points={$points}");
return false;
} // END - if
// Is the array an array? ;-)
if (!is_array($array)) {
// Log error and return
- DEBUG_LOG(__FUNCTION__.": Type ".gettype($array)." != array.");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " Type ".gettype($array)." != array.");
return;
} // END - if
// Log the response if failed
if (count($response) == 0) {
// Queries depleted (as we count here!)
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): Requested depleted. Maxmimum was: ".$_CONFIG['yoomedia_requests_total']);
+ DEBUG_LOG(__FUNCTION__, __LINE__, " Requested depleted. Maxmimum was: ".$_CONFIG['yoomedia_requests_total']);
} elseif (count($response) <= 10) {
// Log serialized raw response
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): Raw response=".base64_encode(serialize($response)));
+ DEBUG_LOG(__FUNCTION__, __LINE__, " Raw response=".base64_encode(serialize($response)));
} // END - if
// Do we have some data there?
$return = $yoomediaTranslationTable[$type][$index];
} else {
// Not found!
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): type={$type},index={$index} not found.");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " type={$type},index={$index} not found.");
}
// Return value
$return = $yoomediaTranslationTable['error_codes'][$errorCode];
} else {
// Log missing entries
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): errorCode={$errorCode}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " errorCode={$errorCode}");
}
// Return value
$content['sw'] = $SW;
// Then list it
- $OUT .= LOAD_TEMPLATE("admin_".$listType."_".$table."_row", true, $content);
+ $OUT .= LOAD_TEMPLATE(sprintf("admin_%s_%s_row",
+ $listType,
+ $table
+ ), true, $content
+ );
// Switch color
$SW = 3 - $SW;
} // END - foreach
// Load master template
- LOAD_TEMPLATE("admin_".$listType."_".$table."", false, $OUT);
+ LOAD_TEMPLATE(sprintf("admin_%s_%s",
+ $listType,
+ $table
+ ), false, $OUT
+ );
}
// Change status of "build" list
function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray) {
} // END - if
// Finish SQL statement
- $SQL = substr($SQL, 0, -1) . " WHERE ".$idColumn."=".bigintval($id)." AND ".$statusColumn."='".$oldStatus."' LIMIT 1";
+ $SQL = substr($SQL, 0, -1) . sprintf(" WHERE %s=%s AND %s='%s' LIMIT 1",
+ $idColumn,
+ bigintval($id),
+ $statusColumn,
+ $oldStatus
+ );
// Run the SQL
SQL_QUERY($SQL, __FILE__, __LINE__);
// Prepare contants for the template
define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX($_CONFIG['def_refid'], false, true, true, "def_refid"));
- switch ($_CONFIG['refid_target']) {
- case "index": define('__DEF_RT_INDEX', " selected=\"selected\""); define('__DEF_RT_REGISTER', ""); break;
- case "register": define('__DEF_RT_INDEX', ""); define('__DEF_RT_REGISTER', " selected=\"selected\""); break;
- }
+ switch ($_CONFIG['refid_target']) {
+ case "index":
+ define('__DEF_RT_INDEX' , " selected=\"selected\"");
+ define('__DEF_RT_REGISTER', "");
+ break;
+
+ case "register":
+ define('__DEF_RT_INDEX' , "");
+ define('__DEF_RT_REGISTER', " selected=\"selected\"");
+ break;
+ } // END - switch
+
+ switch ($_CONFIG['select_user_zero_refid']) {
+ case "Y":
+ define('__RAND_REFID_Y', " selected=\"selected\"");
+ define('__RAND_REFID_N', "");
+ break;
+
+ case "N":
+ define('__RAND_REFID_Y', "");
+ define('__RAND_REFID_N', " selected=\"selected\"");
+ break;
+ } // END - switch
+
+ // Prepare content
+ $content = array(
+ 'user_min_confirmed' => $_CONFIG['user_min_confirmed']
+ );
// Load template
- LOAD_TEMPLATE("admin_config_refid");
+ LOAD_TEMPLATE("admin_config_refid", false, $content);
}
-//
+
+// [EOF]
?>
// Remember it
define('__TITLE', $listHeader);
-$MORE = ", userid"; $colspan = "4"; // 27
+// Init variables
+$MORE = ", userid"; $colspan = "4";
+
+// Add nickname if extension is found&active
if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; }
+// Add random confirmed if extension version matches
+if (GET_EXT_VERSION("user") >= "0.3.4") {
+ // Add it...
+ $MORE .= ", rand_confirmed";
+} // END - if
+
+// Init unset data (bad that we change $_GET here!)
if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; }
if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
if (empty($_GET['page'])) { $_GET['page'] = "1"; }
// Secure the user ID
$uid = bigintval($_GET['u_id']);
- // Does the account exists? 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
- $result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails, receive_mails, refid, status, REMOTE_ADDR, last_online, last_module, ref_clicks, total_logins, used_points, emails_sent, joined, last_update, last_profile_sent, notified, ref_payout".$MORE."
+ // Does the account exists?
+ $result_user = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails, receive_mails, refid, status, REMOTE_ADDR, last_online, last_module, ref_clicks, total_logins, used_points, emails_sent, joined, last_update, last_profile_sent, notified, ref_payout, emails_received, mails_confirmed".$MORE."
FROM "._MYSQL_PREFIX."_user_data
-WHERE userid=%s LIMIT 1",
- array($uid), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
+WHERE userid=%s
+LIMIT 1",
+ array($uid), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_user) == 1) {
// Account found!
- $DATA = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ $DATA = SQL_FETCHARRAY($result_user);
+ // Get count/sum of refs, selected categories, unconfirmed mails
$REFS = GET_TOTAL_DATA($uid, "refsystem", "counter");
$CATS = GET_TOTAL_DATA($uid, "user_cats", "id", "userid", true);
$LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true);
+ // Add links to the numbers
if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."</A>]";
- if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13]."</A>]");
- if (empty($DATA[17])) $DATA[17] = "---";
+ if ($DATA['refid'] > 0) $DATA['refid'] = $BASE."&what=list_user&u_id=".$DATA['refid']."\">".$DATA['refid']."</A>]";
+ if (empty($DATA['last_module'])) $DATA['last_module'] = "---";
if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS."</A>]";
if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS."</A>]";
// Prepare data for template
- define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA[9], $DATA[8], $DATA[10]), "3"));
+ define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA['birth_month'], $DATA['birth_day'], $DATA['birth_year']), "3"));
define('_REFS' , $REFS);
define('_CATS' , $CATS);
define('_LINKS', $LINKS);
- define('_ADMIN_LINKS', MEMBER_ACTION_LINKS($uid, $DATA[14]));
- $DATA[0] = TRANSLATE_GENDER($DATA[0]);
- $DATA[28] = CREATE_EMAIL_LINK($DATA[7], "user_data");
- $DATA[14] = TRANSLATE_STATUS($DATA[14]);
- $DATA[16] = MAKE_DATETIME($DATA[16], "0");
- $DATA[20] = TRANSLATE_COMMA($DATA[20]);
- if ($DATA[21] > 0) $DATA[21] = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($DATA[21])."</A>]";
- $DATA[22] = MAKE_DATETIME($DATA[22], "0");
- $DATA[23] = MAKE_DATETIME($DATA[23], "0");
- $DATA[24] = MAKE_DATETIME($DATA[24], "0");
- if ((empty($DATA[27])) || ($DATA[27] == $uid)) $DATA[27] = "---";
- $DATA['total'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points"));
- $DATA['locked'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points"));
-
+ define('_ADMIN_LINKS', MEMBER_ACTION_LINKS($uid, $DATA['status']));
+ $DATA['gender'] = TRANSLATE_GENDER($DATA['gender']);
+ $DATA['email_link'] = CREATE_EMAIL_LINK($DATA['email'], "user_data");
+ $DATA['status'] = TRANSLATE_STATUS($DATA['status']);
+ $DATA['last_online'] = MAKE_DATETIME($DATA['last_online'], "0");
+ $DATA['used_points'] = TRANSLATE_COMMA($DATA['used_points']);
+ if ($DATA['emails_sent'] > 0) $DATA['emails_sent'] = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($DATA['emails_sent'])."</A>]";
+ $DATA['joined'] = MAKE_DATETIME($DATA['joined'], "0");
+ $DATA['last_update'] = MAKE_DATETIME($DATA['last_update'], "0");
+ $DATA['last_profile_sent'] = MAKE_DATETIME($DATA['last_profile_sent'], "0");
+ $DATA['total'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points"));
+ $DATA['locked'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points"));
+
+ // Nickname inclusion?
if (EXT_IS_ACTIVE("nickname")) {
- if ((empty($DATA[27])) || ($DATA[27] == $uid)) $DATA[27] = "---";
+ // Nickname not set or invalid? Then
+ if ((empty($DATA['nickname'])) || ($DATA['nickname'] == $uid)) $DATA['nickname'] = "---";
} else {
- $DATA[27] = EXT_NICKNAME_404;
+ // Extension not found
+ $DATA['nickname'] = EXT_NICKNAME_404;
}
- // Template laden
+ // Is the user extension newer?
+ if (GET_EXT_VERSION("user") >= "0.3.4") {
+ // Then "translate" the number
+ $DATA['rand_confirmed'] = TRANSLATE_COMMA($DATA['rand_confirmed']);
+ } // END - if
+
+ // Clickrate
+ $DATA['click_rate'] = 0;
+ if ($DATA['emails_received'] > 0) {
+ $DATA['click_rate'] = TRANSLATE_COMMA($DATA['mails_confirmed'] / $DATA['emails_received'] * 100);
+ } // END - if
+
+ // "Translate" more data
+ $DATA['mails_confirmed'] = TRANSLATE_COMMA($DATA['mails_confirmed']);
+ $DATA['emails_received'] = TRANSLATE_COMMA($DATA['emails_received']);
+
+ // Load user-details template
LOAD_TEMPLATE("admin_user_details", false, $uid);
} else {
- // Account does not exists!
+ // Account does not exist!
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$uid.ADMIN_MEMBER_404_2);
}
+
+ // Free the result
+ SQL_FREERESULT($result_user);
} else {
$whereStatement = "";
if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter']))) {
{
// Check if category and number of receivers is okay
$ADD = "";
- if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) $ADD = "AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
+ if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) {
+ // Choose recipients by ZIP code
+ $ADD = " AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
+ } // END - if
// Check for userids
$result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM "._MYSQL_PREFIX."_user_cats AS c
LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
ON c.userid=d.userid
-WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0
-".$ADD."
+WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0".$ADD."
ORDER BY d.%s %s",
array(
bigintval($_POST['cat']),
// Use last online stamp only when autopurge for inactive members is activated
if (($_CONFIG['ap_inactive_since'] > 0) && ($_CONFIG['beg_active'] == "Y")) {
// Okay, include last online timestamp
- $whereStatement1 = sprintf("AND last_online >= (UNIX_TIMESTAMP() - %s)", bigintval($_CONFIG['ap_inactive_since']));;
+ $whereStatement1 = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", bigintval($_CONFIG['ap_inactive_since']));;
$whereStatement2 = bigintval($_CONFIG['beg_ranks']);
} // END - if
} // END - if
// SQL string to check for accounts
$result_main = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points AS points
FROM "._MYSQL_PREFIX."_user_data
-WHERE status='CONFIRMED' ".$whereStatement1." AND beg_points > 0
+WHERE status='CONFIRMED'".$whereStatement1." AND beg_points > 0
ORDER BY beg_points DESC, userid
LIMIT %s",
array($whereStatement2), __FILE__, __LINE__);
);
// Write debug log message
- DEBUG_LOG(__FUNCTION__.":".$msg, true);
+ DEBUG_LOG(__FUNCTION__, __LINE__, "".$msg, true);
// Output message to user and die
if (EXT_IS_ACTIVE("debug")) {
// Non-admin shall not see all menus
if (!IS_ADMIN()) {
- $AND = "AND visible='Y' AND locked='N'";
+ $AND = " AND visible='Y' AND locked='N'";
}
// Load SQL data and add the menu to the output stream...
- $result_main = SQL_QUERY_ESC("SELECT title, action FROM "._MYSQL_PREFIX."_%s_menu WHERE (what='' OR what IS NULL) ".$AND." ORDER BY sort",
+ $result_main = SQL_QUERY_ESC("SELECT title, action FROM "._MYSQL_PREFIX."_%s_menu WHERE (what='' OR what IS NULL)".$AND." ORDER BY sort",
array($MODE), __FILE__, __LINE__);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
}
// Calculate sum (default) or count records of given criteria
-function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") {
+function GET_TOTAL_DATA ($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") {
$ret = 0;
- if ($onlyRows) {
+ if (($onlyRows) || ($lookFor == "userid")) {
// Count rows
- $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s",
- array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'".$add,
+ array($lookFor, $tableName, $whereStatement, $search), __FILE__, __LINE__);
} else {
// Add all rows
- $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s",
- array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'".$add,
+ array($lookFor, $tableName, $whereStatement, $search), __FILE__, __LINE__);
}
// Load row
}
// Run database update
- //DEBUG_LOG(__FUNCTION__.":entries={$entries}");
+ //DEBUG_LOG(__FUNCTION__, __LINE__, "entries={$entries}");
SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET ".$entries." WHERE config=0 LIMIT 1", __FILE__, __LINE__);
// Get affected rows
array(bigintval($uid), $type, $data), __FILE__, __LINE__);
} elseif (is_array($data)) {
// Invalid data!
- DEBUG_LOG(__FUNCTION__."(".__LINE__."): uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!");
+ DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!");
}
}
// Load extensions here
require_once(PATH."inc/load_extensions.php");
-// Check if refid is set
-if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
- // The variable user comes from the click-counter script click.php and we only accept this here
- $GLOBALS['refid'] = bigintval($_GET['user']);
-} elseif (!empty($_POST['refid'])) {
- // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
- $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_POST['refid']));
-} elseif (!empty($_GET['refid'])) {
- // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
- $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['refid']));
-} elseif (!empty($_GET['ref'])) {
- // Set refid=ref (the referal link uses such variable)
- $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['ref']));
-} elseif (isSessionVariableSet('refid')) {
- // Set session refid als global
- $GLOBALS['refid'] = bigintval(get_session('refid'));
-} elseif (GET_EXT_VERSION("sql_patches") != "") {
- // Set default refid as refid in URL
- $GLOBALS['refid'] = bigintval($_CONFIG['def_refid']);
-} else {
- // No default ID when sql_patches is not installed
- $GLOBALS['refid'] = 0;
-}
-
-// Set cookie when default refid > 0
-if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((get_session('refid') == "0") && (isset($_CONFIG['def_refid'])) && ($_CONFIG['def_refid'] > 0))) {
- // Set cookie
- set_session('refid', $GLOBALS['refid']);
-} // END - if
+// Determine and set referal id
+DETERMINE_REFID();
// Transfer userid from session and validate it
if (isset($_SESSION['userid'])) {
switch ($ltype)
{
case "NORMAL":
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks+1 WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
array($url_mid), __FILE__, __LINE__);
// Update mediadata as well
break;
case "BONUS":
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks+1 WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
array($url_bid), __FILE__, __LINE__);
// Update mediadata as well
// Only when user extension = v0.1.2: Update mails-confirmed counter
if (GET_EXT_VERSION("user") >= "0.1.2") {
// Update counter
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed+1 WHERE userid=%s LIMIT 1",
- array($url_uid), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+
+ // Update random confirmed as well?
+ if (GET_EXT_VERSION("user") >= "0.3.4") {
+ // Update second counter
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+ } // END - if
}
// Insert stats record
-<FORM action="{!URL!}/modules.php?module=admin&what=config_refid"
- method="POST">
-<TABLE border="0" cellspacing="0" cellpadding="0" align="center"
- class="admin_table dashed">
+<FORM action="{!URL!}/modules.php?module=admin&what=config_refid" method="POST">
+<TABLE border="0" cellspacing="0" cellpadding="0" align="center" width="450" class="admin_table dashed">
<TR>
- <TD class="admin_title bottom2 seperator" height="30" width="10"> </TD>
- <TD class="admin_title bottom2" colspan="4" align="center"><STRONG>{--EDIT_REGFORM_SETTINGS--}</STRONG>
+ <TD class="admin_title2 bottom2" colspan="2" align="center">
+ <STRONG>{--ADMIN_CONFIG_REFID_TITLE--}</STRONG>
</TD>
- <TD class="admin_title bottom2 seperator" width="10"> </TD>
</TR>
+
+ <TR><TD colspan="2" height="4" class="seperator"> </TD></TR>
+
<TR>
- <TD colspan="6" height="7" class="seperator"> </TD>
- </TR>
- <TR>
- <TD width="10" class="seperator"> </TD>
- <TD align="right" width="200">{--ADMIN_SELECT_DEF_REFID--}:</TD>
- <TD width="10" class="seperator"> </TD>
- <TD colspan="2">
+ <TD align="right" width="200" style="padding-right:5px">{--ADMIN_SELECT_DEF_REFID--}:</TD>
+ <TD align="center">
{!__MEMBER_SELECTION!}
</TD>
- <TD width="10" class="seperator"> </TD>
</TR>
+
+ <TR><TD colspan="2" height="4" class="seperator"> </TD></TR>
+
<TR>
- <TD colspan="6" height="7" class="seperator"> </TD>
+ <TD align="right" width="200" style="padding-right:5px">{--ADMIN_SELECT_REFID_TARGRT--}:</TD>
+ <TD align="center">
+ <SELECT name="refid_target" size="1" class="admin_select">
+ <OPTION value="register"{!__DEF_RT_REGISTER!}">{--ADMIN_REF_TARGET_REGISTER--}</OPTION>
+ <OPTION value="index"{!__DEF_RT_INDEX!}">{--ADMIN_REF_TARGET_INDEX--}</OPTION>
+ </SELECT>
+ </TD>
</TR>
+
+ <TR><TD colspan="2" height="4" class="seperator bottom2"> </TD></TR>
+ <TR><TD colspan="2" height="4" class="seperator"> </TD></TR>
+
<TR>
- <TD width="10" class="seperator"> </TD>
- <TD align="right" width="200">{--ADMIN_SELECT_REFID_TARGRT--}:</TD>
- <TD width="10" class="seperator"> </TD>
- <TD colspan="2"><SELECT name="refid_target" size="1"
- class="admin_select">
- <OPTION value="register"{!__DEF_RT_REGISTER!}">{--ADMIN_REF_TARGET_REGISTER--}</OPTION>
- <OPTION value="index"{!__DEF_RT_INDEX!}">{--ADMIN_REF_TARGET_INDEX--}</OPTION>
- </SELECT></TD>
- <TD width="10" class="seperator"> </TD>
+ <TD align="right" width="200" style="padding-right:5px">{--ADMIN_RANDOM_ZERO_REFID--}:</TD>
+ <TD align="center">
+ <SELECT name="select_user_zero_refid" size="1" class="admin_select">
+ <OPTION value="Y"{!__RAND_REFID_Y!}">{--ADMIN_RAND_REFID_ENABLED--}</OPTION>
+ <OPTION value="N"{!__RAND_REFID_N!}">{--ADMIN_RAND_REFID_DISABLED--}</OPTION>
+ </SELECT>
+ </TD>
</TR>
+
+ <TR><TD colspan="2" height="4" class="seperator"> </TD></TR>
+
<TR>
- <TD colspan="6" height="7" class="seperator bottom2"> </TD>
+ <TD align="right" width="200" style="padding-right:5px">{--ADMIN_RANDOM_MIN_CONFIRMED--}:</TD>
+ <TD align="center">
+ <INPUT type="text" name="user_min_confirmed" class="admin_normal" size="3" maxlength="3" value="$content[user_min_confirmed]" />
+ </TD>
</TR>
+
+ <TR><TD colspan="2" height="4" class="seperator bottom2"> </TD></TR>
+
<TR>
- <TD width="10" class="admin_footer seperator"> </TD>
- <TD class="admin_footer" colspan="4" align="center"><INPUT
- type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
- <INPUT type="submit" name="ok" class="admin_submit"
- value="{--SAVE_SETTINGS--}" /></TD>
- <TD width="10" class="admin_footer seperator"> </TD>
+ <TD class="admin_footer" colspan="2" align="center">
+ <INPUT type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
+ <INPUT type="submit" name="ok" class="admin_submit" value="{--SAVE_SETTINGS--}" />
+ </TD>
</TR>
</TABLE>
-</FORM>
\ No newline at end of file
+</FORM>
</TR>
<TR>
<TD align="center" width="20%" class="top right">{--GENDER--}:<BR />
- <STRONG>$DATA[0]</STRONG></TD>
+ <STRONG>$DATA[gender]</STRONG></TD>
<TD align="center" width="20%" class="top right">{--SURNAME--}:<BR />
- <STRONG>$DATA[1]</STRONG></TD>
+ <STRONG>$DATA[surname]</STRONG></TD>
<TD align="center" width="20%" class="top right">{--FAMILY_NAME--}:<BR />
- <STRONG>$DATA[2]</STRONG></TD>
+ <STRONG>$DATA[family]</STRONG></TD>
<TD align="center" width="20%" class="top right">{--STREET_NR--}:<BR />
- <STRONG>$DATA[3]</STRONG></TD>
+ <STRONG>$DATA[street_nr]</STRONG></TD>
<TD align="center" width="20%" class="top">{--BIRTHDAY2--}:<BR />
<STRONG>{!_BIRTHDAY!}</STRONG></TD>
</TR>
<TR>
<TD align="center" class="top right">{--COUNTRY--}:<BR />
- <STRONG>$DATA[6]</STRONG></TD>
+ <STRONG>$DATA[country]</STRONG></TD>
<TD align="center" class="top right">{--ZIP--}:<BR />
- <STRONG>$DATA[4]</STRONG></TD>
+ <STRONG>$DATA[zip]</STRONG></TD>
<TD align="center" class="top right">{--CITY--}:<BR />
- <STRONG>$DATA[5]</STRONG></TD>
+ <STRONG>$DATA[city]</STRONG></TD>
<TD align="center" class="top right">{--ADDY--}:<BR />
- <STRONG><A href="$DATA[28]">$DATA[7]</A></TD>
+ <STRONG><A href="$DATA[email_link]">$DATA[email]</A></TD>
<TD align="center" class="top">{--ACCOUNT_STATUS--}:<BR />
- <STRONG>$DATA[14]</STRONG></TD>
+ <STRONG>$DATA[status]</STRONG></TD>
</TR>
<TR>
<TD align="center" class="top right">{--RECEIVE_MAILS--}:<BR />
- <STRONG>$DATA[12]</STRONG></TD>
+ <STRONG>$DATA[receive_mails]</STRONG></TD>
<TD align="center" class="top right">{--MAX_PER_DAY--}:<BR />
- <STRONG>$DATA[11]</TD>
+ <STRONG>$DATA[max_mails]</TD>
<TD align="center" class="top right">{--REF_UID--}:<BR />
- <STRONG>$DATA[13]</STRONG></TD>
+ <STRONG>$DATA[refid]</STRONG></TD>
<TD align="center" class="top right">{--REF_CLICKS--}:<BR />
- <STRONG>$DATA[18]</STRONG></TD>
+ <STRONG>$DATA[ref_clicks]</STRONG></TD>
<TD align="center" class="top">{--TOTAL_LOGINS--}:<BR />
- <STRONG>$DATA[19]</STRONG></TD>
+ <STRONG>$DATA[total_logins]</STRONG></TD>
</TR>
<TR>
<TD align="center" class="top right">{--REMOTE_IP--}:<BR />
- <STRONG>$DATA[15]</STRONG></TD>
+ <STRONG>$DATA[REMOTE_ADDR]</STRONG></TD>
<TD align="center" class="top right">{--ADMIN_LAST_ONLINE--}:<BR />
- <STRONG>$DATA[16]</STRONG></TD>
+ <STRONG>$DATA[last_online]</STRONG></TD>
<TD align="center" class="top right">{--ADMIN_LAST_MODULE--}:<BR />
- <STRONG>$DATA[17]</STRONG></TD>
+ <STRONG>$DATA[last_module]</STRONG></TD>
<TD align="center" class="top right">{--HAS_JOINED--}:<BR />
- <STRONG>$DATA[22]</STRONG></TD>
+ <STRONG>$DATA[joined]</STRONG></TD>
<TD align="center" class="top">{--MAILS_SENT--}:<BR />
- <STRONG>$DATA[21]</STRONG></TD>
+ <STRONG>$DATA[emails_sent]</STRONG></TD>
</TR>
<TR>
<TD align="center" class="top right">{--USED_POINTS--}:<BR />
- <STRONG>$DATA[20]</STRONG></TD>
+ <STRONG>$DATA[used_points]</STRONG></TD>
<TD align="center" class="top right">{--TOTAL_POINTS--}:<BR />
<STRONG>$DATA[total]</STRONG></TD>
<TD align="center" class="top right">{--TOTAL_REFERRALS--}:<BR />
<TD align="center" class="top right">{--LOCKED_POINTS--}:<BR />
<STRONG>$DATA[locked]</STRONG></TD>
<TD align="center" class="top right">{--LAST_UPDATE--}:<BR />
- <STRONG>$DATA[23]</STRONG></TD>
+ <STRONG>$DATA[last_update]</STRONG></TD>
<TD align="center" class="top right">{--LAST_PROFILE_SENT--}:<BR />
- <STRONG>$DATA[24]</STRONG></TD>
+ <STRONG>$DATA[last_profile_sent]</STRONG></TD>
<TD align="center" class="top right">{--USER_REF_PAYOUT--}:<BR />
- <STRONG>$DATA[26]</STRONG></TD>
+ <STRONG>$DATA[ref_payout]</STRONG></TD>
<TD align="center" class="top">{--USER_NICKNAME--}:<BR />
- <STRONG>$DATA[27]</STRONG></TD>
+ <STRONG>$DATA[nickname]</STRONG></TD>
+ </TR>
+ <TR>
+ <TD align="center" class="top right">{--CLICK_RATE--}:<BR />
+ <STRONG>$DATA[click_rate]%</STRONG></TD>
+ <TD align="center" class="top right">{--EMAILS_RECEIVED--}:<BR />
+ <STRONG>$DATA[emails_received]</STRONG></TD>
+ <TD align="center" class="top right">{--MAILS_CONFIRMED--}:<BR />
+ <STRONG>$DATA[mails_confirmed]</STRONG></TD>
+ <TD align="center" class="top right">{--RAND_CONFIRMED--}:<BR />
+ <STRONG>$DATA[rand_confirmed]</STRONG></TD>
+ <TD align="center" class="top">{--__UNUSED--}:<BR />
+ <STRONG>---</STRONG></TD>
</TR>
<TR>
<TD align="center" class="admin_footer top" colspan="5">
- {--ADMIN_MEMBER_FUNCTIONS--}:<BR />
+ <STRONG>{--ADMIN_MEMBER_FUNCTIONS--}:</STRONG><BR />
{!_ADMIN_LINKS!}</TD>
</TR>
</TABLE>
\ No newline at end of file
// Free memory
SQL_FREERESULT($result);
}
- exit();
} else {
// Do nothing for now
LOAD_URL (URL."/index.php");
}
-//
+// // END - if
?>