View file proxy.php

File size: 2.22Kb
<?php $soft = ini_set('user_agent','$soft/WINDOWS/BOT'); function ddirname($url){$url=preg_replace('~^http://~si','',$url);


$agent=htmlspecialchars(stripslashes($_SERVER['REMOTE_ADDR']));
$ugent=htmlspecialchars(stripslashes(getenv('HTTP_USER_AGENT')));
$agent="$agent|$ugent";
$url=substr($url,0,strpos($url.'?','?'));
$soft=htmlspecialchars(stripslashes($soft)); $url=htmlspecialchars(stripslashes($url));
if(strpos($url,'/')===false) return 'http://'.$url.'/';
return 'http://'.substr($url,0,strrpos('/'.$url,'/'));
} function wsc($a){if(is_array($a)){foreach($a as $k=>$v) $a[$k]=wsc($v);
}else{$a=str_replace('$','$$',HtmlSpecialChars($a,3));
} return $a;
} header("Content-Type: text/vnd.wap.wml;charset=utf-8");

header("Cache-Control: no-cache");


if(!isset($url))pr();

function pr($txt=''){die('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"><wml><card title="PROXY">'.$txt.'<p>


$agent

<br/>SOFT:
<br/><input name="soft" maxlength="50" value="SOFT"/><br/> <postfield name="soft" value="$(soft)"/>
PROXY:<br/><input title="URL:" name="url" value="http://" format="*m"/><br/><a href="'.basename($_SERVER['PHP_SELF']).'?url=$(url:escape)">Ok</a><br/>&#169; COTKA.ORG</p></card></wml>');
} $f=@fopen($url,'rb');


if($f===false)pr('<onevent type="onenterforward"><refresh><setvar name="url" value="'.wsc($url).'"/></refresh></onevent><p align="center"><small><b>NO FILE!</b></small></p>');


$file='';
while(!feof($f))$file.=@fread($f,1024);
fclose($f);

if(strpos($file,'<wml>')===false && strpos(strtolower($file),'<html>')===false)die($file);


$fnhttp=WSC(basename($_SERVER['PHP_SELF'])).'?url=';


$fnnohttp=$fnhttp.ddirname($url).'/';


$fnhost=$fnhttp.preg_replace('~(^http://.*?)/.*~si','$1',$url).'/';


$fnempty=$fnhttp.preg_replace('~(.*?)\?.*~s','$1',$url);


die(strtr($file,array('href="http://'=>'href="'.$fnhttp.'http://','href=""'=>'href="'.$fnempty.'"','href="?'=>'href="'.$fnempty.'?','href="/'=>'href="'.$fnhost,'href="'=>'href="'.$fnnohttp,'href="#'=>'href="#','src="http://'=>'src="http://','src="/'=>'src="'.substr($fnhost,strlen($fnhttp)),'src="'=>'src="'.substr($fnnohttp,strlen($fnhttp)))));


?>