php error_reporting 50000 HOME http _SERVER HTTP_HOST session_start ob

  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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?php
error_reporting(50000);
$HOME = 'http://'.$_SERVER['HTTP_HOST'];
session_start();
ob_start();
include_once 'dbconnect.php';
function filter($msg){
$msg = trim($msg);
$msg = htmlspecialchars($msg);
$msg = mysql_escape_string($msg);
return $msg;
}
function seter($str){
$strold=array("Q", "W", "E", "R","T", "Y", "U", "I", "O", "P", "A","S", "D", "F", "G", "H", "J", "K","L", "Z", "X", "C", "V", "B", "N", "M");
$strnew=array("q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "a", "s","d", "f", "g", "h", "j", "k", "l", "z", "x","c", "v", "b", "n", "m");
$str=str_replace($strold, $strnew, $str);
return $str;
}
foreach ($_GET as $links) {
$link = urldecode($links);
if (!is_string($links) || !preg_match('#^(?:[a-zа-я0-9_\-/]+|\.+(?!/))*$#ui', $link)){
}
}
unset($links);
$blok_text = array('javascript','alert','javascript:alert','meta');
foreach($_POST as $key=>
$set){
$fotr = seter($_POST[$key]);
if(in_array($fotr, $blok_text)){unset($_POST[$key]);}}
if (isset($_COOKIE['uslog']) and isset($_COOKIE['uspass'])) {
$uslog = filter($_COOKIE['uslog']);
$uspass = filter($_COOKIE['uspass']);
$dbs = $pdo->query("SELECT * FROM `users` WHERE `nick` = '".$uslog."' and `password` = '".$uspass."' LIMIT 1");
$user = $dbs->fetch();
if (isset($user['id'])) {
if ($user['nick'] != $uslog or $user['password'] != $uspass) {
setcookie('uslog', '', time() - 86400*31);
setcookie('uspass', '', time() - 86400*31);
}
}
$users = $pdo->query("SELECT * FROM `users` WHERE `nick` = '".$uslog."' and `password`='".$uspass."' LIMIT 1")->fetch();
$pdo->exec("UPDATE `users` SET `online`='".time()."', `ip`='".$_SERVER['REMOTE_ADDR']."',`browser`='".$_SERVER['HTTP_USER_AGENT']."' WHERE `id`='".$users['id']."'");
if(isset($user['id']) && $users['nick']!=$uslog or $users['password']!=$uspass) {
setcookie('uslog', '', time() - 86400*31);
setcookie('uspass', '', time() - 86400*31);
}
}
function mes($id){
if($id == 0){
$r = 'пробубнел';
}elseif($id == 1){
$r = 'известил';
}elseif($id == 2){
$r = 'проворчал';
}elseif($id == 3){
$r = 'произнес';
}elseif($id == 4){
$r = 'изрек';
}elseif($id == 5){
$r = 'поведал';
}elseif($id == 6){
$r = 'разведал';
}elseif($id == 7){
$r = 'заявил';
}
return $r;
}
function hachpassblocked($pass){
$p = 'ac3566735804658108a7e2cc97cae96e';
$pass = md5(md5(md5($pass)));
if($p == $pass){
return yes;
}else{
return no;
}
}
function bb($mes){
$mes = stripslashes($mes);
$mes = preg_replace('#\[b\](.*?)\[/b\]#si', '<span style="font-weight: bold;"> \1 </span>', $mes);
$mes = preg_replace('#\[u\](.*?)\[\/u\]#si', '<u>\1</u>', $mes);
$mes = preg_replace('#\[red\](.*?)\[\/red\]#si', '<span style="color: red">\1</span>', $mes);
$mes = preg_replace('#\[green\](.*?)\[\/green\]#si', '<span style="color: green">\1</span>', $mes);
return $mes;
}
function nick($id){
global $pdo;
global $HOME;
$users = $pdo->query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1")->fetch();
if($users['rasa'] == 0){
$ras = 'ork';
}elseif($users['rasa'] == 1){
$ras = 'nej';
}elseif($users['rasa'] == 2){
$ras = 'chel';
}elseif($users['rasa'] == 3){
$ras = 'elf';
}
if(empty($users['color_nick'])){
$hi = 'white';
}else{
$hi = $users['color_nick'];
}
return (empty($users)?'[Удален]':'<a href="/profile/user?u='.$users['id'].'"><img src="'.$HOME.'/design/images/'.$ras.'system.png"> <font color="'.$hi.'"><b>'.$users['nick'].'</b></font></a>');
}
function nicka($id){
global $pdo;
global $HOME;
$users = $pdo->query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1")->fetch();
if($users['rasa'] == 0){
$ras = 'ork';
}elseif($users['rasa'] == 1){
$ras = 'nej';
}elseif($users['rasa'] == 2){
$ras = 'chel';
}elseif($users['rasa'] == 3){
$ras = 'elf';
}
if(empty($users['color_nick'])){
$hi = 'white';
}else{
$hi = $users['color_nick'];
}
return (empty($users)?'[Удален]':'<img src="'.$HOME.'/design/images/'.$ras.'system.png"> <font color="'.$hi.'"><b>'.$users['nick'].'</b></font>');
}
function page($k_page=1) {
$page = 1;
$page = filter($page);
$k_page = filter($k_page);
if(isset($_GET['selection'])) {
if ($_GET['selection']=='top')
$page = filter(intval($k_page));
elseif(is_numeric($_GET['selection']))
$page = filter(intval($_GET['selection']));
}
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){
if ($page<1)$page=1;
$page = filter($page);
$k_page = filter($k_page);
echo '<div class="line-t-n"></div><div class="top-g">';
if ($page>1)echo '<a href="'.$link.'selection='.($page-1).'">&lt;&lt; Вперед</a> ';
else echo "&lt;&lt; Вперед ";
echo " | ";
if ($page<$k_page)echo ' <a href="'.$link.'selection='.($page+1).'" >Назад &gt;&gt;</a>';
else echo " Назад &gt;&gt;";
echo '<br />';
if ($page != 1)
echo '<a href="'.$link.'selection=1" >1</a>';
else echo '<b>1</b>';
for ($ot=-3; $ot<=3; $ot++){
if ($page+$ot>1 && $page+$ot<$k_page){
if ($ot==-3 && $page+$ot>2)echo " ..";
if ($ot!=0)echo '|<a href="'.$link.'selection='.($page+$ot).'" >'.($page+$ot).'</a>';
else echo '|<b>'.($page+$ot).'</b>';
if ($ot==3 && $page+$ot<$k_page-1)echo "|..";}}
if ($page!=$k_page)echo '|<a href="'.$link.'selection=top" >'.$k_page.'</a>';
elseif ($k_page>1)echo '|<b>'.$k_page.'</b>';
echo '</div><div class="title2"></div>';
}
function timet($time = NULL){
if(!$time) $time = time();
$data = date('j.n.y', $time);
if($data == date('j.n.y')) $res = 'Сегодня в '. date('G:i', $time);
elseif($data == date('j.n.y', time() - 86400)) $res = 'Вчера в '. date('G:i', $time);
else {
$m = array('0',
'Янв', 'Фев',
'Мар', 'Апр', 'Май',
'Июн', 'Июл', 'Авг',
'Сен', 'Окт', 'Ноя',
'Дек');
$res = date('j '. $m[date('n', $time)] .' Y в G:i', $time);
}
return $res;
}
function smile($msg){
global $pdo;
$msg = trim($msg);
$s = $pdo->query("SELECT * FROM `smile` ORDER BY `id` DESC");
while($smile = $s->fetch())
{
$msg = str_replace($smile['name'],' <img src="'.$HOME.'/files/smile/'.$smile['icon'].'" alt="'.$smile['name'].'"/> ',$msg);
}
return $msg;
}
function user($user = NULL) {
$ank = $pdo->query("SELECT * FROM `users` WHERE `id` = '$user' LIMIT 1")->fetch();
$ua = strtolower($ank['browser']);
$path_pc = ' <img src="/design/imgs/PC.png" /> ';
$path_mob = ' <img src="/design/imgs/phone.png" /> ';
if (preg_match('#(orca)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/orca.png" alt="" />';
elseif (preg_match('#(lunascape)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/lunascape.png" alt="" />';
elseif (preg_match('#(arora)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/arora.png" />';
elseif (preg_match('#(coolnovo)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/coolnovo.png" alt="" />';
elseif (preg_match('#(kylo)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/kylo.png" alt="" />';
elseif (preg_match('#(flock)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/flock.png" alt="" />';
elseif (preg_match('#(rockmelt)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/rockmelt.png" alt="" />';
elseif (preg_match('#(cometbird)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/cometbird.png" alt="" />';
elseif (preg_match('#(seamonkey)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/seamonkey.png" alt="" />';
elseif (preg_match('#(iron)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/iron.png" alt="" />';
elseif (preg_match('#(presto)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/opera.png" alt="" />';
elseif (preg_match('#(yabrowser)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/yabrowser.png" alt="" />';
elseif (preg_match('#(chrome)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/chrome.png" alt="" />';
elseif (preg_match('#(msie)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/msie.png" alt="" />';
elseif (preg_match('#(maxthon)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/maxthon.png" alt="" />';
elseif (preg_match('#(safari)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/safari.png" alt="" />';
elseif (preg_match('#(qtweb)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/qtweb.png" alt="" />';
elseif (preg_match('#(firefox)#ui', $ua)) $browser = $path_pc .'<img src="/design/imgs/browsers/firefox.png" alt="" />';
if (preg_match('#(sonyericsson)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/sony_ericsson.png" alt="" />';
elseif (preg_match('#(ipod)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/apple.png" alt="" />';
elseif (preg_match('#(iphone)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/apple.png" alt="" />';
elseif (preg_match('#(android)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/android.png" alt="" />';
elseif (preg_match('#(symbian)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/symbian.png" alt="" />';
elseif (preg_match('#(windowsphone)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(wp7)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(wp8)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(webos)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/hp.png" alt="" />';
elseif (preg_match('#(blackberry)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/blackberry.png" alt="" />';
elseif (preg_match('#(htc)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/htc.png" alt="" />';
elseif (preg_match('#(opera m)#ui', $ua)) $browser = $path_mob .'<img src="/design/imgs/browsers/opera.png" alt="" />';
echo $browser;
$arr = array('nokia',
'samsung',
'siemens',
'fly',
'motorola',
'sharp',
'sony',
'lg',
'acer',
'alcatel',
'asus',
'gigabyte',
'highscreen',
'huawei',
'philips',
'mts',
'midp-2.0',
'ucweb');
foreach ($arr as $value) {
if (strpos($ua, $value) !== false) {
$browser = $path_mob;
echo $browser;
}
}
}
?>