Вход Регистрация
Файл: db_connect.php
Строк: 346
<?php
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################

require_once 'set.php';

$HTTP_USER_AGENT htmlentities(addslashes($_SERVER["HTTP_USER_AGENT"]));
$REMOTE_ADDR htmlentities(addslashes($_SERVER["REMOTE_ADDR"]));

if (
$ver == "wml"$divide "---<br/>";
else 
$divide "---<br/>";

$anti $set['anti'];
$SQLlink '';

$ver trim(addslashes(htmlspecialchars($ver)));

$dtd '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">';
$xml '<?xml version="1.0" encoding="UTF-8"?>';


function 
connect_db() {
        
$SQLlink mysql_connect (DBhostDBuserDBpass);
        if (
$SQLlink) {
        if (
mysql_select_db(DBname)) {
        
mysql_query('set charset utf8'); 
        
mysql_query('SET names utf8'); 
        
mysql_query('set character_set_client="utf8"'); 
        
mysql_query('set character_set_connection="utf8"'); 
        
mysql_query('set character_set_result="utf8"');
        return 
$SQLlink;
        } else {
        
show_error('База данных не существует');
        }
        } else {
        
show_error('Потеряна связь с базой данных SQL');
        }
        exit;
}

function 
show_error($err) {
        global 
$dtd$xml;
        if (
$ver == "wml") {
        echo 
$xml;
        echo 
$dtd;
        echo 
'<wml><card id="error" title="Ошибка">
              <do type="prev" label="Back"><prev/></do>
              <p align="center">
               '
.$err.'<br/>
              ---<br/>
               Попробуйте зайти позже.
              </p></card></wml>'
;
        } else {
        echo 
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              
<html xmlns="http://www.w3.org/1999/xhtml">
              <
head><link rel="stylesheet" type="text/css" href="css/css.css"/>
              <
title>Ошибка</title>
              <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
              <
div align="center">
                   
".$err."<br/>
              ---<
br/>
              
Попробуйте зайти позже.
              </
div></body></html>";
        }
}

#### start gzip
if (@extension_loaded('zlib') and @ini_get('zlib.output_compression') != 1 and @ini_get('output_handler') != 'ob_gzhandler') {
$PREFER_DEFLATE = false;
$FORCE_COMPRESSION = false;

function compress_output_gzip(
$output) {
    return gzencode(
$output);
}

function compress_output_deflate(
$output) {
    return gzdeflate(
$output, 9);
}

function compress_output_x_gzip(
$output) {
    return gzcompress(
$output, 9);
}

if (isset(
$_SERVER['HTTP_ACCEPT_ENCODING']))
    
$AE = $_SERVER['HTTP_ACCEPT_ENCODING'];
else
    
$AE = $_SERVER['HTTP_TE'];

$support_gzip = (strpos($AE, 'gzip') !== FALSE) or $FORCE_COMPRESSION;
$support_deflate = (strpos($AE, 'deflate') !== FALSE) or $FORCE_COMPRESSION;
$support_x_gzip = (strpos($AE, 'x-gzip') !== FALSE) or $FORCE_COMPRESSION;


if (
$support_gzip && $support_deflate) {
    
$support_deflate = $PREFER_DEFLATE;
}

if (
$support_deflate) {
header("
Content-Encodingdeflate");
ob_start("
compress_output_deflate");
} else {
if (
$support_gzip) {
header("
Content-Encodinggzip");
ob_start("
compress_output_gzip");
} else {
if (
$support_x_gzip) {
header("
Content-Encodingx_gzip");
ob_start("
compress_output_x_gzip");    
}
else 
{
ob_start();
$config_gzip = 0;
}
}
}
} else {
$config_gzip = 0;
}
##### end gzip

function opsos(
$ips = NULL) {
global 
$user_ip;
if (
$ips == NULL) $ips = $user_ip;
$ipl = ip2long($ips);
if (mysql_result(mysql_query("
SELECT COUNT(*) FROM `opsosWHERE `min` <= '$ipl' AND `max` >= '$ipl'"), 0) != 0) {
$opsos = mysql_fetch_assoc(mysql_query("SELECT opsos FROM `opsosWHERE `min` <= '$ipl' AND `max` >= '$ipl' LIMIT 1"));
return stripcslashes(htmlspecialchars(
$opsos['opsos']));
}
else return false;
}
///////////////////////////////////////////////////////////

mysql_query ("
SELECT SQL_CACHE `klu4FROM `bannlistWHERE (ip '" . $_SERVER['REMOTE_ADDR'] . "') and (soft '" . mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']) . "'LIMIT 1;");

if ((mysql_affected_rows() != 0) and (
$row["level"] < 7)) {
    if (
$ver == "wml") {
        echo 
$xml;
        echo 
$dtd;
        echo "
<wml>n
              
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
              
<card id="ban" title="Стоп!" ontimer="index.php?ref=$ref"><timer value="300"/>n
              
<p align="center">n";
    } else {
        echo "
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <
html xmlns="http://www.w3.org/1999/xhtml">
              <
head><link rel="stylesheet" type="text/css" href="css/css.css"/>
              <
title>Стоп!</title>
              <
META HTTP-EQUIV="Refresh" CONTENT="30; URL=index.php?ref=$ref">
              <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
              <
div align="center">";
    }
    
    echo 
$fsize1;
    echo 'Твой IP+SOFT в черном списке!<br/>';
    echo 
$fsize2;
    include_once "
foot.php";
    exit;
}

function getmicrotime()
{
    list(
$usec$sec) = explode(" ", microtime());
    return ((float)
$usec + (float)$sec);
}

function filtr(
$a){
$text1 = array("rn", "n");
$text2 = array("   ", "   ");
$a = trim(htmlspecialchars(stripslashes(str_replace($text1$text2$a))));
return 
$a;
}

function rus_to_k(
$str) {
                
$str = str_replace("а","a",$str);
                
$str = str_replace("б","b",$str);
                
$str = str_replace("в","v",$str);
                
$str = str_replace("г","g",$str);
                
$str = str_replace("д","d",$str);
                
$str = str_replace("е","e",$str);
                
$str = str_replace("ё","e",$str);
                
$str = str_replace("ж","j",$str);
                
$str = str_replace("з","z",$str);
                
$str = str_replace("и","i",$str);
                
$str = str_replace("й","y",$str);
                
$str = str_replace("к","k",$str);
                
$str = str_replace("л","l",$str);
                
$str = str_replace("м","m",$str);
                
$str = str_replace("н","n",$str);
                
$str = str_replace("о","o",$str);
                
$str = str_replace("п","p",$str);
                
$str = str_replace("р","r",$str);
                
$str = str_replace("с","s",$str);
                
$str = str_replace("т","t",$str);
                
$str = str_replace("у","u",$str);
                
$str = str_replace("ф","f",$str);
                
$str = str_replace("х","h",$str);
                
$str = str_replace("ч","c",$str);
                
$str = str_replace("ц","q",$str);
                
$str = str_replace("ш","w",$str);
                
$str = str_replace("щ",">",$str);
                
$str = str_replace("ь","<",$str);
                
$str = str_replace("ы","x",$str);
                
$str = str_replace("ъ",".",$str);
                
$str = str_replace("э",":",$str);
                
$str = str_replace("ю",";",$str);
                
$str = str_replace("я","}",$str);
                
$str = str_replace("А","a",$str);
                
$str = str_replace("Б","b",$str);
                
$str = str_replace("В","v",$str);
                
$str = str_replace("Г","g",$str);
                
$str = str_replace("Д","d",$str);
                
$str = str_replace("Е","e",$str);
                
$str = str_replace("Ё","e",$str);
                
$str = str_replace("Ж","j",$str);
                
$str = str_replace("З","z",$str);
                
$str = str_replace("И","i",$str);
                
$str = str_replace("Й","y",$str);
                
$str = str_replace("К","k",$str);
                
$str = str_replace("Л","l",$str);
                
$str = str_replace("М","m",$str);
                
$str = str_replace("Н","n",$str);
                
$str = str_replace("О","o",$str);
                
$str = str_replace("П","p",$str);
                
$str = str_replace("Р","r",$str);
                
$str = str_replace("С","s",$str);
                
$str = str_replace("Т","t",$str);
                
$str = str_replace("У","u",$str);
                
$str = str_replace("Ф","f",$str);
                
$str = str_replace("Х","h",$str);
                
$str = str_replace("Ч","c",$str);
                
$str = str_replace("Ц","q",$str);
                
$str = str_replace("Ш","w",$str);
                
$str = str_replace("Щ",">",$str);
                
$str = str_replace("Ь","<",$str);
                
$str = str_replace("Ы","x",$str);
                
$str = str_replace("Ъ",".",$str);
                
$str = str_replace("Э",":",$str);
                
$str = str_replace("Ю",";",$str);
                
$str = str_replace("Я","}",$str);
                return 
$str;
                }

function win_to_utf(
$str) { 

if (function_exists('mb_convert_encoding')) return mb_convert_encoding(
$str, 'utf-8', 'windows-1251');
if (function_exists('iconv')) return iconv('windows-1251', 'utf-8', 
$str);

$win1251utf8 = array( 
"
xC0"=>"А","xC1"=>"Б","xC2"=>"В","xC3"=>"Г","xC4"=>"Д","xC5"=>"Е","xA8"=>"Ё","xC6"=>"Ж","xC7"=>"З","xC8"=>"И","xC9"=>"Й","xCA"=>"К","xCB"=>"Л","xCC"=>"М",
"
xCD"=>"Н","xCE"=>"О","xCF"=>"П","xD0"=>"Р","xD1"=>"С","xD2"=>"Т","xD3"=>"У","xD4"=>"Ф","xD5"=>"Х","xD6"=>"Ц","xD7"=>"Ч","xD8"=>"Ш","xD9"=>"Щ","xDA"=>"Ъ",
"
xDB"=>"Ы","xDC"=>"Ь","xDD"=>"Э","xDE"=>"Ю","xDF"=>"Я","xE0"=>"а","xE1"=>"б","xE2"=>"в","xE3"=>"г","xE4"=>"д","xE5"=>"е","xB8"=>"ё","xE6"=>"ж","xE7"=>"з",
"
xE8"=>"и","xE9"=>"й","xEA"=>"к","xEB"=>"л","xEC"=>"м","xED"=>"н","xEE"=>"о","xEF"=>"п","xF0"=>"р","xF1"=>"с","xF2"=>"т","xF3"=>"у","xF4"=>"ф","xF5"=>"х",
"
xF6"=>"ц","xF7"=>"ч","xF8"=>"ш","xF9"=>"щ","xFA"=>"ъ","xFB"=>"ы","xFC"=>"ь","xFD"=>"э","xFE"=>"ю","xFF"=>"я"); 

return strtr(
$str$win1251utf8); 


function utf_to_win(
$str) { 

if (function_exists('mb_convert_encoding')) return mb_convert_encoding(
$str, 'windows-1251', 'utf-8');
if (function_exists('iconv')) return iconv('utf-8', 'windows-1251', 
$str);

$utf8win1251 = array( 
"
А"=>"xC0","Б"=>"xC1","В"=>"xC2","Г"=>"xC3","Д"=>"xC4","Е"=>"xC5","Ё"=>"xA8","Ж"=>"xC6","З"=>"xC7","И"=>"xC8","Й"=>"xC9","К"=>"xCA","Л"=>"xCB","М"=>"xCC",
"
Н"=>"xCD","О"=>"xCE","П"=>"xCF","Р"=>"xD0","С"=>"xD1","Т"=>"xD2","У"=>"xD3","Ф"=>"xD4","Х"=>"xD5","Ц"=>"xD6","Ч"=>"xD7","Ш"=>"xD8","Щ"=>"xD9","Ъ"=>"xDA",
"
Ы"=>"xDB","Ь"=>"xDC","Э"=>"xDD","Ю"=>"xDE","Я"=>"xDF","а"=>"xE0","б"=>"xE1","в"=>"xE2","г"=>"xE3","д"=>"xE4","е"=>"xE5","ё"=>"xB8","ж"=>"xE6","з"=>"xE7",
"
и"=>"xE8","й"=>"xE9","к"=>"xEA","л"=>"xEB","м"=>"xEC","н"=>"xED","о"=>"xEE","п"=>"xEF","р"=>"xF0","с"=>"xF1","т"=>"xF2","у"=>"xF3","ф"=>"xF4","х"=>"xF5",
"
ц"=>"xF6","ч"=>"xF7","ш"=>"xF8","щ"=>"xF9","ъ"=>"xFA","ы"=>"xFB","ь"=>"xFC","э"=>"xFD","ю"=>"xFE","я"=>"xFF"); 

return strtr(
$str$utf8win1251); 


function trun_to_rus(
$str) {
$str = str_replace("ch","ч",$str);
$str = str_replace("sc","щ",$str);
$str = str_replace("sh","ш",$str);
$str = str_replace("ye","э",$str);
$str = str_replace("yu","ю",$str);
$str = str_replace("ya","я",$str);
$str = str_replace("CH","Ч",$str);
$str = str_replace("Ch","Ч",$str);
$str = str_replace("SC","Щ",$str);
$str = str_replace("Sc","Щ",$str);
$str = str_replace("SH","Ш",$str);
$str = str_replace("Sh","Ш",$str);
$str = str_replace("&quot;&quot;","Ъ",$str);
$str = str_replace("&quot;","ъ",$str);
$str = str_replace("&#8216;&#8216;","Ь",$str);
$str str_replace("&#8216;","ь",$str);
$str str_replace("YE","Э",$str);
$str str_replace("Ye","Э",$str);
$str str_replace("YU","Ю",$str);
$str str_replace("Yu","Ю",$str);
$str str_replace("YA","Я",$str);
$str str_replace("Ya","Я",$str);
$str strtr($str,array("""=>"","a"=>"а","b"=>"б","v"=>"в","g"=>"г","d"=>"д","e"=>"е","j"=>"ж","z"=>"з","i"=>"и","y"=>"й","k"=>"к","l"=>"л","m"=>"м","n"=>"н","o"=>"о","p"=>"п","r"=>"р","s"=>"с","t"=>"т","u"=>"у","f"=>"ф","h"=>"х","c"=>"ц","w"=>"ш","x"=>"ы","A"=>"А","B"=>"Б","V"=>"В","G"=>"Г","D"=>"Д","E"=>"Е","J"=>"Ж","Z"=>"З","I"=>"И","Y"=>"Й","K"=>"К","L"=>"Л","M"=>"М","N"=>"Н","O"=>"О","P"=>"П","R"=>"Р","S"=>"С","T"=>"Т","U"=>"У","F"=>"Ф","H"=>"Х","C"=>"Ц","W"=>"Ш","X"=>"Ы"));
return 
$str;
}

function check(
$message) {
$message = htmlspecialchars($message);
$message = str_replace("rn", "<br/>", $message);
$message = strtr($message, array(chr("0") => "", chr("1") => "", chr("2") => "", chr("3") => "", chr("4") => "", chr("5") => "", chr("6") => "", chr("7") => "", chr("8") => "", chr("9") => "", chr("10") => "", chr("11") => "", chr("12") => "", chr
        ("
13") => "", chr("14") => "", chr("15") => "", chr("16") => "", chr("17") => "", chr("18") => "", chr("19") => "", chr("20") => "", chr("21") => "", chr("22") => "", chr("23") => "", chr("24") => "", chr("25") => "", chr("26") => "", chr("27") =>
        "", chr("
28") => "", chr("29") => "", chr("30") => "", chr("31") => ""));
$message = iconv('utf-8', 'windows-1251', $message);
$message = mb_substr($message, 0, 1000, 'UTF8');
$message = iconv('windows-1251', 'utf-8', $message);
$message = str_replace("'","&#39;",$message);
$message = str_replace(""","&#34;",$message);
$message = str_replace("$","&#36;",$message);
$message = str_replace("$","&#36;",$message);
$message = str_replace("\","&#92;", $message);
$message = str_replace("`","&#96;", $message);
$message = str_replace("^","&#94;", $message);
$message = str_replace("%","&#37;", $message);
$message = str_replace(":","&#58;",$message);
$message = preg_replace("|&#58;|",":",$message,3);
$message = stripslashes(trim($message));
return $message;
}

function replace_rus($str) {
                $str = str_replace("а","|",$str);
                $str = str_replace("б","|",$str);
                $str = str_replace("в","|",$str);
                $str = str_replace("г","|",$str);
                $str = str_replace("д","|",$str);
                $str = str_replace("е","|",$str);
                $str = str_replace("ё","|",$str);
                $str = str_replace("ж","|",$str);
                $str = str_replace("з","|",$str);
                $str = str_replace("и","|",$str);
                $str = str_replace("й","|",$str);
                $str = str_replace("к","|",$str);
                $str = str_replace("л","|",$str);
                $str = str_replace("м","|",$str);
                $str = str_replace("н","|",$str);
                $str = str_replace("о","|",$str);
                $str = str_replace("п","|",$str);
                $str = str_replace("р","|",$str);
                $str = str_replace("с","|",$str);
                $str = str_replace("т","|",$str);
                $str = str_replace("у","|",$str);
                $str = str_replace("ф","|",$str);
                $str = str_replace("х","|",$str);
                $str = str_replace("ч","|",$str);
                $str = str_replace("ц","|",$str);
                $str = str_replace("ш","|",$str);
                $str = str_replace("щ","|",$str);
                $str = str_replace("ь","|",$str);
                $str = str_replace("ы","|",$str);
                $str = str_replace("ъ","|",$str);
                $str = str_replace("э","|",$str);
                $str = str_replace("ю","|",$str);
                $str = str_replace("я","|",$str);
                $str = str_replace("А","|",$str);
                $str = str_replace("Б","|",$str);
                $str = str_replace("В","|",$str);
                $str = str_replace("Г","|",$str);
                $str = str_replace("Д","|",$str);
                $str = str_replace("Е","|",$str);
                $str = str_replace("Ё","|",$str);
                $str = str_replace("Ж","|",$str);
                $str = str_replace("З","|",$str);
                $str = str_replace("?","|",$str);
                $str = str_replace("Й","|",$str);
                $str = str_replace("К","|",$str);
                $str = str_replace("Л","|",$str);
                $str = str_replace("М","|",$str);
                $str = str_replace("Н","|",$str);
                $str = str_replace("О","|",$str);
                $str = str_replace("П","|",$str);
                $str = str_replace("Р","|",$str);
                $str = str_replace("С","|",$str);
                $str = str_replace("Т","|",$str);
                $str = str_replace("У","|",$str);
                $str = str_replace("Ф","|",$str);
                $str = str_replace("Х","|",$str);
                $str = str_replace("Ч","|",$str);
                $str = str_replace("Ц","|",$str);
                $str = str_replace("Ш","|",$str);
                $str = str_replace("Щ","|",$str);
                $str = str_replace("Ь","|",$str);
                $str = str_replace("Ы","|",$str);
                $str = str_replace("Ъ","|",$str);
                $str = str_replace("Э","|",$str);
                $str = str_replace("Ю","|",$str);
                $str = str_replace("Я","|",$str);
                return $str;
                }

function role_to_tpadej($role) {
                switch ($role) {
                case "обыватель" : $trole = "обывателем";
                break;
                case "комиссар катани" : $trole = "инспектором катани";
                break;
                case "главарь мафии" : $trole = "главарем мафии";
                break;
                case "доктор" : $trole = "доктором";
                break;
                case "маньяк" : $trole = "маньяком";
                break;
                case "путана" : $trole = "путаной";
                break;
                case "бомж" : $trole = "бомжом";
                break;
                case "мафиози" : $trole = "мафиози";
                break;
                case "горец" : $trole = "горцем";
                break;
                case "жена комиссара" : $trole = "женой комиссара";
                break;
                case "клоун" : $trole = "клоуном";
                break;
                default : $trole = $role;
                break;
                }
                return ($trole);
                }

function role_to_rpadej($role) {
                switch ($role) {
                case "обыватель" : $rrole = "обывателя";
                break;
                case "комиссар катани" : $rrole = "комиссара катани";
                break;
                case "главарь мафии" : $rrole = "главаря мафии";
                break;
                case "доктор" : $rrole = "доктора";
                break;
                case "маньяк" : $rrole = "маньяка";
                break;
                case "путана" : $rrole = "путану";
                break;
                case "бомж" : $rrole = "бомжа";
                break;
                case "мафиози" : $rrole = "мафиози";
                break;
                case "горец" : $rrole = "горца";
                break;
                case "жена комиссара" : $rrole = "жены комиссара";
                break;
                case "клоун" : $rrole = "клоуна";
                break;
                default: $rrole = $role;
                break;
                }
                return($rrole);
                }

function get_name_by_id($id_in_game, $rm) {
                $ringame = "ingame" . $rm;
                $req = mysql_query("select * from $ringame WHERE id_in_game = '".
$id_in_game."'");
                $ms = mysql_fetch_array($req);
                $gamer_id = $ms['
gamer_id'];
                $req = mysql_query("select * from users WHERE id = '".
$gamer_id."'");
                $ms = mysql_fetch_array($req);
                $name = $ms['
user'];
                unset($gamer_id);
                unset($ms);
                unset($req);
                return($name);
                }

function get_role_by_id($id_in_game, $rm) {
                $ringame = "ingame" . $rm;
                $req = mysql_query("select * from $ringame WHERE id_in_game = '".
$id_in_game."'");
                $ms = mysql_fetch_array($req);
                $role = $ms['
role'];
                unset($ms);
                unset($req);
                return($role);
                }

function scores($rm) {
                $rscores = "scores" . $rm;
                $r = mysql_query("select * from $rscores");
                $mmes = "";
                while (($a = mysql_fetch_array($r)) !== false) {
                $gamer_id = $a['
gamer_id'];
                $score = $a['
score'];
                mysql_query("update users set mafcredits = mafcredits + creditsingame, gposts = gposts + creditsingame WHERE id = '".
$gamer_id."'");
                $re = mysql_query("select user from users WHERE id = '".
$gamer_id."'");
                $b = mysql_fetch_array($re);
                $mmes = $mmes.$b['
user']." - <b>".$score."</b>, ";
                }
                $mmes = substr($mmes,0,strlen($mmes)-2);
                return($mmes);
                }
                
function check_login($link) {
        global $ver, $rm, $us, $sid, $trun, $id, $ps, $ref, $url;
        $ref = rand(10000, 1000000);
        $_SESSION['
us'] = $us;
        $_SESSION['
id'] = $id;
        $_SESSION['
ps'] = $ps;
        $_SESSION['
ver'] = $ver;
        $_SESSION['
url'] = $url;

        if (isset($_SESSION['
us'])) { $us = mysql_real_escape_string($_SESSION['us']); }
        if (isset($_SESSION['
id'])) { $id = mysql_real_escape_string($_SESSION['id']); }
        if (isset($_SESSION['
ps'])) { $ps = mysql_real_escape_string($_SESSION['ps']); }
        if (isset($_GET['
ver'])) { $ver = mysql_real_escape_string($_GET['ver']); }
        if (isset($_GET['
url'])) { $url = mysql_real_escape_string($_GET['url']); }
        if (isset($us)) { 
        $us = trim($us);
        if ($us == '') {
        $bad_login = 1;
        }
        }
        if (isset($id)) {
        if (!ctype_digit($id)) { header("Location: index.php"); die; }
        $result = mysql_query ("Select * from users where id='".
$id."' LIMIT 1;");
        } else {
        if (!ctype_digit($us)) {
        if ($_POST['
trun'] == 1) { $us = trun_to_rus($us); }
        $latuser = strtolower($us);
        $ruser = rus_to_k($us);
        if ($ruser == $us) {
        $result = mysql_query ("Select * from users where latuser = '".
$latuser."' LIMIT 1;");
        } else {
        $result = mysql_query ("Select * from users where ruser = '".
$ruser."' LIMIT 1;");
        }
        } else {
        $result = mysql_query ("Select * from users where id = '".
$us."' LIMIT 1;");
        }
        if (mysql_affected_rows() == 0) { $bad_login = 1; }
        }
        $row = mysql_fetch_array ($result);
        if (!isset($id)) { $id = $row['
id']; }
        $passw = md5($ps);
        if ($passw !== $row['
pass']) { $bad_login = 1; }

if (!empty($bad_login)) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
      <card id="error" title="Ошибка авторизации!" ontimer="index.php?"><timer value="20"/>n
      <p align="center">";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head><link rel="stylesheet" type="text/css" href="css/css.css"/>
      <title>Ошибка авторизации!</title>
      <META HTTP-EQUIV="Refresh" CONTENT="2; URL=index.php?"/>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <div align="center">";
}
echo '
<div class="c4">Ошибка авторизации!</div><br/>';
if ($bad_login == 1) echo '
Данные сессии неопoзнаныпопробуй заново пройти авторизацию!<br/>';
include_once '
foot.php';
unset($_SESSION['
id']);
session_unregister('
id');
unset($_SESSION['
us']);
session_unregister('
us');
unset($_SESSION['
ps']);
session_unregister('
ps');
unset($_SESSION['
ver']);
session_unregister('
ver');
mysql_close($link);
exit;
}

if ($row['
fsize'] == "verysmall") { $fsize1 = "<small><small>"; $fsize2 = "</small></small>"; }
elseif ($row['
fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif ($row['
fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ''; $fsize2 = ''; }

if (($row['
banned'] == 1) and ($row['level'] < 7)) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
      <card id="error" title="Стоп!" ontimer="index.php?ver=$ver&amp;ref=$ref"><timer value="20"/>
      <p align="center">";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
      <title>Стоп!</title>
      <META HTTP-EQUIV="Refresh" CONTENT="2; URL=index.php?ver=$ver&amp;ref=$ref">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <div align="center">";
}
echo $fsize1;
echo '
Этот ник забанен!<br/>';
echo $fsize2;
unset($_SESSION['
id']);
session_unregister('
id');
unset($_SESSION['
us']);
session_unregister('
us');
unset($_SESSION['
ps']);
session_unregister('
ps');
unset($_SESSION['
ver']);
session_unregister('
ver');
unset($_SESSION['
url']);
session_unregister('
url');
mysql_close($link);
if ($ver == "wml") echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close($link);
exit;
}

$user = $row['
user'];
$syst = mysql_query ("Select user from users where id='
1' LIMIT 1;");
$rr = mysql_fetch_array ($syst);
$adm = $rr['
user'];

if (($row['
posts'] >= 1000) and ($row['level'] < 1)) {
$levelselect = mysql_query ("Select name from levels where level=1");
$levels = mysql_fetch_array($levelselect);
$levelname = $levels['
name'];
$row["level"] = 1;
$row["status"] = $levelname;
mysql_query ("UPDATE `users` SET `status` = '".
$row['status']."', `level` = '".$row['level']."' WHERE `id` = '".$id."';");
$data = date("d-M-Y [H:i]");
$kolw = rand(0,99999999);
$time = time();
$message = "Поздравляю <b>".$user."</b>!!! Тобой набрано необходимое количество постов и <b>".$adm."</b> тебе присвоила уровень <b>".$levelname."</b>.";
mysql_query("Insert into zapiski set klu4='".
$kolw."', who ='".$adm."', idwho ='1', message = '".$message."', towhom = '".$user."', idtowhom = '".$id."', time = '".$time."', readd = '0', topic = 'Поздравление!!!', date='".$data."'");
}

if (($row['
posts'] >= 3000) and ($row['level'] < 2)) {
$levelselect = mysql_query ("Select name from levels where level=2");
$levels = mysql_fetch_array($levelselect);
$levelname = $levels['
name'];
$row['
level'] = 2;
$row['
status'] = $levelname;
mysql_query ("UPDATE `users` SET `status` = '".
$row['status']."', `level` = '".$row['level']."' WHERE `id` = '".$id."';");
$data = date("d-M-Y [H:i]");
$kolw = rand(0,99999999);
$time = time();
$message = "Поздравляю <b>".$user."</b>!!! Тобой набрано необходимое количество постов и <b>".$adm."</b> тебе присвоила уровень <b>".$levelname."</b>.";
mysql_query("Insert into zapiski set klu4='".
$kolw."', who ='".$adm."', idwho ='1', message = '".$message."', towhom = '".$user."', idtowhom = '".$id."', time = '".$time."', readd = '0', topic = 'Поздравление!!!', date='".$data."'");
}

if (($row["posts"] >= 7000) and ($row['
level'] < 3)) {
$levelselect = mysql_query ("Select name from levels where level=3");
$levels = mysql_fetch_array($levelselect);
$levelname = $levels['
name'];
$row['
level'] = 3;
$row['
status'] = $levelname;
mysql_query ("UPDATE `users` SET `status` = '".
$row['status']."', `level` = '".$row['level']."' WHERE `id` = '".$id."';");
$data = date("d-M-Y [H:i]");
$kolw = rand(0,99999999);
$time = time();
$message = "Поздравляю <b>".$user."</b>!!! Тобой набрано необходимое количество постов и <b>".$adm."</b> тебе присвоила уровень <b>".$levelname."</b>.";
mysql_query("Insert into zapiski set klu4='".
$kolw."', who ='".$adm."', idwho ='1', message = '".$message."', towhom = '".$user."', idtowhom = '".$id."', time = '".$time."', readd = '0', topic = 'Поздравление!!!', date='".$data."'");
}
return array($row, $id, $ps, $fsize1, $fsize2);
}

?>
Онлайн: 1
Реклама