Просмотр файла includer9.php

Размер файла: 25.27Kb
<?php

error_reporting(4095); 

function wsc($a){if(is_array($a)){foreach($a as $k=>$v) $a[$k]=wsc($v);}else{$a=str_replace('$','$$',HtmlSpecialChars($a));} return $a;}

function seanum($file) { preg_match_all('/([[:digit:]]+)/s',$file,$p); $p=array_unique($p[1]); sort($p); return $p;}

function parsarray($arr) {for($n=0,$s=count($arr)-1;$n<$s; $n++) {for($x=$n+1,$y=$s+1; $x<$y; $x++) if(strpos($arr[$x],$arr[$n])!==false) {unset($arr[$n]); break; }} return $arr; }

function depacun(&$a,$len,$arr) {if(is_array($arr)) {foreach($arr as $k=>$v) {depacun($a,$len,$v); }} else {for($max=strlen($arr)-$len+1,$n=0; $n<$max; $n++) {$aa=substr($arr,$n,$len); if(isset($a[$aa])) $a[$aa]++; else $a[$aa]=0; }} return $a; }

function sear($len,$arr) { $count=pow(10,$len); if(count($arr)>=$count) return false; for($n=0; $n<$count; $n++) {$nn=str_pad($n,$len,'0',STR_PAD_LEFT); if(!isset($arr[$nn])) return $nn; } return false; }

function allsear($argl) {if(!is_array($argl)) $argl=array($argl); if(count($argl)===0) $max=''; else $max=max($argl); $max=1+strlen($max); $maxkey=0; $mas=strlen(join('',$argl)); while($mas+1-pow(10,$maxkey)>0) $maxkey++; if($maxkey>$max) $maxkey=$max; if(!$maxkey) return mt_rand(2,9); for($n=1; $n<=$maxkey; $n++) {$a=array(); depacun($a,$n,$argl); $unikey=sear($n,$a); if($unikey!==false) return $unikey; } return false; }

function filekey($file) {return allsear(parsarray(seanum($file))); }

function utftoasc($txt) {$utftoasctabl=array('&#x410;'=>'A','&#x430;'=>'a','&#x412;'=>'B','&#x415;'=>'E','&#x435;'=>'e','&#x41a;'=>'K','&#x41c;'=>'M','&#x41d;'=>'H','&#x41e;'=>'O','&#x43e;'=>'o','&#x420;'=>'P','&#x440;'=>'p','&#x421;'=>'C','&#x441;'=>'c','&#x422;'=>'T','&#x443;'=>'y','&#x425;'=>'X','&#x445;'=>'x'); return strtr($txt,$utftoasctabl);} 

function keycoders($str,$basa="%~^:@") { if(empty($basa)) $basa="%~^:@"; if(is_array($str)) $str=join('',$str); $rv='/['.preg_quote($basa,'/').']/s'; preg_match_all($rv,$str.$basa,$r,PREG_PATTERN_ORDER); $r=array_count_values($r[0]); asort($r,SORT_NUMERIC); reset($r); return key($r); } 

function unidecode($txt) { $unitoutftabl=array(chr(208).chr(144) => "A",chr(208).chr(145) => "&#x411;",chr(208).chr(146) => "B",chr(208).chr(147) => "&#x413;",chr(208).chr(148) => "&#x414;",chr(208).chr(149) => "E",chr(208).chr(150) => "&#x416;",chr(208).chr(151) => "&#x417;",chr(208).chr(152) => "&#x418;",chr(208).chr(153) => "&#x419;",chr(208).chr(154) => "K",chr(208).chr(155) => "&#x41b;",chr(208).chr(156) => "M",chr(208).chr(157) => "H",chr(208).chr(158) => "O",chr(208).chr(159) => "&#x41f;",chr(208).chr(160) => "P",chr(208).chr(161) => "C",chr(208).chr(162) => "T",chr(208).chr(163) => "&#x423;",chr(208).chr(164) => "&#x424;",chr(208).chr(165) => "X",chr(208).chr(166) => "&#x426;",chr(208).chr(167) => "&#x427;",chr(208).chr(168) => "&#x428;",chr(208).chr(169) => "&#x429;",chr(208).chr(170) => "&#x42c;",chr(208).chr(171) => "&#x42b;",chr(208).chr(172) => "&#x42a;",chr(208).chr(173) => "&#x42d;",chr(208).chr(174) => "&#x42e;",chr(208).chr(175) => "&#x42f;",chr(208).chr(176) => "a",chr(208).chr(177) => "&#x431;",chr(208).chr(178) => "&#x432;",chr(208).chr(179) => "&#x433;",chr(208).chr(180) => "&#x434;",chr(208).chr(181) => "e",chr(208).chr(182) => "&#x436;",chr(208).chr(183) => "&#x437;",chr(208).chr(184) => "&#x438;",chr(208).chr(185) => "&#x439;",chr(208).chr(186) => "&#x43a;",chr(208).chr(187) => "&#x43b;",chr(208).chr(188) => "&#x43c;",chr(208).chr(189) => "&#x43d;",chr(208).chr(190) => "o",chr(208).chr(191) => "&#x43f;",chr(209).chr(128) => "p",chr(209).chr(129) => "c",chr(209).chr(130) => "&#x442;",chr(209).chr(131) => "y",chr(209).chr(132) => "&#x444;",chr(209).chr(133) => "x",chr(209).chr(134) => "&#x446;",chr(209).chr(135) => "&#x447;",chr(209).chr(136) => "&#x448;",chr(209).chr(137) => "&#x449;",chr(209).chr(138) => "&#x44c;",chr(209).chr(139) => "&#x44b;",chr(209).chr(140) => "&#x44a;",chr(209).chr(141) => "&#x44d;",chr(209).chr(142) => "&#x44e;",chr(209).chr(143) => "&#x44f;",chr(209).chr(145) => "&#x451;",chr(208).chr(129) => "&#xcb");return strtr($txt,$unitoutftabl); }

