Просмотр файла and1/index.php

Размер файла: 2.72Kb
  1. <?
  2.  
  3. $title = 'java Игры';
  4.  
  5. include"head.php";
  6. // ----------------------- Функция экранирования основных знаков --------------------------//
  7. function cha($msg) {
  8.  
  9. $msg = htmlspecialchars($msg);
  10. $search = array('|', '\'', '$', '\\', '^', '%', '`', "\0", "\x00", "\x1A", chr(226) . chr(128) . chr(174));
  11. $replace = array('&#124;', '&#39;', '&#36;', '&#92;', '&#94;', '&#37;', '&#96;', '', '', '', '');
  12.  
  13. $msg = str_replace($search, $replace, $msg);
  14. $msg = stripslashes(trim($msg));
  15.  
  16.  
  17. return $msg;
  18. }
  19.  
  20. $sid = cha($_GET['sid']);
  21. if(!$sid)
  22. {
  23. $sid = 'dir/1';
  24. }
  25. ini_set('display_errors',0);
  26. ini_set ('register_globals', 0);
  27. ini_set ("user_agent","...");
  28. session_name('SID'); session_start();
  29. ##############################################
  30. ##############################################
  31. $host= "sim-sot.ru"; $path="/mas/game/".$sid."?".$_SERVER ['QUERY_STRING'];
  32. $fp=fsockopen($host,80,$errno, $errstr,10);
  33. if(!$fp) { echo "$errstr ($errno)<br/>\n"; }else{
  34. $data = "";$post=0; foreach($_POST as $key=>$value){
  35. $post=1; $data.="&$key=$value";} if($data)$data=substr ($data,1);
  36. if($post) $headers = "POST $path HTTP/1.0\r\n";else
  37. $headers = "GET $path HTTP/1.0\r\n"; $headers.= "Host: $host\r\n";
  38. $headers.= "Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif,image/x-bitmap, */*;q=0.1\r\n";
  39. $headers.= "Accept-Charset: utf-8;q=0.6 windows-1251;q=0.1*;q=0.1\r\n";
  40. $headers.= "Accept-Encoding: utf-8\r\n";
  41. $headers.= "Accept-Language: ru, en;q=0.9\r\n";
  42. $headers.= "User-Agent: game\r\n";
  43. if($post){ $headers.= "Content-type: application/x-www-form-urlencoded\r\n";
  44. $headers.= "Content-Length: ".strlen ($data)."\r\n";
  45. $headers.= "\r\n"; $headers.= $data;}else $headers.="\r\n";
  46. @fwrite($fp, $headers); while($file != "\r\n") $file = @fgets($fp, 128);
  47. $file = ''; while(!feof($fp)) $file.= @fgets($fp, 4096); @fclose($fp); }
  48. ##############################################
  49.  
  50. $file=preg_replace('|<!DOCTYPE(.*?)</head>|is','',$file);
  51. $file=preg_replace('|class="foot"><center>(.*?)</html>|is','class="footss">',$file);
  52.  
  53. $file=preg_replace('|<center>sim-sot.ru(.*?)<div class="menu_razd">|is','',$file);
  54.  
  55. $file=str_replace('<center>java Игры</center>','', $file);
  56.  
  57.  
  58.  
  59. $file=str_replace('<a href="/mas/game/','<a href="index.php?sid=', $file);
  60. $file=str_replace('action="/mas/game/','action="index.php?sid=', $file);
  61. $file=str_replace('<a href="index.php?sid=file','<a href="http://sim-sot.ru/mas/game/file', $file);
  62.  
  63. $file=str_replace('Поиск по названию','', $file);
  64. $file=str_replace('Поиск','', $file);
  65. $file=str_replace('</center>','</b>', $file);
  66. $file=str_replace('<center>','<b>', $file);
  67. echo $file;
  68. include"foot.php";
  69. ?>