prefered_language; $notifyEmail = $row->notify_email; $notifyNewUsers = $row->notify_newusers; // ======================================= Session & Login ============================== session_start(); $error_number=0; $remoteAddress=getenv ("REMOTE_ADDR"); if (isset($_SESSION['s_ipaddress'])==true) { //IP address is set - continuing a session - check if valid access if ($_SESSION['s_ipaddress']!=$remoteAddress) { header ("Location: 505.html"); exit; } } else { //new session - bind IP address to this session $_SESSION['s_ipaddress']=$remoteAddress; } //process login actions $login_interface = (isset($_GET['login_interface'])==true) ? true : false; if (isset($_GET['action'])==true) { switch ($_GET['action']) { //if action=logoff destroy session case 'logoff': session_unset(); session_destroy(); session_start(); $_SESSION['s_ipaddress']=$remoteAddress; break; //if action=login check user data case 'login': $i_user_loginname=strMakeSafe($_POST['i_user_loginname']); $i_user_loginpasswd=strMakeSafe($_POST['i_user_loginpasswd']); $result=sql_query("select user_id from tab_users where login_name='$i_user_loginname' AND deleted=0 AND login_passwd=MD5('$i_user_loginpasswd')",$db); if (mysql_num_rows($result)>=1) { //successfull login session_unset(); $tmp=mysql_fetch_row ($result); $userId=$tmp[0]; $_SESSION['s_userid']=$userId; $_SESSION['s_ipaddress']=$remoteAddress; $_SESSION['s_loginname']=$i_user_loginname; //log access information $result=sql_query("insert into tab_login values ($userId,'$remoteAddress',now())",$db); } else { $error_number=1; $login_interface=true; } break; //language selection case 'setlanguage': $language=$_GET['value']; $_SESSION['s_language']=$language; break; } } // ======================================= User ======================================== $userLoginName=""; $userIsLoggedin=false; $userIsAdmin=false; if (isset($_SESSION['s_loginname'])==true) { $userLoginName=$_SESSION['s_loginname']; $userId=$_SESSION['s_userid']; $userIsLoggedin=true; $result=sql_query("select golden_user,discount_percent,prefered_language from tab_users where user_id='$userId'",$db); $tmp=mysql_fetch_row ($result); if ($tmp[0]==1) $userIsAdmin=true; $userDiscount=$tmp[1]/100; $language=$tmp[2]; } // ======================================= Language ==================================== if (isset($_SESSION['s_language'])==true) { $language=$_SESSION['s_language']; } else { $_SESSION['s_language']=$language; } //'language' is now final $result=sql_query("select abbr from tab_language where language_id='$language'",$db); $tmp=mysql_fetch_row ($result); $languageAbbr=$tmp[0]; // ======================================= Currency ==================================== $result=sql_query("select currency_id, abbr from tab_currency;",$db); $currencyArray=array(); while ($row = mysql_fetch_object ($result)) { array_push ($currencyArray, array("currency_id" => $row->currency_id, "abbr" => $row->abbr)); } $currency=$currencyArray[0]["currency_id"]; $currencyAbbr=$currencyArray[0]["abbr"]; ?>
Vincent interier

Užívatel: | Odhlásit se