function hexutf($txt) { function hexpex($b) {$a=$b[5]; if(empty($b[3]) && (int)$b[5]===hexdec(dechex($b[5]))) $a=dechex($b[5]); $a1=hexdec($a); if($a1==1025 || $a1==1105 || ($a1>1039 && $a1<1104)) {$b[3]='x'; $b[4]=''; $b[5]=strtolower($a);} return $b[2].$b[3].$b[4].$b[5].$b[6];} return preg_replace_callback('/((&#)(x?)(0*)([0-9abcdefABCDEF]+)(;))/s','hexpex',$txt);} 

function translit($a,$tabl='') {global $tabl; $key=filekey($a); $key=str_pad($key,2*strlen($key),'-',STR_PAD_LEFT); $a=str_replace('##',$key,$a); if(!is_array($tabl)) $tabl=array('b' => '&#x431;','B' => '&#x411;','v' => '&#x432;','V' => 'B','g' => '&#x433;','G' => '&#x413;','d' => '&#x434;','D' => '&#x414;','jo' => '&#x451;','Jo' => '&#xCB;','JO' => '&#xCB;','jO' => '&#xCB;','zh' => '&#x436;','Zh' => '&#x416;','ZH' => '&#x416;','zH' => '&#x416;','z' => '&#x437;','Z' => '&#x417;','i' => '&#x438;','I' => '&#x418;','j' => '&#x439;','J' => '&#x419;','k' => '&#x43a;','l' => '&#x43b;','L' => '&#x41b;','m' => '&#x43c;','n' => '&#x43d;','N' => 'H','p' => '&#x43f;','P' => '&#x41f;','r' => 'p','R' => 'P','t' => '&#x442;','u' => 'y','U' => '&#x423;','f' => '&#x444;','F' => '&#x424;','h' => 'x','H' => 'X','c' => '&#x446;','C' => '&#x426;','ch' => '&#x447;','Ch' => '&#x427;','CH' => '&#x427;','cH' => '&#x427;','sh' => '&#x448;','Sh' => '&#x428;','SH' => '&#x428;','sH' => '&#x428;','w' => '&#x449;','W' => '&#x429;','x' => '&#x44a;','X' => '&#x42a;','y' => '&#x44b;','Y' => '&#x42b;',chr(39) => '&#x44c;','q' => '&#x44c;','Q' => '&#x42c;','je' => '&#x44d;','JE' => '&#x42d;','Je' => '&#x42d;','jE' => '&#x42d;','ju' => '&#x44e;','Ju' => '&#x42e;','JU' => '&#x42e;','jU' => '&#x42e;','ja' => '&#x44f;','Ja' => '&#x42f;','JA' => '&#x42f;','jA' => '&#x42f;','j_a' => '&#x439;a','J_a' => '&#x419;a','J_A' => '&#x419;A','j_A' => '&#x439;A','j_o' => '&#x439;o','J_o' => '&#x419;o','J_O' => '&#x419;O','j_O' => '&#x439;O','j_u' => '&#x439;y','J_u' => '&#x419;y','J_U' => '&#x419;&#x423;','j_U' => '&#x439;&#x423;','c_h' => '&#x446;x','C_h' => '&#x426;x','C_H' => '&#x426;X','c_H' => '&#x0446;X','s_h' => 'cx','S_h' => 'Cx','S_H' => 'CX','s_H' => 'cX',chr(35).chr(35) => chr(35),'s' => 'c','S' => 'C','z_h' => '&#x437;x','Z_h' => '&#x417;x','Z_H' => '&#x417;X','z_H' => '&#x437;X','j_e' => '&#x439;e','J_e' => '&#x419;e','J_E' => '&#x419;E','j_E' => '&#x439;E'); function zamena($b) { global $tabl; return strtr($b[2],$tabl); } $a=preg_replace_callback('/(#(.+?)(?:#|$))/s','zamena',$a); return str_replace($key,'#',$a); }

