PConnect($DBHOST, $DBUSER, $DBPASSWORD, $DBNAME); @mysql_query("SET NAMES 'UTF8'"); $sql = "SELECT * from config"; $rsc = $conn->Execute($sql); if($rsc){while(!$rsc->EOF) { $field = $rsc->fields['setting']; $config[$field] = $rsc->fields['value']; STemplate::assign($field, strip_mq_gpc($config[$field])); @$rsc->MoveNext(); }} if ($_REQUEST['language'] != "") { if ($_REQUEST['language'] == "english") { SESSION_REGISTER("language"); $_SESSION[language] = "english"; } elseif ($_REQUEST['language'] == "spanish") { SESSION_REGISTER("language"); $_SESSION[language] = "spanish"; } } if ($_SESSION['language'] == "") { SESSION_REGISTER("language"); $_SESSION[language] = "english"; } if ($_SESSION['language'] == "english") { include("lang/english.php"); } elseif ($_SESSION['language'] == "spanish") { include("lang/spanish.php"); } else { include("lang/english.php"); } for ($i=0; $iexecute($sql); setcookie('slrememberme', gzcompress(serialize(array($_SESSION[USERNAME], $key)), 9), time()+60*60*24*30); } function destroy_slrememberme($username) { if (strlen($username) > 0) { global $conn; $sql="update members set remember_me_time=NULL, remember_me_key=NULL WHERE username='".mysql_real_escape_string($username)."'"; $conn->execute($sql); } setcookie ("slrememberme", "", time() - 3600); } if (!isset($_SESSION["USERNAME"]) && isset($_COOKIE['slrememberme'])) { $sql="update members set remember_me_time=NULL and remember_me_key=NULL WHERE remember_me_time<'".date('Y-m-d H:i:s', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")))."'"; $conn->execute($sql); list($username, $key) = @unserialize(gzuncompress(stripslashes($_COOKIE['slrememberme']))); if (strlen($username) > 0 && strlen($key) > 0) { $sql="SELECT * from members WHERE username='".mysql_real_escape_string($username)."' and remember_me_key='$key'"; $rs=$conn->execute($sql); if($rs->recordcount()<1) { $error="Invalid Username/Key."; } elseif($rs->fields['account_status']=="Inactive") { $error = "Your account is currently inactive."; } if($error=="") { SESSION_REGISTER("USERID");$_SESSION[USERID]=$rs->fields['USERID']; SESSION_REGISTER("EMAIL");$_SESSION[EMAIL]=$rs->fields['email']; SESSION_REGISTER("USERNAME");$_SESSION[USERNAME]=$rs->fields['username']; SESSION_REGISTER("VERIFIED");$_SESSION[VERIFIED]=$rs->fields['verified']; create_slrememberme(); } else { destroy_slrememberme($username); } } } ?>