this is the whole source. i want to revise it in order to complete for form submission or google direct search within the script. at the present time, google search is done indirectly and form submission doesn't work.
<?php
$pageLength=150000;
$header=' <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>pinokio</title>
</head>
<body bgcolor="#FFFFFF">
';
$message='<p> </p><p> </p><p> </p><p align="center">Each time you face with
the message of filtering a page, copy the url from address bar of your browser
and put it in the<br>
address cadre, then click the submit button to open the url.</p>
<p align="center">for google search, first do your search via google.com. if you
faced with the message of filtering a page, follow the directions above.
accomplish it.</p>';
$footer='</body></html>';
$server='http://'. $_SERVER['SERVER_NAME'] . '/';
$title="Each time you face with the message of filtering a page, copy the url from address bar of your browser and put it in the
address cadre, then click the submit button to open the url.";
$frame='<div style="background=#FFFFFF;position: absolute; width: 258px; height: 57px; z-index: 1; left: 10px; top: 3px" id="layer1">
<form name="redirectForm" id="redirectForm" onsubmit="url.value=webaddress.value;webaddress.value=0" method="POST" action="' . $server . 'r.php">
<p>website address<span lang="en">
- <a title="' . $title . '" href="javascript:void(0)">Google search</a></span><br>
<input dir="ltr" name="webaddress" id="webaddress" size="20"><input type="submit" value="Submit" name="B1"><input type="password" style="visibility:hidden" name="url" id="url" size="2"></p>
</form></div><br><br><br>';
$script='<script>
function linkClick(href){
document.getElementById("webaddress").value=href;
document.getElementById("url").value=href;
document.getElementById("redirectForm").submit();
return false;
}
</script>
';
function customError($errno, $errstr , $errorfile , $errorline , $errorcontext)
{
global $frame;
global $header;
global $footer;
//echo '<p align=center ><br>err= ' . $errstr;
echo $header;
echo $frame;
echo '<p align="center">Invalid web address or it is not available at this time.</p>';
echo $footer;
exit;
}
set_error_handler("customError");
//------------
class CURL {
var $callback = false;
function setCallback($func_name) {
$this->callback = $func_name;
}
function doRequest($method, $url, $vars) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
if ($method == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
}
$data = curl_exec($ch);
curl_close($ch);
if ($data) {
if ($this->callback)
{
$callback = $this->callback;
$this->callback = false;
return call_user_func($callback, $data);
} else {
return $data;
}
} else {
return curl_error($ch);
}
}
function get($url) {
return $this->doRequest('GET', $url, 'NULL');
}
function post($url, $vars) {
return $this->doRequest('POST', $url, $vars);
}
}
$curl= new CURL;
$url='';
if(isset($_POST['url']))
$url=$_POST['url'];
$url=ereg_replace("http://","",$url);
$url=ereg_replace("HTTP://","",$url);
$url='http://' . $url;
$content='';
if(strlen($url)>7)
$content=$curl -> get($url);
else{
echo $header;
echo $message;
echo $frame;
echo $footer;
}
//---------------
if($content!=''){ //if1
$url=str_replace('http://','',$url);
$url=str_replace('HTTP://','',$url);
$position=strrpos($url,"/");
if($position<=0)
$position=strlen($url);
$site_address=substr($url,0,$position);
$site_address='http://' . $site_address;
$baseUrl='<base href="' . $site_address . '">';
//getting links
$desc=$content;
$start=0;
while(1){
$pos1=stripos($desc,"<a",$start); //">
if($pos1){ //if1
$pos2=stripos($desc,">",$pos1);
$tag=substr($desc,$pos1,$pos2-$pos1);
$pos3=stripos($tag,"href");
$pos5=stripos($tag,"=",$pos3)+1;
$pos4=stripos($tag," ",$pos5);
if($pos4<=0)
$pos4=$pos2;
$href=substr($tag,$pos5,$pos4-$pos5);
//$href=str_replace("=","",$href);
//$href=substr_replace($href,replacement,start,length);
$href=eregi_replace('"','',$href);
$href=eregi_replace("'","",$href);
$href=trim($href);
//echo '<br>';
$start=$pos2;
$newUrl="<a href='$href' onclick='return linkClick(this.href)'>";
//echo $newUrl . '<br>';
//replacing manipulated url
$part1=substr($desc,0,$pos1);
$part2=substr($desc,$pos2+1,$pageLength);
$desc=$part1 . $newUrl . $part2;
} //if1
else
break;
} //while
$content=$desc;
$pos1=stripos($content,"<head"); //">
$pos2=stripos($content,">",$pos1); //">
$part1=substr($content,0,$pos2+1);
$part2=substr($content,$pos2+1,$pageLength);
$content=$part1 . $baseUrl . $part2;
$pos1=stripos($content,"<body"); //">
$pos2=stripos($content,">",$pos1); //">
$part1=substr($content,0,$pos2+1);
$part2=substr($content,$pos2+1,150000);
$content=$part1 . $script . $frame . $part2;
echo $content;
} //if1
?>