function detranslit($txt) { $txt=unidecode(utftoasc(hexutf($txt))); $key=filekey($txt); $key=str_pad($key,2*strlen($key),'-',STR_PAD_LEFT); function kreksdiez($b) { $c=$b[1].$b[2]; $pary=array('jo'=>'j_o','Jo'=>'J_o','JO'=>'J_O','jO'=>'j_O','zh'=>'z_h','Zh'=>'Z_h','ZH'=>'Z_H','zH'=>'z_H','ch'=>'c_h','Ch'=>'C_h','CH'=>'C_H','cH'=>'c_H','sh'=>'s_h','Sh'=>'S_h','SH'=>'S_H','sH'=>'s_H','je'=>'j_e','JE'=>'J_E','Je'=>'J_e','jE'=>'j_E','ju'=>'j_u','Ju'=>'J_u','JU'=>'J_U','jU'=>'j_U','ja'=>'j_a','Ja'=>'J_a','JA'=>'J_A','jA'=>'j_A'); return strtr($c,$pary);} function stripdiez($txt){ return preg_replace_callback('/(.)##(.)/s','kreksdiez',$txt);} function par_y($para) { if(strlen($para)==4 && strlen(stripdiez($para))==3) return '_'; return '';} $detranstabl1=array('&#x431;'=>'b','&#x411;'=>'B','&#x432;'=>'v','&#x433;'=>'g','&#x413;'=>'G','&#x434;'=>'d','&#x414;'=>'D','&#x451;'=>'jo','&#xCB;'=>'Jo','&#xCB;'=>'JO','&#xCB;'=>'jO','&#x436;'=>'zh','&#x416;'=>'Zh','&#x416;'=>'ZH','&#x416;'=>'zH','&#x437;'=>'z','&#x417;'=>'Z','&#x438;'=>'i','&#x418;'=>'I','&#x439;'=>'j','&#x419;'=>'J','&#x43a;'=>'k','&#x43b;'=>'l','&#x41b;'=>'L','&#x43c;'=>'m','&#x43d;'=>'n','&#x43f;'=>'p','&#x41f;'=>'P','&#x442;'=>'t','&#x423;'=>'U','&#x444;'=>'f','&#x424;'=>'F','&#x446;'=>'c','&#x426;'=>'C','&#x447;'=>'ch','&#x427;'=>'Ch','&#x427;'=>'CH','&#x427;'=>'cH','&#x448;'=>'sh','&#x428;'=>'Sh','&#x428;'=>'SH','&#x428;'=>'sH','&#x449;'=>'w','&#x429;'=>'W','&#x44a;'=>'x','&#x42a;'=>'X','&#x44b;'=>'y','&#x42b;'=>'Y','&#x44c;'=>"'",'&#x44c;'=>'q','&#x42c;'=>'Q','&#x44d;'=>'je','&#x42d;'=>'JE','&#x42d;'=>'Je','&#x42d;'=>'jE','&#x44e;'=>'ju','&#x42e;'=>'Ju','&#x42e;'=>'JU','&#x42e;'=>'jU','&#x44f;'=>'ja','&#x42f;'=>'Ja','&#x42f;'=>'JA','&#x42f;'=>'jA','&#x439;a'=>'j_a','&#x419;a'=>'J_a','&#x419;A'=>'J_A','&#x439;A'=>'j_A','&#x439;o'=>'j_o','&#x419;o'=>'J_o','&#x419;O'=>'J_O','&#x439;O'=>'j_O','&#x439;y'=>'j_u','&#x419;y'=>'J_u','&#x419;&#x423;'=>'J_U','&#x439;&#x423;'=>'j_U','&#x446;x'=>'c_h','&#x426;x'=>'C_h','&#x426;X'=>'C_H','&#x0446;X'=>'c_H','&#x437;x'=>'z_h','&#x417;x'=>'Z_h','&#x417;X'=>'Z_H','&#x437;X'=>'z_H','&#x439;e'=>'j_e','&#x419;e'=>'J_e','&#x419;E'=>'J_E','&#x439;E'=>'j_E'); foreach($detranstabl1 as $k=>$v) $detranstabl1[$k]=$key.$v.$key; $txt=strtr($txt,$detranstabl1); $c=array('#'=>$key,$key=>'#'); $txt=strtr($txt,$c); $txt=stripdiez($txt); function zahvat($b) { $detranstabl2=array('B'=>'V','H'=>'N','p'=>'r','P'=>'R','y'=>'u','x'=>'h','X'=>'H','cx'=>'s_h','Cx'=>'S_h','CX'=>'S_H','cX'=>'s_H','c'=>'s','C'=>'S'); if(!empty($b[2])) $b[2]=strtr($b[2],$detranstabl2); if(!empty($b[4])) $b[4]=strtr($b[4],$detranstabl2); $x1=par_y(substr($b[2],-1,1).'##'.$b[3][0]);

$x2=par_y(substr($b[3],-1,1).'##'.substr($b[4],0,1)); return '#'.$b[2].$x1.$b[3].$x2.$b[4].'#';} $rv='([^#bdf-nq-wzDFGIJLNQRSUVWYZ'."'".'"<>]*)'; $txt=preg_replace_callback('/('.$rv.'#(.+?)#'.$rv.')/s','zahvat',$txt); $txt=stripdiez($txt); if(substr($txt,-1)==='#') $txt=substr($txt,0,-1); $txt=str_replace($key,'##',$txt); return $txt;}

