Файл: wapxl.ru/shaxty/user_old.php
Строк: 414
<?
// Функция пинка
function spamer($sp_m=NULL, $p_t=NULL)
{
global $db, $user,$user_id, $ver, $name, $set, $sid, $realtime, $gzib_pro, $div1, $div00, $div9;
if(isset($sp_m)) $sp_m=check($sp_m);
if(isset($p_t)) $p_t=check($p_t);
$ba= core:: $db -> query("SELECT * FROM `spamer` WHERE `user_id`=? AND `code`=? LIMIT 1;", array($user_id, 1));
$ban = $ba -> fetch();
if ($ban > 0) {
echo '<div align="center">';
if(!isset($_POST['kod'])){
echo "<b>Вы привысили лимит активности!</b><br />Подтвердите, что вы не робот<br /> Введите код с картинки в поле ниже";
echo '<form action="?'.$_SERVER['QUERY_STRING'].'" method="post" enctype="multipart/form-data">';
echo '<img src="/shaxty_code.php?r='.rand(1000, 9999).'" alt="Проверочный код"/><br />';
echo '<b>Код с картинки:</b><br/><input type="text" size="5" maxlength="5" name="kod"/><br />';
echo '<br /><input type="submit" class="ibutton" value="Подтвердить"/></form><br /><br />';
}else{
$reg_kod = isset($_POST['kod']) ? check($_POST['kod']) : '';
// Проверка кода CAPTCHA
$err = 0;
if (empty($reg_kod) || strlen2($reg_kod) < 4){$err = 1;}
if ($reg_kod != $_SESSION['code']){$err = 1;}
if($err != 0){
header("Location: ?".$_SERVER['QUERY_STRING']);
}else{
mysql_query("DELETE FROM `spamer` WHERE `user_id` = '$user[id]'");
header("Location: ?".$_SERVER['QUERY_STRING']);
}
}
echo "</div>";
echo '<br />';
include_once (H.'/shaxty/foot.php');
exit();
}
}
// Функция пинка
function spamer_on($sp_m=NULL, $p_t=NULL)
{
global $db, $user,$user_id, $ver, $name, $set, $sid, $realtime, $gzib_pro, $div1, $div00, $div9;
if(isset($sp_m)) $sp_m=check($sp_m);
if(isset($p_t)) $p_t=check($p_t);
mysql_query ("INSERT INTO spamer (user_id,spam_m,post_time,code) VALUES ('".$user['id']."','".$sp_m."','".$p_t."','1')");
}
function GradientLetter($text, $from='', $to='', $mode = 'hex') {
$text = iconv("UTF-8", "windows-1251", $text);
if ($mode == 'hex') {
$to = hexdec($to['0'].$to['1']).','.hexdec($to['2'].$to['3']).','.hexdec($to['4'].$to['5']);
$from = hexdec($from['0'].$from['1']).",".hexdec($from['2'].$from['3']).",".hexdec($from['4'].$from['5']);
}
if (empty($text)) return null; else $levels = strlen($text);
if (empty($from)) $from = array(0, 0, 255); else $from = explode(',', $from);
if (empty($to)) $to = array(255, 0, 0); else $to = explode(',', $to); $output = null;
for ($i = 1; $i <= $levels; $i++) {
for ($ii = 0; $ii < 3; $ii++) {
$tmp[$ii] = $from[$ii] - $to[$ii];
$tmp[$ii] = floor($tmp[$ii] / $levels);
$rgb[$ii] = $from[$ii] - ($tmp[$ii] * $i);
if ($rgb[$ii] > 255) $rgb[$ii] = 255;
$rgb[$ii] = dechex($rgb[$ii]);
$rgb[$ii] = strtoupper($rgb[$ii]);
if (strlen($rgb[$ii]) < 2) $rgb[$ii] = '0'.$rgb[$ii];
}
$output .= '<span style="color: #'.$rgb['0'].$rgb['1'].$rgb['2'].'">'.$text[$i-1].'</span>';
}
return iconv("windows-1251", "UTF-8", $output);
}
// Функция пинка
function kiks($w=NULL)
{
global $db, $user,$user_id, $ver, $name, $set, $sid, $realtime, $gzib_pro, $div1, $div00, $div9;
if(isset($w)) $w=check($w);
$ba= core:: $db -> query("SELECT * FROM `kik_users` WHERE `user_id`=? AND `ban_time`>? LIMIT 1;", array($user_id, $realtime));
$ban = $ba -> fetch();
if ($ban > 0) {
echo '<b>'.$user['user'].'</b>, Вы не можете писать на форуме,в приват, осталять комментарии и т.д., так как <b>вы выпнуты</b> на <b>'.kikt($ban['ban_time']).'</b><br />Причина: <b>'.$ban['ban_reason'].'</b><br />';
echo '<br />';
include_once (H.'shaxty/foot.php');
}
}
function check_login($link = NULL) {
/*global $db, $user_id;
$req= core:: $db -> query("SELECT * FROM `users` WHERE `id`=? LIMIT 1;", array($user_id));
$user = $req -> fetch();
if ($user == 0){
if ($link==NULL)$link='/nous.php?';
header("Location: $link".SID);exit;
}*/
}
function colornick( $nick , $colornick)
{
$arr = explode('::',$colornick);
$count = mb_strlen( $nick, 'UTF-8' );
for( $i = 0, $return = ''; $i < $count; $i++ )
{
$s++;
$return .= '<span style="color:#' . $arr[$s] . ';">' . mb_substr( $nick, $i, 1, 'UTF-8' ) . '</span>';
}
return $return ;
}
function nik($ref=NULL,$link=NULL)
{
global $db, $user, $usid, $name, $set, $sid, $nk, $user_system, $user_umnik, $user_fluder, $realtime,$mafiozi;
$ref=check($ref);
if ($ref==$user_system || $ref==$mafiozi || $ref==$user_fluder || $ref==$user_umnik){
if ($link==NULL)return $ref;
else return '<a href="'.H2.''.$link.'">'.$ref.'</a> ';
}
if($ref=== '01')return $user_system;
if($ref=== '02')return $user_umnik;
if($ref=== '03')return $user_fluder;
if (!ctype_digit($ref)) {
$ruser = rus_lat(rus_utf_tolower($ref));
$result= core:: $db -> query("SELECT * FROM `users` WHERE `ruser`=? LIMIT 1;", array($ruser));
} else {
$result= core:: $db -> query("SELECT * FROM `users` WHERE `id`=? LIMIT 1;", array($ref));
}
$nik = $result -> fetch();
if (!isset($nik['id']))return '[Удален]';
//if (!isset($user))$realtime = (time()+$set['timesdvig']*60*60);
//else if ($user['poias']!='') $realtime = ((time()-3*60*60)+$user['poias']*60);
if ($nik['onl'] >= ($realtime - $set['time_aut']))
{
if ($nik['xstatus']==1) $on_off='<img src="/img/online/gotov_boltat.png" alt="" />';
else if ($nik['xstatus']==2) $on_off='<img src="/img/online/zaniat.png" alt="" />';
else if ($nik['xstatus']==3) $on_off='<img src="/img/online/boleu.png" alt="" />';
else if ($nik['xstatus']==4) $on_off='<img src="/img/online/depressia.png" alt="" />';
else if ($nik['xstatus']==5) $on_off='<img src="/img/online/dumau.png" alt="" />';
else if ($nik['xstatus']==6) $on_off='<img src="/img/online/kuru.png" alt="" />';
else if ($nik['xstatus']==7) $on_off='<img src="/img/online/kushau.png" alt="" />';
else if ($nik['xstatus']==8) $on_off='<img src="/img/online/love.png" alt="" />';
else if ($nik['xstatus']==9) $on_off='<img src="/img/online/tv.png" alt="" />';
else if ($nik['xstatus']==10) $on_off='<img src="/img/online/music.png" alt="" />';
else if ($nik['xstatus']==11) $on_off='<img src="/img/online/vanna.png" alt="" />';
else if ($nik['xstatus']==12) $on_off='<img src="/img/online/tualet.png" alt="" />';
else if ($nik['xstatus']==13) $on_off='<img src="/img/online/sex.png" alt="" />';
else if ($nik['xstatus']==14) $on_off='<img src="/img/online/igrau.png" alt="" />';
else if ($nik['xstatus']==15) $on_off='<img src="/img/online/pivo.png" alt="" />';
else if ($nik['xstatus']==16) $on_off='<img src="/img/online/sonni.png" alt="" />';
else if ($nik['xstatus']==0){
if ($nik['sex']==1) $on_off='<img src="/img/online/man_on.gif" alt=""/>';
else if ($nik['sex']==0) $on_off='<img src="/img/online/woman_on.gif" alt="" />';
else $on_off='<img src="/img/online/on.gif" alt="" />';
}
}else{
if ($nik['sex']==1) $on_off='<img src="/img/online/man_off.gif" alt="" />';
else if ($nik['sex']==0) $on_off='<img src="/img/online/woman_off.gif" alt="" />';
else $on_off='<img src="/img/online/off.gif" alt="" />';
}
$color_nik = $nik['color_nik'];
$name = $nik['user'];
////////////////
if ($nik['color_nik'] == 1) $name = GradientLetter($name, 'F90000', '00FF00');
elseif ($nik['color_nik'] == 2) $name = GradientLetter($name, 'FF0000', '000000');
elseif ($nik['color_nik'] == 3) $name = GradientLetter($name, 'EEE467', '384267');
elseif ($nik['color_nik'] == 4) $name = GradientLetter($name, 'F7FF0D', '1E49E6');
elseif ($nik['color_nik'] == 5) $name = GradientLetter($name, '000000', '00FF00');
elseif ($nik['color_nik'] == 6) $name = GradientLetter($name, 'EF33ED', 'EFCAF1');
elseif ($nik['color_nik'] == 7) $name = GradientLetter($name, '030303', '96A0A4');
elseif ($nik['color_nik'] == 8) $name = GradientLetter($name, '000000', 'DDE4DA');
elseif ($nik['color_nik'] == 9) $name = GradientLetter($name, '000000', '0000FF');
elseif ($nik['color_nik'] == 10) $name = GradientLetter($name, 'FF0000', 'A80AEA');
elseif ($nik['color_nik'] == 11) $name = GradientLetter($name, '0000FF', '0ADFEC');
elseif ($nik['color_nik'] == 12) $name = GradientLetter($name, 'FCD05B', 'E665F9');
elseif ($nik['color_nik'] == 13) $name = GradientLetter($name, '4ECF0F', 'FAB600');
elseif ($nik['color_nik'] == 14) $name = GradientLetter($name, 'ff50ed', 'ff1900');
elseif ($nik['color_nik'] == 15) $name = GradientLetter($name, '3e00f8', '002468');
//////////////
if ($nik['effnik']==1) $name = '<blink>'.$name.'</blink>';
if ($nik['color_nik']!='')$name = '<font color="#'.$nik['color_nik'].'">'.$name.'</font>';
if ($nik['color_nik']==''&&$nik['colornick']!='')$name = colornick($name,$nik['colornick']);
//if ($link==NULL)$link= $nik['id'];
if($nik['adres']!='')$adres = $nik['adres'];
else $adres = $nik['ruser'];
if ($link==NULL)$link="".H.$adres.'';
if ($user['pic_stat']==0){
return '<a href="'.H2.''.$link.'">'.$name.'</a>';
}else if ($user['pic_stat']==1){
return '<a href="'.H2.''.$link.'">'.$name.'</a> <a href="'.H2.'info/xstatus?nk='.$nik['id'].'">'.$on_off.'</a> ';
}else if ($user['pic_stat']==2){
if ($nik['onl'] >= ($realtime - $set['time_aut']))
{
return '<a href="'.H2.''.$link.'">'.$name.'</a> <span style="color:#00AE00">[on]</span>';
}else{
return '<a href="'.H2.''.$link.'">'.$name.'</a> <span style="color:#DD0000">[off]</span>';
}
}
}
function user($ref=NULL,$link=NULL)
{
global $db, $user, $usid, $name, $set, $sid,$realtime,$user_system, $user_umnik, $user_fluder;
$ref=check($ref);
if ($ref==$user_system || $ref==$mafiozi || $ref==$user_fluder || $ref==$user_umnik){
if ($link==NULL)return $ref;
else return '<a href="'.H2.''.$link.'">'.$ref.'</a> ';
}
if($ref=== '01')return $user_system;
if($ref=== '02')return $user_umnik;
if($ref=== '03')return $user_fluder;
if (!ctype_digit($ref)) {
$ruser = rus_lat(rus_utf_tolower($ref));
$result= core:: $db -> query("SELECT * FROM `users` WHERE `ruser`=? LIMIT 1;", array($ruser));
} else {
$result= core:: $db -> query("SELECT * FROM `users` WHERE `id`=? LIMIT 1;", array($ref));
}
$nik = $result -> fetch();
if (!isset($nik['id']))return '[Удален]';
if ($link==NULL)return $nik['user'];
else if ($link==1) return '<a href="'.H2.$nik['id'].'">'.$nik['user'].'</a>';
}
if($user['id']==1 && $user['level']<9)mysql_query("UPDATE `users` SET `level` = '9' WHERE `id` = '1'");
function user_inf($ref=NULL,$w=NULL)
{
global $db, $user, $ver, $rm, $usid, $name, $set, $sid,$realtime;
if(isset($ref)) $ref=check($ref);
if (!ctype_digit($ref)) {
$ruser = rus_lat(rus_utf_tolower($ref));
$result= core:: $db -> query("SELECT * FROM `users` WHERE `ruser`=? LIMIT 1;", array($ruser));
} else {
$result= core:: $db -> query("SELECT * FROM `users` WHERE `id`=? LIMIT 1;", array($ref));
}
$nik = $result -> fetch();
if ($w==NULL)return $nik['id'];
else return $nik[$w];
}
function friends($f1=NULL,$f2=NULL,$w=NULL)
{
global $db, $user, $ver, $rm, $usid, $name, $set, $sid,$realtime;
if(isset($f1)) $f1=check($f1);
if(isset($f2)) $f2=check($f2);
if(isset($w)) $w=check($w);
//$f = mysql_fetch_array(mysql_query("Select * from friends WHERE `user_id` = '$f2' and `fr_id` = '$f1' and yes = '1'"));
$result= core:: $db -> query("SELECT * FROM `friends` WHERE `user_id`=? and `fr_id`=? and `yes`=? LIMIT 1;", array($f2, $f1, 1));
$f = $result -> fetch();
if ($w==NULL){
if ($f1!=$f2){
if (isset($f['id']))return '1';
else return '0';
}else{
return '1';
}
}else{
if (isset($f['id']))return $f[$w];
}
}
function ignor($f1=NULL,$f2=NULL,$w=NULL)
{
global $db, $user, $ver, $rm, $usid, $name, $set, $sid,$realtime;
if(isset($f1)) $f1=check($f1);
if(isset($f2)) $f2=check($f2);
if(isset($w)) $w=check($w);
$f = mysql_fetch_array(mysql_query("Select * from ignor WHERE `user_id` = '$f1' and `ig_id` = '$f2'"));
if ($w==NULL){
if ($f1!=$f2){
if (isset($f['id']))return '1';
else return '0';
}else{
return '0';
}
}else{
if (isset($f['id']))return $f[$w];
}
}
function levels($levels=0,$link = NULL) // только для тех, у кого уровень доступа больше или равен $level
{
global $db, $user;
if (!isset($user) || $user['level']<$levels)
{
if ($link==NULL)$link='/index.php';
header("Location: $link");exit;
}
}
?>