}
 $sql->result = $sql->execute_query($query, 'user_profile.php', 0);
 $sql->total_query++;
 if ($sql->count_rows() > 0) {
     $row = $sql->fetch_row();
     $CP['login_id'] = $row["account_id"];
     $CP['login_name'] = get_username($row["account_id"]);
     $CP['login_sex'] = $row["sex"];
     $CP['login_mail'] = $row["email"];
     if (empty($CP['login_id'])) {
         if ($CONFIG_save_type == 1) {
             session_unregister(loginname);
             session_unregister(loginpass);
         } else {
             CP_removeCookie("loginname");
             CP_removeCookie("loginpass");
         }
         header("index.php?act=login");
     }
     if (checkprivilege($CP['login_id']) == 1) {
         $sql->execute_query("INSERT INTO {$CONFIG_sql_cpdbname}.privilege (account_id,privilege) VALUES (\"" . $CP['login_id'] . "\",'2')", 'user_profile.php');
     }
     $CP['login_nname'] = $CP['login_name'];
     $CP['login_logout'] = "<img height=\"1\" width=\"10\"><a href=\"index.php?act=logout\" title=\"Log Out\"><font class=\"m_title\">{$lang['Logout']}</font></a>";
     $query = "SELECT display_name,user_time_offset FROM {$CONFIG_sql_cpdbname}.user_profile WHERE user_id = \"" . $CP['login_id'] . "\"";
     $sql->result = $sql->execute_query($query, 'user_profile.php');
     $sql->total_query++;
     if (!$sql->count_rows()) {
         $sql->execute_query("INSERT INTO {$CONFIG_sql_cpdbname}.user_profile (user_id,display_name,user_time_offset,user_avatar,user_avatar_width,user_avatar_height,user_joined) VALUES (\"" . $CP['login_id'] . "\",\"" . $CP['login_nname'] . "\",\"" . $CONFIG_time_offset . "\",\"\",0,0,\"" . $CP['time'] . "\")", 'user_profile.php');
         $sql->total_query++;
     } else {
Example #2
0
<?php 
if (!$SERVER['system_safe']) {
    exit;
}
if ($CONFIG_save_type == 1) {
    cookie_remove(1);
    session_start();
    session_register("loginname");
    session_register("loginpass");
    session_register("userlang");
    session_register("usertheme");
}
getglobalvar(2);
if (empty($STORED_userlang)) {
    $STORED['LANG'] = $CONFIG_language;
} else {
    $dir = "lang/" . $STORED_userlang . ".php";
    if (is_file($dir)) {
        $STORED['LANG'] = $STORED_userlang;
    } else {
        if ($CONFIG_save_type == 1) {
            session_unregister(userlang);
        } else {
            CP_removeCookie("userlang");
        }
        $STORED['LANG'] = $CONFIG_language;
    }
}
include_once "lang/{$STORED['LANG']}.php";
include_once "theme.php";
$IMG['ARROW'] = "<IMG src=\"" . $url_safe . "theme/{$STORED['THEME']}/menu/arrow_quickmenu.gif\" width=\"3\" height=\"5\" hspace=\"5\" border=\"0\">";
Example #3
0
//   _____          /___/        __  ___                __
//  / ___/__  ___  / /________  / / / _ \___ ____  ___ / /
// / /__/ _ \/ _ \/ __/ __/ _ \/ / / ___/ _ `/ _ \/ -_) / 
// \___/\___/_//_/\__/_/  \___/_/ /_/   \_,_/_//_/\__/_/ 
// =========================================================================
// Copyright (c) Stargames Control Panel - Licensed under GNU GPL.
// See LICENSE File
// =========================================================================
// Project Lead by: Mysterious
// =========================================================================
-->
<?php 
if (!$SERVER['system_safe']) {
    exit;
}
if (empty($STORED_usertheme)) {
    $STORED['THEME'] = $CONFIG_default_theme;
} else {
    $dir = "theme/{$STORED_usertheme}";
    if (is_dir($dir)) {
        $STORED['THEME'] = $STORED_usertheme;
    } else {
        if ($CONFIG_save_type == 1) {
            session_unregister(usertheme);
        } else {
            CP_removeCookie("usertheme");
        }
        $STORED['THEME'] = $CONFIG_default_theme;
    }
}
include_once "theme/{$STORED['THEME']}/theme.php";
Example #4
0
function do_blacklist($state, $blacklist_code)
{
    switch ($state) {
        case 1:
            CP_setCookie("IP_Blacklist", $blacklist_code);
            header("location:pageerr.php?code=01");
            break;
        case 2:
            $sql = new MySQL();
            global $CONFIG_sql_cpdbname;
            $sql->execute_query("DELETE FROM {$CONFIG_sql_cpdbname}.memory WHERE memory_object=\"ip_blacklist\" AND memory_value3=\"" . mysql_res($blacklist_code) . "\"", 'function.php');
            CP_removeCookie("IP_Blacklist");
            break;
        case 3:
            header("location:pageerr.php?code=01");
            break;
        case 4:
            CP_removeCookie("IP_Blacklist");
            break;
    }
    return true;
}
Example #5
0
/**
 * sets cookie if value is different from current cokkie value,
 * or removes if value is equal to default
 *
 * @uses    isHttps()
 * @uses    getCookiePath()
 * @uses    $_COOKIE
 * @uses    CP_removeCookie()
 * @uses    setcookie()
 * @uses    time()
 * @param   string  $cookie     name of cookie to remove
 * @param   mixed   $value      new cookie value
 * @param   string  $default    default value
 * @param   int     $validity   validity of cookie in seconds (default is one month)
 * @param   bool    $httponlt   whether cookie is only for HTTP (and not for scripts)
 * @return  boolean result of setcookie()
 */
function CP_setCookie($cookie, $value, $default = null, $validity = null, $httponly = true)
{
    if ($validity == null) {
        $validity = 2592000;
    }
    if (strlen($value) && null !== $default && $value === $default && isset($_COOKIE[$cookie])) {
        // remove cookie, default value is used
        return CP_removeCookie($cookie);
    }
    if (!strlen($value) && isset($_COOKIE[$cookie])) {
        // remove cookie, value is empty
        return CP_removeCookie($cookie);
    }
    if (!isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
        // set cookie with new value
        /* Calculate cookie validity */
        if ($validity == 0) {
            $v = 0;
        } else {
            $v = time() + $validity;
        }
        /* Use native support for httponly cookies if available */
        if (version_compare(PHP_VERSION, '5.2.0', 'ge')) {
            return setcookie($cookie, $value, $v, getCookiePath(), '', isHttps(), $httponly);
        } else {
            return setcookie($cookie, $value, $v, getCookiePath() . ($httponly ? '; HttpOnly' : ''), '', isHttps());
        }
    }
    // cookie has already $value as value
    return true;
}