function decoder($txt,$key) {$rv='/((?:'.preg_quote($key,'/').')([0-9abcdefABCDEF]{2}))/s'; function damp_decode($b) { return urldecode('%'.$b[2]);} return preg_replace_callback($rv,'damp_decode',$txt); }

function coders($txt,$key) { $key1=preg_quote($key,'/'); function coderskey($b) { return $b[2].dechex(ord(substr($b[2],0,1))).substr($b[2],1).$b[3];} $txt=preg_replace_callback('/(('.$key1.')([0-9abcdefABCDEF]{2}))/s','coderskey',$txt);for($a=array(),$n=0; $n<256; $n++) if($n<32 || $n>127) $a[chr($n)]=$key.str_pad(dechex($n),2,'0',STR_PAD_LEFT);

for($m=chr(209),$n=128;$n<192; $n++){if($n==144) {$a[$m.chr(145)]=$m.chr(145); $m=chr(208); $a[$m.chr(129)]=$m.chr(129);} $a[$m.chr($n)]=$m.chr($n);}

return strtr($txt,$a); }

function prolog($txt) { header("Content-type: text/vnd.wap.wml"); return $GLOBALS['prolog']."<card title='Error'>".$txt."<p align='center'>0:<anchor accesskey='0' title='0'>Ha&#x437;a&#x434;<prev/></anchor></p>".by."</card></wml>";}

function ftpload($url) {global $prolog;

$m=parse_url($url);

if(empty($m['port'])) $m['port']=21; if(!empty($m['query'])) $m['path'].='?'.$m['query'];

if(!empty($m['fragment'])) $m['path'].='#'.$m['fragment'];

$ftp=@ftp_connect($m['host'],$m['port']);

$login=@ftp_login($ftp,$m['user'],$m['pass']);

if((!$ftp) || (!$login)) die(prolog("<p align='center'>Coe&#x434;&#x438;&#x43d;e&#x43d;&#x438;e c cep&#x432;epo&#x43c;:<br/>".WSC($url)."<br/>Hey&#x434;a&#x43b;oc&#x44c;!</p>")); $tmp=@tmpfile(); $file=@ftp_fget($ftp,$tmp,$m['path'],FTP_BINARY);

@ftp_close($ftp);

if(!$file) { @fclose($tmp); die(prolog("<p align='center'>O&#x448;&#x438;&#x431;&#x43a;a! &#x424;a&#x439;&#x43b;:<br/>[".WSC($m['path'])."]<br/>He &#x43d;a&#x439;&#x434;e&#x43d;!</p>"));}

fseek($tmp,0,SEEK_END);

$len=ftell($tmp);

fseek($tmp,0,SEEK_SET);

$file='';

while(!feof($tmp)) $file.=fread($tmp,$len);

fclose($tmp);

return $file; } 

function callback_loader($b){ $GLOBALS['flags']=false; if(empty($b[1])) die(prolog("<onevent type='ontimer'><prev/></onevent><timer value='50'/><p align='center'>O&#x448;&#x438;&#x431;&#x43a;a!<br/>He &#x437;a&#x434;a&#x43d;o &#x438;&#x43c;&#x44f; &#x444;a&#x439;&#x43b;a &#x434;&#x43b;&#x44f; &#x437;a&#x433;p&#x443;&#x437;&#x43a;&#x438;!</p>")); if(substr(strtolower($b[1]),0,6)==='ftp://') return ftpload($b[1]); if(substr(strtolower($b[1]),0,7)==='http://') { $f=@file_get_contents($b[1])or die(prolog("<p align='center'>O&#x448;&#x438;&#x431;&#x43a;a!<br/>&#x424;a&#x439;&#x43b;:<br/>[<small>".WSC($b[1])."</small>]<br/>&#x43d;e &#x43d;a&#x439;&#x434;e&#x43d;!</p>")); return $f;} $path=realpath($b[1]); if(!$path) die(prolog("<p align='center'>O&#x448;&#x438;&#x431;&#x43a;a!<br/>&#x424;a&#x439;&#x43b;:<br/>[<small>".WSC($b[1])."</small>]<br/>He &#x43d;a&#x439;&#x434;e&#x43d; &#x43d;a cep&#x432;epe!</p>")); $f=@file_get_contents($path)or die(prolog("<p align='center'>O&#x448;&#x438;&#x431;&#x43a;a!<br/>He&#x434;oc&#x442;a&#x442;o&#x447;&#x43d;o &#x43f;pa&#x432; &#x434;&#x43b;&#x44f; &#x437;a&#x433;p&#x443;&#x437;&#x43a;&#x438; &#x444;a&#x439;&#x43b;a:<br/>[<small>".WSC($path)."</small>]</p>")); return $f;} function loader($a,$v){for($n=0;$n<$v;$n++){$GLOBALS['flags']=true; $a=preg_replace_callback('/&'.'=(.*?)(?:\s|$)/s','callback_loader',$a); if($GLOBALS['flags']) return $a;} return $a;}

