2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 11/26/2003 *
\r
4 * =============== Last change: 02/27/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : chk_login.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Check if user has logged in (delay) *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Pruefen ob die Login-Cookies gesetzt sind *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
41 OPEN_TABLE("500", "guest_login_header dashed", "center");
\r
43 OUTPUT_HTML ("<BR><STRONG>".VALIDATING_LOGIN."</STRONG><BR>");
\r
45 if (!empty($GLOBALS['userid']) && !empty($_COOKIE['u_hash']) && !empty($_COOKIE['lifetime']))
\r
47 // Get theme from profile
\r
48 $result = SQL_QUERY_ESC("SELECT curr_theme FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
\r
49 array($GLOBALS['userid']), __FILE__, __LINE__);
\r
50 list($NewTheme) = SQL_FETCHROW($result);
\r
51 SQL_FREERESULT($result);
\r
53 // Change to new theme
\r
54 @setcookie("mxchange_theme", $NewTheme, (time() + 60*60*24*365), COOKIE_PATH);
\r
55 $_COOKIE['mxchange_theme'] = $NewTheme;
\r
58 if ((GET_EXT_VERSION("sql_patches") >= "0.2.8") && (GET_EXT_VERSION("bonus") >= "0.2.1"))
\r
60 // Update last login
\r
61 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data
\r
62 SET last_login=UNIX_TIMESTAMP()
\r
63 WHERE userid=%d AND last_login < (UNIX_TIMESTAMP() - %d)
\r
64 LIMIT 1", array($GLOBALS['userid'], $CONFIG['login_timeout']),
\r
65 __FILE__, __LINE__);
\r
66 if (SQL_AFFECTEDROWS($link) == 1) $bonus = true;
\r
68 if (($bonus) && ($_GET['mode'] == "bonus") && (EXT_IS_ACTIVE("bonus"))) {
\r
69 // Output message with added points
\r
70 OUTPUT_HTML("<FONT class=\"tiny\">
\r
71 ".BONUS_LOGIN_BONUS_ADDED_1."
\r
72 <STRONG>".TRANSLATE_COMMA($CONFIG['login_bonus'])." ".POINTS."</STRONG>
\r
73 ".BONUS_LOGIN_BONUS_ADDED_2."
\r
76 elseif (EXT_IS_ACTIVE("bonus"))
\r
78 // No login bonus added!
\r
79 OUTPUT_HTML("<FONT class=\"member_failed\">".BONUS_LOGIN_BONUS_NOT_ADDED."</FONT>");
\r
82 // Redirect to member area
\r
83 LOAD_TEMPLATE("member_login_js");
\r
88 LOAD_TEMPLATE("login_failed_js");
\r