function online user NULL global set time static users if isset users

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
function online($user = NULL){
global $set,$time;
static $users;
if (!isset($users[$user])){
if (mysql_result(mysql_query("SELECT COUNT(id) FROM `user` WHERE `id` = '".$user."' AND `plem`='ogn' AND `online` > '".($_SERVER['REQUEST_TIME']-3600)."' LIMIT 1"),0)==1){
echo "<img src='/images/icon/race/0.png' >";
}
if (mysql_result(mysql_query("SELECT COUNT(id) FROM `user` WHERE `id` = '".$user."' AND `plem`='ogn' AND `online` < '".($_SERVER['REQUEST_TIME']-3600)."' LIMIT 1"),0)==1){
echo "<img style='opacity:0.2;' src='/images/icon/race/0.png' >";
}
if (mysql_result(mysql_query("SELECT COUNT(id) FROM `user` WHERE `id` = '".$user."' AND `plem`='mol' AND `online` > '".($_SERVER['REQUEST_TIME']-3600)."' LIMIT 1"),0)==1){
echo "<img src='/images/icon/race/1.png' >";
}
if (mysql_result(mysql_query("SELECT COUNT(id) FROM `user` WHERE `id` = '".$user."' AND `plem`='mol' AND `online` < '".($_SERVER['REQUEST_TIME']-3600)."' LIMIT 1"),0)==1){
echo "<img style='opacity:0.2;' src='/images/icon/race/1.png' >";
}
}
}
function admin() {
global $user;
if($user['prava'] < 4) header('Location: /');
}
function moder() {
global $user;
if($user['prava'] < 2) header('Location: /');
}
function sozd() {
global $user;
if($user['prava'] < 5) header('Location: /');
}
function page($k_page=1){
$page = 1;
if(isset($_GET['page'])){
if($_GET['page']=='end') $page=intval($k_page);
elseif(is_numeric($_GET['page'])) $page=intval($_GET['page']);
}
if($page < 1) $page = 1;
if($page > $k_page) $page = $k_page;
return $page;
}
function k_page($k_post=0, $k_p_str=10){
if ($k_post!=0){
$v_pages = ceil($k_post/$k_p_str);
return $v_pages;
}
else return 1;
}
function str($link='?', $k_page=1, $page=1){
echo'</div>
<div class="bn-pn">';
if($page < 1) $page = 1;
echo"<div class=\"line\"></div>
<div class=\"foot\">";
if($page!=1) echo "<span class='page'>
<a href=\"".$link."page=1\" title='Первая страница'> &lt;&lt;</a>
</span> ";
if($page!=1) echo "<span class='page'>
<a href=\"".$link."page=1\" title='Страница №1'>1</a>
</span>";
else echo " <span class='act'>1</span>";
for($ot=-4; $ot <= 4; $ot++){
if($page + $ot > 1 && $page + $ot < $k_page){
if($ot==-4 && $page+$ot > 2) echo "<span class='act'> ..</span>";
if($ot!=0)echo " <span class='page'><a href=\"".$link."page=".($page + $ot)."\" title='Страница №".($page + $ot)."'>".($page + $ot)."</a></span>";else echo " <span class='act'><b>".($page + $ot)."</b></span>";
if($ot==4 && $page + $ot < $k_page-1) echo "<span class='act'> ..</span>";
}
}
if($page!=$k_page) echo " <span class='page'><a href=\"".$link."page=end\" title='Страница №".$k_page."'>".$k_page."</a></span>";
elseif ($k_page > 1)echo " <span class='act'>".$k_page."</span> ";
if ($page!=$k_page) echo " <span class='page'><a href=\"".$link."page=end\" title='Последняя страница'>&gt;&gt;</a></span>";
echo '</div>
<div class="line"></div>
<div class="clear"></div>
</div>';
}
function antimat($var){
$var = stripslashes($var);
$filter = array('шлюха','Шлюха','тварь','Тварь','ебля','Ебля','сцука','Сцука','бальник','Бальник','дарас','пида','Пида','гнида','Гнида','мудо','сран','суче','отху','Отху','залупa','Залупa','гонд','Гонд','пидо','Пидо','пизда','Пизда','хер','Хер','едри','падонак','уеб','уёб','Уеб','Уёб','блеадь','блять','Блять','сука','Cука','долбо','долбае','долбаё','пезда','аху','оху','хуя','хуй','Долбо','Долба','Пезда','Бля','Аху','Оху','Хуя','Хуй');
if($user['prava'] < 2){
$var = str_replace($filter, '***', $var);
} else {
$var = str_replace($filter, '<font color=#DF0101>***</font>', $var);
}
return $var;
}
function reg(){
global $user;
if(isset($user['id'])) header('Location: /');
}
function only_reg() {
global $user;
if(!isset($user['id'])) header('Location: /');
}
function ban() {
global $user;
$req = mysql_query("SELECT * from `ban` where `id_us` = '".$user['id']."' and `time`>'".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 3){
header('Location: /moduls/ban');
}
}
function blok() {
global $user;
$req = mysql_query("SELECT * from `ban` where `id_us` = '".$user['id']."' and `time`>'".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 2){
header('Location: /');
$_SESSION['err'] = "Вы находитесь в бане!";
exit;
}
}
function molchan() {
global $user;
$req = mysql_query("SELECT * from `ban` where `id_us` = '".$user['id']."' and `time`>'".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 1){
header('Location: /');
$_SESSION['err'] = "Вы находитесь в бане!";
exit;
}
}
function check($msg) {
$msg = mysql_real_escape_string(htmlspecialchars(stripslashes(trim($msg))));
return $msg;
}
function num($msg) {
$msg = abs(intval($msg));
return $msg;
}
function rez_text($text, $maxwords = 10, $maxchar = 15){
$sep = ' ';
$sep2 = ' &raquo;';
$words = explode($sep,$text);
$char = iconv_strlen($text,'utf-8');
if (count($words) > $maxwords){
$text = join($sep, array_slice($words, 0, $maxwords));
}
if ( $char > $maxchar ){
$text = iconv_substr( $text, 0, $maxchar, 'utf-8' );
}
return $text.$sep2;
}
function vremja($time = NULL){
global $user;
if($time == NULL) $time = $_SERVER['REQUEST_TIME'];
$timep = date("j M Y в H:i", $time);
$ceicn = date("j n Y", $time);
$ceict = date("H:i", $time);
if($ceicn == date("j n Y")) $timep = date("H:i:s", $time);
if(isset($user)){
if($ceicn == date("j n Y", $_SERVER['REQUEST_TIME'])) $timep = date("H:i:s", $time);
if($ceicn == date("j n Y", $_SERVER['REQUEST_TIME']-60*60*24))$timep = "вчера в ".$ceict."";
} else {
if($ceicn == date("j n Y")) $timep = date("H:i:s", $time);
if($ceicn == date("j n Y", $_SERVER['REQUEST_TIME']-60*60*24)) $timep="вчера в ".$ceict."";
}
$timep = str_replace("Jan", "янв", $timep);
$timep = str_replace("Feb", "фев", $timep);
$timep = str_replace("Mar", "марта", $timep);
$timep = str_replace("May", "мая", $timep);
$timep = str_replace("Apr", "апр", $timep);
$timep = str_replace("Jun", "июня", $timep);
$timep = str_replace("Jul", "июля", $timep);
$timep = str_replace("Aug", "авг", $timep);
$timep = str_replace("Sep", "сент", $timep);
$timep = str_replace("Oct", "окт", $timep);
$timep = str_replace("Nov", "ноября", $timep);
$timep = str_replace("Dec", "дек", $timep);
return $timep;
}