function fsav($url,$b) {if(strtolower(substr($url,0,7))==="http://") return array(false,'O&#x448;&#x438;&#x431;&#x43a;a!<br/>He&#x43a;oppe&#x43a;&#x442;&#x43d;&#x44b;&#x439; a&#x434;pecc &#x434;&#x43b;&#x44f; coxpa&#x43d;e&#x43d;&#x438;&#x44f;:<br/>[<small>'.WSC($url).'</small>]<br/>&#x41f;po&#x442;o&#x43a;o&#x43b; HTTP/1.1 &#x43d;e &#x43f;o&#x434;&#x434;ep&#x436;&#x438;&#x432;ae&#x442; &#x437;a&#x43f;&#x438;c&#x44c; &#x444;a&#x439;&#x43b;o&#x432;!'); $err=array(true,'&#x424;a&#x439;&#x43b; yc&#x43f;e&#x448;&#x43d;o &#x437;a&#x43f;&#x438;ca&#x43d; &#x432; &#x434;&#x438;pe&#x43a;&#x442;op&#x438;&#x44e;:<br/>[<b>'.WSC($url).'</b>]');

$f=@fopen($url,"w"); if(!$f) { return array(false,'O&#x448;&#x438;&#x431;&#x43a;a o&#x442;&#x43a;p&#x44b;&#x442;&#x438;&#x44f; &#x444;a&#x439;&#x43b;a:<br/>[<b>'.WSC($url).'</b>]');}

$fw=@fwrite($f,$b); @fflush($f); @fclose($f); if(!$fw) {return array(false,'O&#x448;&#x438;&#x431;&#x43a;a &#x437;a&#x43f;&#x438;c&#x438; &#x444;a&#x439;&#x43b;a:<br/>[<b>'.WSC($url).'</b>]');} return $err; }

function ftps($url, $b) { $m=parse_url($url); if(empty($m['port'])) $m['port']=21; if(!empty($m['query'])) $m['path'].='?'.$m['query']; if(!empty($m['fragment'])) $m['path'].='#'.$m['fragment']; $tmp=@tmpfile(); if(!$tmp) { $a[0]=false; $a[1]='O&#x448;&#x438;&#x431;&#x43a;a &#x43f;p&#x438; co&#x437;&#x434;a&#x43d;&#x438;&#x438; &#x432;pe&#x43c;e&#x43d;o&#x433;o &#x444;a&#x439;&#x43b;a!'; return $a; } $fw=@fwrite($tmp,$b); if(!$fw) { fclose($tmp); $a[0]=false; $a[1]='O&#x448;&#x438;&#x431;&#x43a;a &#x43f;p&#x438; &#x437;a&#x43f;&#x438;c&#x438; &#x432;o &#x432;pe&#x43c;e&#x43d;&#x44b;&#x439; &#x444;a&#x439;&#x43b;!'; return $a; } fflush($tmp); fseek($tmp,0,SEEK_SET); $ftp=@ftp_connect($m['host'],$m['port']); if(!$ftp) { fclose($tmp); $a[0]=false; $a[1]='O&#x448;&#x438;&#x431;&#x43a;a! &#x414;o&#x43c;e&#x43d;:<br/>[<b>'.WSC($m[6]).'</b>]<br/>&#x43d;e &#x43d;a&#x439;&#x434;e&#x43d;!'; return $a; } $login=@ftp_login($ftp,$m['user'],$m['pass']); if(!$login) { fclose($tmp); $a[0]=false; $a[1]='<big>O&#x448;&#x438;&#x431;&#x43a;a!</big><br/>He&#x432;ep&#x43d;&#x44b;&#x439; &#x43b;o&#x433;&#x438;&#x43d;:<br/>[<b>'.WSC($m['user']).'</b>]<br/>&#x438;&#x43b;&#x438; &#x43f;apo&#x43b;&#x44c;:<br/>[<b>'.WSC($m['pass']).'</b>]'; return $a; } $fp=@ftp_fput($ftp,$m['path'],$tmp,FTP_BINARY); fclose($tmp); ftp_close($ftp); if(!$fp) { $a[0]=false; $a[1]='O&#x448;&#x438;&#x431;&#x43a;a coxpa&#x43d;e&#x43d;&#x438;&#x44f; &#x444;a&#x439;&#x43b;a:<br/>[<b>'.WSC($m['path']).'</b>]'; return $a; } $a[0]=true; $a[1]='&#x424;a&#x439;&#x43b;:<br/>[<b>'.WSC($m['path']).'</b>]<br/>yc&#x43f;e&#x448;&#x43d;o coxpa&#x43d;&#x451;&#x43d; &#x43d;a ftp cep&#x432;epe:<br/>[<b>'.WSC($m['host']).'</b>]'; return $a; }

