global $DATA, $FATAL;
// Initialize data
-$probe_nickname = false; $UID = false; $hash = "";
+$probe_nickname = false; $uid = false; $hash = "";
unset($login); unset($online);
if ((!empty($GLOBALS['userid'])) && (isSessionVariableSet('u_hash')))
{
// Already logged in?
- $UID = $GLOBALS['userid'];
+ $uid = $GLOBALS['userid'];
} elseif ((!empty($_POST['id'])) && (!empty($_POST['password'])) && (isset($_POST['ok']))) {
// Set userid and crypt password when login data was submitted
$probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($_POST['id'])."") != $_POST['id']));
if ($probe_nickname)
{
// Nickname entered
- $UID = SQL_ESCAPE($_POST['id']);
+ $uid = SQL_ESCAPE($_POST['id']);
} else {
// Direct userid entered
- $UID = bigintval($_POST['id']);
+ $uid = bigintval($_POST['id']);
}
} elseif (!empty($_POST['new_pass'])) {
// New password requested
- $UID = "0";
- if (!empty($_POST['id'])) $UID = $_POST['id'];
+ $uid = 0;
+ if (!empty($_POST['id'])) $uid = $_POST['id'];
} else {
// Not logged in
- $UID = "0"; $hash = "";
+ $uid = 0; $hash = "";
}
$URL = ""; $ADD = "";
if ($probe_nickname) {
// Nickname entered
$result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' AND status='CONFIRMED' LIMIT 1",
- array($UID), __FILE__, __LINE__);
- list($UID2, $password, $online, $login) = SQL_FETCHROW($result);
- if (!empty($UID2)) $UID = $UID2;
+ array($uid), __FILE__, __LINE__);
+ list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
+ if (!empty($uid2)) $uid = $uid2;
} else {
// Direct userid entered
$result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
- array(bigintval($UID), $hash), __FILE__, __LINE__);
+ array(bigintval($uid), $hash), __FILE__, __LINE__);
list($dmy, $password, $online, $login) = SQL_FETCHROW($result);
}
if (SQL_NUMROWS($result) == 1) {
// ... and update database
$result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET password='%s' WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
- array($hash, $UID), __FILE__, __LINE__);
+ array($hash, $uid), __FILE__, __LINE__);
// No login bonus by default
$BONUS = false;
$hash = generatePassString($hash);
// Update cookies
- $login = (set_session("userid" , $UID , $life, COOKIE_PATH)
+ $login = (set_session("userid" , $uid , $life, COOKIE_PATH)
&& set_session("u_hash" , $hash, $life, COOKIE_PATH)
&& set_session("lifetime", $l , $life, COOKIE_PATH));
// Update global array
- $GLOBALS['userid'] = bigintval($UID);
+ $GLOBALS['userid'] = bigintval($uid);
} else {
// Check for login data
$login = IS_MEMBER();
if ($login) {
// Update database records
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET total_logins=total_logins+1".$ADD." WHERE userid=%s LIMIT 1",
- array(bigintval($UID)), __FILE__, __LINE__);
+ array(bigintval($uid)), __FILE__, __LINE__);
if (SQL_AFFECTEDROWS() == 1) {
// Procedure to checking for login data
if (($BONUS) && (EXT_IS_ACTIVE("bonus"))) {
} else {
// Other account status?
$result = SQL_QUERY_ESC("SELECT status FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array(bigintval($UID)), __FILE__, __LINE__);
+ array(bigintval($uid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1)
{
// Load status
$URL = URL."/modules.php?module=".$GLOBALS['module']."&what=login&login=".$ERROR;
}
}
- elseif ((!empty($_POST['new_pass'])) && (isset($UID)))
+ elseif ((!empty($_POST['new_pass'])) && (isset($uid)))
{
// Compile email when found in address (only secure chars!)
if (!empty($_POST['email'])) $_POST['email'] = str_replace("{DOT}", '.', $_POST['email']);
// Set ID number when left empty
- if (empty($_POST['id'])) $_POST['id'] = "0";
+ if (empty($_POST['id'])) $_POST['id'] = 0;
// Probe userid/nickname
$probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($_POST['id'])."") != $_POST['id']));
{
// Nickname entered
$result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' OR email='%s' LIMIT 1",
- array(addslashes($UID), $_POST['email']), __FILE__, __LINE__);
+ array(addslashes($uid), $_POST['email']), __FILE__, __LINE__);
}
else
{
// Direct userid entered
$result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s OR email='%s' LIMIT 1",
- array(bigintval($UID), $_POST['email']), __FILE__, __LINE__);
+ array(bigintval($uid), $_POST['email']), __FILE__, __LINE__);
}
if (SQL_NUMROWS($result) == 1)
{
// This data is valid, so we create a new pass... :-)
- list($UID, $status) = SQL_FETCHROW($result);
+ list($uid, $status) = SQL_FETCHROW($result);
if ($status == "CONFIRMED")
{
// Ooppps, this was missing! ;-) We should update the database...
$NEW_PASS = GEN_PASS();
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET password='%s' WHERE userid=%s LIMIT 1",
- array(generateHash($NEW_PASS), bigintval($UID)), __FILE__, __LINE__);
+ array(generateHash($NEW_PASS), bigintval($uid)), __FILE__, __LINE__);
// Prepare data and message for email
- $DATA = array($NEW_PASS, getenv('REMOTE_ADDR'));
- $msg = LOAD_EMAIL_TEMPLATE("new-pass", "", bigintval($UID));
+ $msg = LOAD_EMAIL_TEMPLATE("new-pass", array('new_pass' => $NEW_PASS), bigintval($uid));
// ... and send it away
- SEND_EMAIL(bigintval($UID), GUEST_NEW_PASSWORD, $msg);
+ SEND_EMAIL(bigintval($uid), GUEST_NEW_PASSWORD, $msg);
// Output note to user
LOAD_TEMPLATE("admin_settings_saved", false, GUEST_NEW_PASSWORD_SEND);