function settmp($dir,$ext='tmp') { do $tmp=$dir.mt_rand(100000,999999).'.'.$ext; while(file_exists($tmp)); return $tmp; }

function magsid($login,$pass) {

$url='http://ssp.p8.ru/magmail/login.php?log=read&nn='.$login.'&pass='.$pass;

$f=@fopen($url,"r"); if(!$f) return false;

$wml=@file_get_contents($url); fclose($f);

if(strpos($wml,$login)===false) return false;

$s=strpos($wml,'sid=');

if($s===false) return false;

$sid=substr($wml,$s,10); return $sid; }

function magsav($url,$b) {

preg_match('{(?:.*?mag://)?([^:]*):?([^@]*)@?(.*)}is',$url,$m);

$sid=magsid($m[1],$m[2]); if($sid===false) { $err[0]=false; $err[1]='O&#x448;&#x438;&#x431;&#x43a;a a&#x432;&#x442;op&#x438;&#x437;a&#x446;&#x438;&#x438;!<br/>He&#x432;ep&#x43d;&#x44b;&#x439; &#x41b;o&#x433;&#x438;&#x43d;:[<b>'.WSC($m[1]).'</b>] &#x438;&#x43b;&#x438; &#x41f;apo&#x43b;&#x44c;:[<b>'.WSC($m[2]).'</b>]'; return $err; }

$tmp=settmp(realpath('.').'/');

$f=@fopen($tmp,"w"); if(!$f) { $err[0]=false; $err[1]='O&#x448;&#x438;&#x431;&#x43a;a co&#x437;&#x434;a&#x43d;&#x438;&#x44f;/o&#x442;&#x43a;p&#x44b;&#x442;&#x438;&#x44f; &#x432;pe&#x43c;e&#x43d;o&#x433;o &#x444;a&#x439;&#x43b;a:[<b>'.WSC($tmp).'</b>]'; return $err; }

flock($f,LOCK_SH); $fw=@fwrite($f,$b); if(!$fw) { @unlink($tmp); $err[0]=false; $err[1]='O&#x448;&#x438;&#x431;&#x43a;a &#x437;a&#x43f;&#x438;c&#x438; &#x432;o &#x432;pe&#x43c;e&#x43d;&#x44b;&#x439; &#x444;a&#x439;&#x43b;:[<b>'.WSC($tmp).'</b>]'; return $err; }

fflush($f);

$magu="ssp.p8.ru";

$maguri='/magmail/saveImport.php?'.$sid;

$magper='newurl='.urlencode(getenv('SERVER_NAME').substr($tmp,strlen(getenv('DOCUMENT_ROOT')))).'&fn='.urlencode($m[3]);

$s=@fsockopen($magu,80); if(!$s) { @unlink($tmp); $err[0]=false; $err[1]='O&#x448;&#x438;&#x431;&#x43a;a &#x43f;p&#x438; coxpa&#x43d;e&#x43d;&#x438;&#x438; &#x444;a&#x439;&#x43b;a:[<b>'.WSC('http://'.getenv('SERVER_NAME').substr($tmp,strlen(getenv('DOCUMENT_ROOT')))).'</b>]'; return $err; }

$ffp="POST $maguri HTTP/1.1\r\nHost: $magu\r\nConnection: close\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($magper)."\r\n\r\n".$magper;

fputs($s,$ffp);

$file='';

while(!feof($s)) $file.=fgets($s,1000); fclose($s);

@unlink($tmp);

$w=preg_match("{(?:\r?\n\r?\n.*?)(<\?xml.*?<wml>.*?<p *?(?:>|(?: .*?[^/]>))(.*?)</p>.*?</wml>)(?=\r?\n)}s",$file,$n); // v $n[1]-wml

if($w) { $err[0]=true; $err[1]=$n[2]; $err[2]=$n[1]; return $err; }

$err[0]=false; $err[1]="Bo&#x437;&#x43c;o&#x436;&#x43d;a o&#x448;&#x438;&#x431;&#x43a;a coxpa&#x43d;e&#x43d;&#x438;&#x44f;"; return $err; }

function sfn_file($sfn,$b){ $sfnn=strtolower(substr($sfn,0,6));

if($sfnn==='mag://' || $sfnn==='ftp://'){if($sfnn==='mag://') $err=magsav($sfn,$b);

if($sfnn==='ftp://') $err=ftps($sfn,$b);}

else

{if(empty($sfn)) $sfn=settmp(''); $err=fsav($sfn,$b);}

header('Content-Type: text/vnd.wap.wml');

print($GLOBALS['prolog'].'<card title="');

if($err[0]) print('-=INCLUDER=-');

else print("-=WARNING=-"); die('"><p align="center">'.$err[1].'<br/>0:<anchor accesskey="0" title="0">Ha&#x437;a&#x434;<prev/></anchor></p>'.by.'</card></wml>');}

function cuter($b,&$block){if($GLOBALS['go'][1]=='1') $b=detranslit($b); if($GLOBALS['go'][3]==='#') $GLOBALS['go'][3]=keycoders($b); $b=coders($b,$GLOBALS['go'][3]); if(empty($block)) $block="abcdefghij"; $gim=array(); $block=strtolower($block); for($m=strlen($block), $n=0, $block1=''; $n<$m; $n++) { if(ord($block[$n])>ord('a')-1 && ord($block[$n])<ord('k')) $block1.=$block[$n]; } $block=$block1; unset($block1); if($block==='') $block="abcdefghij"; $m=strlen($block); $l=(strlen($b)-strlen($b)%$m)/$m; for($n=0; $n<$m-1; $n++) { $gim[$n]=substr($b,$n*$l,$l); } $gim[$n]=substr($b,$n*$l); for($n=0; $n<$m-1; $n++) { $l=ord($gim[$n]{strlen($gim[$n])-1}); if($l===208 || $l===209) { $gim[$n].=$gim[$n+1][0]; $gim[$n+1]=substr($gim[$n+1],1);}} $a=$b=$c=$d=$e=$f=$g=$h=$i=$j=''; for($n=0; $n<$m; $n++) { $$block[$n].=$gim[$n]; } return array('a'=>$a,'b'=>$b,'c'=>$c,'d'=>$d,'e'=>$e,'f'=>$f,'g'=>$g,'h'=>$h,'i'=>$i,'j'=>$j);}

function pr_wml($arr='',$block=''){ if(!empty($arr)) extract($arr); header("Content-type: text/vnd.wap.wml; charset=utf-8");

print($GLOBALS['prolog'].'<template><do name="o4" type="options" label="Cache"><refresh/></do><do name="o5" type="options" label="&#x417;a&#x43f;yc&#x43a;"><go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=0$(tr)a$(v)a$(key)"><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></do><do name="o1" type="options" label="+&#x41f;po&#x43b;o&#x433;"><refresh><setvar name="a" value="'.WSC('<?php header("Content-type: text/vnd.wap.wml"); print('.chr(39).$GLOBALS['prolog'].'<card><p>'.chr(39).'); ').'$(a)"/><setvar name="j" value="$(j)'.WSC(' print('.chr(39).'</p></card></wml>'.chr(39).'); ?>').'"/></refresh></do><do name="o2" type="options" label="WML-view"><go href="http://dpo4yh.mag.su/wmlkod.wml"/></do><do name="o3" type="options" label="SHEFON"><go href="http://dpo4yh.mag.su"/></do></template>'); 

print('<card id="index" title="-=INCLUDER=-">');

if(!empty($block) && !($a.$b.$c.$d.$e.$f.$g.$h.$i.$j==='')) { print('<p align="center">'); for($bl="abcdefghij", $n=0; $n<10; $n++) { if(!(strlen($$bl[$n])===0)) print('<anchor title="'.$bl[$n].'">'.$bl[$n].'<refresh><setvar name="'.$bl[$n].'" value="'.WSC($$bl[$n]).'"/></refresh></anchor>'); }

print('</p>');}

print('<p align="center">');

for($bl="abcdefghij", $n=0; $n<10; $n++) { print('<input name="'.$bl[$n].'" title="'.$bl[$n].'" value="$'.$bl[$n].'" format="*m" type="text"/><br/>'); }

print('<select name="tr" multiple="true" value="0" title="Tpa&#x43d;c&#x43b;&#x438;&#x442;"><option title="On/Off" value="1">Tpa&#x43d;c&#x43b;&#x438;&#x442;</option></select><small>&#x41f;pe&#x444;&#x438;&#x43a;c:</small><input name="key" format="2m" size="2" maxlength="2" title="&#x41f;pe&#x444;&#x438;&#x43a;c" value="'); if(!isset($GLOBALS['go'][3])) $GLOBALS['go'][3]="%"; $go[3]=WSC($GLOBALS['go'][3]); print($go[3].'"/><br/><b>B&#x43b;o&#x436;e&#x43d;oc&#x442;&#x44c;:</b><input name="v" value="" type="text" title="(0...9)" maxlength="2" size="2" format="2N"/><br/><anchor title="Go!">3a&#x43f;yck!<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=0$(tr)a$(v)a$(key)"><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor><br/><anchor title="VIEWS">&#x41f;poc&#x43c;o&#x442;p<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=z$(tr)a$(v)a$(key)"><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/><setvar name="x" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor></p><p align="left"><anchor title="LOAD">3a&#x433;py&#x437;&#x438;&#x442;&#x44c;:<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=1$(tr)a$(v)a$(key)"><postfield name="block" value="$(block)"/><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor> a...j:<br/><input name="block" value="abcdefghij" type="text" title="Pa&#x437;&#x431;poc" maxlength="100" format="100a"/></p><p align="center">&#x41f;y&#x442;&#x44c;/&#x438;&#x43c;&#x44f; &#x444;a&#x439;&#x43b;a:<br/><input name="sfn" title="3a&#x43f;&#x438;c&#x44c;:" value="" format="*m" type="text"/><br/>0:<anchor accesskey="0" title="3a&#x43f;&#x438;ca&#x442;&#x44c;">&#x417;a&#x43f;&#x438;ca&#x442;&#x44c;<go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=5$(tr)a$(v)a$(key)"><postfield name="sfn" value="$(sfn)"/><postfield name="a" value="$(a)$(b)$(c)$(d)$(e)$(f)$(g)$(h)$(i)$(j)"/></go></anchor></p>'.by.'</card></wml>');}

function strrazbor($g){$go=''; preg_match('/([^a]?).*?(?<=a)(.?).*?(?<=a)([^ABCDEFabcdef0-9]?)/s',substr($g,1),$go); $go[0]=$g{0};

if($go[1]==='1') $go[1]=true; else $go[1]=false;

if($go[2]==='' || ord($go[2])<48 || ord($go[2])>57) $go[2]=100; settype($go[2],'integer');

if(empty($go[3])) $go[3]='#'; return $go;}

function vv($a,$b,$go,$p){if(!settype($p,"integer")) $p=0;

$p=abs($p);

if(!empty($p)) $p--;

if($go[2]>9) $go[2]='';

header("Content-type: text/vnd.wap.wml");

print($GLOBALS['prolog'].'<card title="-=INCLUDER=-">');

$n=array("\r\n"=>"\n","\n\r"=>"\n","\r"=>"\n");

$a=strtr($a,$n);

$a=explode("\n",$a); $len=count($a);

$a=array_slice($a,$p,10); $a1=$a; $a=array();

foreach($a1 as $k=>$v) $a[$k+$p+1]=$v;

unset($a1);

$p1=$p+10; $z=1+$p; if($p+10<$len) $z=1+$p1;

print('<onevent type="onenterforward"><refresh><setvar name="p" value="'.$z.'"/></refresh></onevent><do name="o2" type="options" label="&#x41f;epe&#x439;&#x442;&#x438;"><go method="post" href="'.basename('/'.$GLOBALS['_SERVER']['PHP_SELF']).'?go=z'.$go[1].'a'.$go[2].'a'.urlencode($go[3]).'"><postfield name="a" value="$(x)"/><postfield name="p" value="$(p)"/><setvar name="x" value="$(x)"/></go></do><do name="o1" type="options" label="Ha&#x437;a&#x434;"><prev/></do><p mode="nowrap"><small>$x</small></p><p mode="wrap"><input type="text" title="C&#x442;po&#x43a;a" format="*N" name="p" value="$(p)"/><br/>');

$a=WSC($a);

foreach($a as $k=>$v) print('['.$k.']=&gt; '.$v.'<br/><br/>');

print('.........</p>'.by.'</card></wml>');}

define("by",'<p align="center"><small>Includer v0.9(beta) by </small><a href="http://dpo4yh.mag.su">Emperor</a></p>',false);

if(ini_get("magic_quotes_gpc")) $_REQUEST=array_map('stripslashes',$_REQUEST); extract($_REQUEST);

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

if(empty($go) || !settype($go,'string')) {pr_wml(); exit;}

$g=$go; $go=strrazbor($go);

if(!isset($a)) $a='';

if($go[3]!=='#') $a=decoder($a,$go[3]);

if($go[1]) $a=translit($a);

$b=$a;

$a=loader($a,$go[2]);

if($go[0]=='0'){eval('?>'.$a.'<?'); exit;}

if($go[0]=='1'){if(!isset($block)) $block='';

$c=cuter($a,$block); pr_wml($c,$block); exit;}

if($go[0]=='5'){if(!isset($sfn) || !settype($sfn,'string')) $sfn=''; sfn_file($sfn,$a); exit;}

if(empty($p)) $p=0;

vv($a,$b,$go,$p); exit;

?>