I wanted to update my index.php file with the new update that zelune released that would allow me to put ads on proxified pages (changing the javascript to html). But when I pasted the code in, my site doesn't work. The homepage loads up, but when you try to enter something into the search bar it just reloads the homepage. My site is http://shadowaccess.com. It doesn't currently have the new code in right now, so it is working fine. Here are copies of my home.php and index.php files... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>ShadowAccess</title> <style type="text/css"> <!-- .style2 {font-family: Geneva, Arial, Helvetica, sans-serif} .style3 { font-size: 24px; font-family: Geneva, Arial, Helvetica, sans-serif; } .style4 { font-size: 9px } --> </style> </head> <style type="text/css"> body{ background-color:#0d0d0d; margin:0 auto; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#FFFFFF; } #header{ background-image:url(images/bg.jpg); height:108px; text-align:center; } #content{ width:600px; margin:0 auto; text-align:center; } p{ margin:o; color:#ffffff; font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; padding-left:30px; padding-right:30px; padding-top:10px; padding-bottom:10px; text-indent:30px; } #wrap{ background-image:url(images/browser.jpg); width:490px; height:81px; padding-top:40px; } #proxy_url{ background-image:url(images/url.jpg); width:288px; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#FFFFFF; font-weight:bold; padding:21px; float:left; border:0; margin-left:13px; } #proxybutton{ float:left; } #proxy_options{ text-align:left; margin-left:70px; } </style> <body> <div id="header"><img src="images/banner.jpg" alt="banner" /></div> <div id="content"> <p align="center"><br /> <br /> <span class="style2"><span class="style3"> Unblock Myspace, Youtube, Facebook, and More!</span></span><br /> <p align="center">To start browsing simple type the url you wish to browse in the box below and then click browse. You may select a different option depending on the website you are going to be viewing. <form method="post" action="./"> <!-- Make sure you leave the two input fields the same! --> <div id="wrap"> <input type="hidden" name="__proxy_action" value="redirect_browse" /> <input type="text" name="__proxy_url" value="http://www.google.com/" id="proxy_url" /> <input type="image" src="images/browse.jpg" value="Browse" id="proxy_button" /> </div> </form> <br /> <br /> <?PHP ?> <br /> </div> </div> <p> <script src=" http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center" class="style4">By using ShadowAccess.com, you agree that you will use this service in an ethical and legal way. No hacking attempts or illegal activities will be tolerated.</p> <script type="text/javascript"> _uacct = "UA-2194684-4"; urchinTracker(); </script> </body> </html> PHP:
Index.php <?php class proxied { var $url; var $url_first; var $ch; var $info; var $data; var $to_unlink; function proxied ($url) { session_start(); $this->url = $url; $this->handle_actions(); $this->ch = curl_init($url); $this->set_options(); $s = array(); $r = array(); if ($_SESSION['__no_javascript'] == 'yes') { $s[] = '#<\s*script[^>]*?>.*?<\s*/\s*script\s*>#si'; $r[] = ''; $s[] = '#(\bon[a-z]+)\s*=\s*(?:"([^"]*)"?|\'([^\']*)\'?|([^\'"\s>]*))?#si'; $r[] = ''; $s[] = '#<noscript>(.*?)</noscript>#si'; $r[] = '\\1'; } if ($_SESSION['__no_images'] == 'yes') { $s[] = '#<(img|image)[^>]*?>#si'; $r[] = ''; } if ($_SESSION['__no_title'] == 'yes') { $s[] = '#<\s*title[^>]*?>.*?<\s*/\s*title\s*>#si'; $r[] = ''; } if ($_SESSION['__no_meta'] == 'yes') { $s[] = '#<(meta)[^>]*?>#si'; $r[] = ''; } $this->data = preg_replace($s, $r, curl_exec($this->ch)); $this->info = curl_getinfo($this->ch); $this->url = parse_url($this->info['url']); $this->url['full'] = $this->info['url']; $this->url_first = $this->info['url']; header("Content-Type: {$this->info[content_type]}"); if (eregi('css', $this->info['content_type'])) { $this->data = $this->parse_css($this->data); } elseif (eregi('html|xml', $this->info['content_type'])) { $this->data = $this->parse_html($this->data); } echo $this->data; curl_close($this->ch); if ($this->to_unlink) { foreach ($this->to_unlink as $file) { @unlink($file); } } } function set_options () { if (!array_key_exists('__no_javascript', $_SESSION)) { $_SESSION['__no_javascript'] = 'yes'; $_SESSION['__no_images'] = 'no'; $_SESSION['__no_title'] = 'no'; $_SESSION['__no_meta'] = 'no'; } $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_AUTOREFERER => true, CURLOPT_COOKIEFILE => 'cookies/' . session_id() . '.txt', CURLOPT_COOKIEJAR => 'cookies/' . session_id() . '.txt' ); if (count($_POST)) { $post = array(); foreach ($_POST as $key => $value) { $post[$key] = $value; } } if (count($_FILES)) { $post = $post ? $post : array(); foreach ($_FILES as $name => $file) { $this->to_unlink[] = "uploads/$file[name]"; move_uploaded_file($file['tmp_name'], "uploads/$file[name]"); $post[$name] = "@uploads/$file[name]"; } } if ($post) { $options[CURLOPT_POST] = true; $options[CURLOPT_POSTFIELDS] = $post; } if (ereg('__proxy_url=', $_SERVER['HTTP_REFERER'])) { preg_match('#__proxy_url=([^&]+)#', $_SERVER['HTTP_REFERER'], $referer); $referer = base64_decode($referer[1]); $options[CURLOPT_REFERER] = $referer; } if (!eregi('google\.com', $this->url)) { $options[CURLOPT_USERAGENT] = $_SERVER['HTTP_USER_AGENT']; } else { $options[CURLOPT_USERAGENT] = 'None'; } foreach ($options as $option => $value) { @curl_setopt($this->ch, $option, $value); } } function parse_html ($string) { $parse = array( 'a' => array('href'), 'img' => array('src', 'longdesc'), 'image' => array('src', 'longdesc'), 'body' => array('background'), 'frame' => array('src', 'longdesc'), 'iframe' => array('src', 'longdesc'), 'head' => array('profile'), 'layer' => array('src'), 'input' => array('src', 'usemap'), 'form' => array('action'), 'area' => array('href'), 'link' => array('href', 'src', 'urn'), 'meta' => array('content'), 'param' => array('value'), 'applet' => array('codebase', 'code', 'object', 'archive'), 'object' => array('usermap', 'codebase', 'classid', 'archive', 'data'), 'script' => array('src'), 'select' => array('src'), 'hr' => array('src'), 'table' => array('background'), 'tr' => array('background'), 'th' => array('background'), 'td' => array('background'), 'bgsound' => array('src'), 'blockquote' => array('cite'), 'del' => array('cite'), 'embed' => array('src'), 'fig' => array('src', 'imagemap'), 'ilayer' => array('src'), 'ins' => array('cite'), 'note' => array('src'), 'overlay' => array('src', 'imagemap'), 'q' => array('cite'), 'ul' => array('src') ); $tags = $this->get_tags($string); $to_replace = array(); foreach ($tags as $tag) { $tag_name = $this->get_tag_name($tag); $attributes = $this->get_attributes($tag); if ($tag_name == 'base' && $attributes['href']) { $this->url = parse_url($attributes['href']); $this->url['full'] = $attributes['href']; $to_replace[] = array( 'string' => $tag, 'value' => '' ); } if ($attributes['style']) { $attributes['style'] = $this->parse_css($attributes['style']); } if ($parse[$tag_name]) { $extra_html = ''; $relink = true; $new_tag = "<$tag_name"; switch ($tag_name) { case 'form': if (strtolower($attributes['method']) == 'get' || !$attributes['method']) { $url = $attributes['action'] ? $this->encode_url($attributes['action'], false, true) : $this->encode_url($this->url['full'], false, true); $extra_html = "<input type=\"hidden\" name=\"__proxy_url\" value=\"$url\" /><input type=\"hidden\" name=\"__proxy_action\" value=\"redirect_get\" />"; $attributes['action'] = './'; $attributes['method'] = 'post'; $relink = false; } break; case 'head': if ($_GET['__proxy_form'] != '0') { $extra_html = "<script language=\"javascript\" type=\"text/javascript\">\n"; $extra_html .= "var __proxy_url = '{$this->url_first}';\n"; $no_javascript = $_SESSION['__no_javascript'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_javascript = $no_javascript;\n"; $no_images = $_SESSION['__no_images'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_images = $no_images;\n"; $no_title = $_SESSION['__no_title'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_title = $no_title;\n"; $no_meta = $_SESSION['__no_meta'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_meta = $no_meta;\n"; $extra_html .= "</script>\n"; $extra_html .= '<script language="javascript" type="text/javascript" src="./js/main.js"></script>'; } break; } if ($attributes) { foreach ($attributes as $attribute_name => $attribute_value) { if (in_array($attribute_name, $parse[$tag_name])) { switch ($tag_name) { default: if ($relink) { if ($attribute_name == 'src') { $extra = '&__proxy_form=0'; } else { $extra = ''; } $attribute_value = $this->encode_url($attribute_value) . $extra; } break; case 'meta': if (eregi('refresh', $attributes['http-equiv']) && $tag_name == 'meta' && $attribute_name == 'content' && preg_match('#^(\s*[0-9]*\s*;\s*url=)(.*)#i', $attribute_value, $content)) { $attribute_value = $content[1] . $this->encode_url($content[2]); } break; } } $new_tag .= " $attribute_name=\"$attribute_value\""; } } $new_tag .= ">$extra_html"; $to_replace[] = array( 'string' => $tag, 'value' => $new_tag ); } } $string = $this->mass_replace($to_replace, $string); return $string; } function parse_css ($string) { $to_replace = array(); preg_match_all('#url[\s]*\([\s]*("[^"]+"|\'[^\']+\'|[^\s>]+)[\s]*\)#si', $string, $urls); for ($i = 0; $i < count($urls[0]); $i++) { $url = $this->encode_url(preg_replace('#^("([^"]+)"|\'([^\']+)\')$#', '\\2\\3', $urls[1][$i])); $to_replace[] = array( 'string' => $urls[0][$i], 'value' => "url('$url')" ); } preg_match_all('#@import[\s]*("[^"]+"|\'[^\']+\'|[^\s>]+)#si', $string, $urls); for ($i = 0; $i < count($urls[0]); $i++) { $url = $this->encode_url(preg_replace('#^("([^"]+)"|\'([^\']+)\')$#', '\\2\\3', $urls[1][$i])); $to_replace[] = array( 'string' => $urls[0][$i], 'value' => "@import '$url'" ); } $string = $this->mass_replace($to_replace, $string); return $string; } function get_tags ($string) { preg_match_all('#<([a-z-]+)([^>]+)>#si', $string, $tags); return $tags[0]; } function get_tag_name ($string) { preg_match('#^<([a-z0-9-]+)#i', $string, $matches); return strtolower($matches[1]); } function get_attributes ($string) { $attributes = array(); $string = preg_replace('#^<[a-z-]+|>$#i', '', $string); if ($string) { preg_match_all('#([a-z-]+)=?("[^">]*"|\'[^\'>]*\'|[^\s>]*)#si', $string, $matches); for ($i = 0; $i < count($matches[0]); $i++) { $attributes[strtolower($matches[1][$i])] = $this->strip_quotes($matches[2][$i]); } return $attributes; } else { return false; } } function strip_quotes ($string) { return ereg_replace('^("([^"]*)"|^\'([^\']*)\')$', '\\2\\3', $string); } function mass_replace ($array, $string) { foreach ($array as $replacement) { $string = str_replace($replacement['string'], $replacement['value'], $string); } return $string; } function encode_url ($string, $raw = false, $plain = false) { $string = $this->strip_quotes(html_entity_decode($string)); if (eregi('^[a-z]{2,}:', $string)) { } elseif (ereg('^/', $string)) { $string = "{$this->url[scheme]}://{$this->url[host]}$string"; } elseif (ereg('^#', $string)) { $raw = true; } elseif (eregi('^mailto:', $string)) { $raw = true; } elseif (ereg('^\.\./', $string)) { preg_match_all('#\.\./#', $string, $matches); $path = ereg_replace('/([^/]*)$', '/', $this->url['path']); for ($i = 0; $i < count($matches[0]); $i++) { $path = ereg_replace('([^/]*)/$', '', $path); } $path = ereg_replace('/$', '', $path) . '/'; $string = ereg_replace('\.\./', '', $string); $string = "{$this->url[scheme]}://{$this->url[host]}$path$string"; } else { $string = ereg_replace('^\./', '', $string); $path = ereg_replace('/([^/]*)$', '/', $this->url['path']); $path = ereg_replace('/$', '', $path) . '/'; $string = "{$this->url[scheme]}://{$this->url[host]}$path$string"; } return $raw ? $string : (!$plain ? './?__proxy_url=' : '') . base64_encode($string); } function handle_actions () { if ($_POST['__proxy_action'] == 'redirect_get') { $url = base64_decode($_POST['__proxy_url']); unset($_POST['__proxy_action'], $_POST['__proxy_url']); $get = ''; foreach ($_POST as $key => $value) { $value = urlencode($value); $get .= "&$key=$value"; } $get = ereg('\?', $url) ? $get : ereg_replace('^&', '?', $get); $url = base64_encode($url . $get); header("Location: ./?__proxy_url=$url"); exit; } elseif ($_POST['__proxy_action'] == 'redirect_browse') { $_SESSION['__no_javascript'] = (bool) $_POST['__no_javascript'] ? 'yes' : 'no'; $_SESSION['__no_images'] = (bool) $_POST['__no_images'] ? 'yes' : 'no'; $_SESSION['__no_title'] = (bool) $_POST['__no_title'] ? 'yes' : 'no'; $_SESSION['__no_meta'] = (bool) $_POST['__no_meta'] ? 'yes' : 'no'; header('Location: ./?__proxy_url=' . base64_encode($_POST['__proxy_url'])); exit; } } } $url = @parse_url($_GET['__proxy_url']) && strlen($_GET['__proxy_url']) ? base64_decode($_GET['__proxy_url']) : false; if (!$url && !$_POST['__proxy_action']) { include 'home.php'; exit; } $proxied = new proxied($url); ?> PHP:
Here is the new version three update... <?php /* ______ _ __ __ _ ____ |___ / | | \ \ / / (_) |___ \ / / ___| |_ _ _ __ ___ \ \ / /__ _ __ ___ _ ___ _ __ __) | / / / _ \ | | | | '_ \ / _ \ \ \/ / _ \ '__/ __| |/ _ \| '_ \ |__ < / /_| __/ | |_| | | | | __/ \ / __/ | \__ \ | (_) | | | | ___) | /_____\___|_|\__,_|_| |_|\___| \/ \___|_| |___/_|\___/|_| |_| |____/ Replace this code in your index.php if you wish to have an html frame on the proxied pages. *You can place advertisements, popup/under code, pictures, and anything else on it easily* Once completed, feel free to delete this these comments if you wish. Raithe@gmail.com Zelune.net DO NOT DELETE PAST THIS LINE */ class proxied { var $url; var $url_first; var $ch; var $info; var $data; var $to_unlink; function proxied ($url) { session_start(); $this->url = $url; $this->handle_actions(); $this->ch = curl_init($url); $this->set_options(); $s = array(); $r = array(); if ($_SESSION['__no_javascript'] == 'yes') { $s[] = '#<\s*script[^>]*?>.*?<\s*/\s*script\s*>#si'; $r[] = ''; $s[] = '#(\bon[a-z]+)\s*=\s*(?:"([^"]*)"?|\'([^\']*)\'?|([^\'"\s>]*))?#si'; $r[] = ''; $s[] = '#<noscript>(.*?)</noscript>#si'; $r[] = '\\1'; } if ($_SESSION['__no_images'] == 'yes') { $s[] = '#<(img|image)[^>]*?>#si'; $r[] = ''; } if ($_SESSION['__no_title'] == 'yes') { $s[] = '#<\s*title[^>]*?>.*?<\s*/\s*title\s*>#si'; $r[] = ''; } if ($_SESSION['__no_meta'] == 'yes') { $s[] = '#<(meta)[^>]*?>#si'; $r[] = ''; } $this->data = preg_replace($s, $r, curl_exec($this->ch)); $this->info = curl_getinfo($this->ch); $this->url = parse_url($this->info['url']); $this->url['full'] = $this->info['url']; $this->url_first = $this->info['url']; header("Content-Type: {$this->info[content_type]}"); if (eregi('css', $this->info['content_type'])) { $this->data = $this->parse_css($this->data); } elseif (eregi('html|xml', $this->info['content_type'])) { $this->data = $this->parse_html($this->data); } echo $this->data; curl_close($this->ch); if ($this->to_unlink) { foreach ($this->to_unlink as $file) { @unlink($file); } } } function set_options () { if (!array_key_exists('__no_javascript', $_SESSION)) { $_SESSION['__no_javascript'] = 'yes'; $_SESSION['__no_images'] = 'no'; $_SESSION['__no_title'] = 'no'; $_SESSION['__no_meta'] = 'no'; } $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_AUTOREFERER => true, CURLOPT_COOKIEFILE => 'cookies/' . session_id() . '.txt', CURLOPT_COOKIEJAR => 'cookies/' . session_id() . '.txt' ); if (count($_POST)) { $post = array(); foreach ($_POST as $key => $value) { $post[$key] = $value; } } if (count($_FILES)) { $post = $post ? $post : array(); foreach ($_FILES as $name => $file) { $this->to_unlink[] = "uploads/$file[name]"; move_uploaded_file($file['tmp_name'], "uploads/$file[name]"); $post[$name] = "@uploads/$file[name]"; } } if ($post) { $options[CURLOPT_POST] = true; $options[CURLOPT_POSTFIELDS] = $post; } if (ereg('__new_url=', $_SERVER['HTTP_REFERER'])) { preg_match('#__new_url=([^&]+)#', $_SERVER['HTTP_REFERER'], $referer); $referer = base64_decode($referer[1]); $options[CURLOPT_REFERER] = $referer; } if (!eregi('google\.com', $this->url)) { $options[CURLOPT_USERAGENT] = $_SERVER['HTTP_USER_AGENT']; } else { $options[CURLOPT_USERAGENT] = 'None'; } foreach ($options as $option => $value) { @curl_setopt($this->ch, $option, $value); } } function parse_html ($string) { $parse = array( 'a' => array('href'), 'img' => array('src', 'longdesc'), 'image' => array('src', 'longdesc'), 'body' => array('background'), 'frame' => array('src', 'longdesc'), 'iframe' => array('src', 'longdesc'), 'head' => array('profile'), 'layer' => array('src'), 'input' => array('src', 'usemap'), 'form' => array('action'), 'area' => array('href'), 'link' => array('href', 'src', 'urn'), 'meta' => array('content'), 'param' => array('value'), 'applet' => array('codebase', 'code', 'object', 'archive'), 'object' => array('usermap', 'codebase', 'classid', 'archive', 'data'), 'script' => array('src'), 'select' => array('src'), 'hr' => array('src'), 'table' => array('background'), 'tr' => array('background'), 'th' => array('background'), 'td' => array('background'), 'bgsound' => array('src'), 'blockquote' => array('cite'), 'del' => array('cite'), 'embed' => array('src'), 'fig' => array('src', 'imagemap'), 'ilayer' => array('src'), 'ins' => array('cite'), 'note' => array('src'), 'overlay' => array('src', 'imagemap'), 'q' => array('cite'), 'ul' => array('src') ); $tags = $this->get_tags($string); $to_replace = array(); foreach ($tags as $tag) { $tag_name = $this->get_tag_name($tag); $attributes = $this->get_attributes($tag); if ($tag_name == 'base' && $attributes['href']) { $this->url = parse_url($attributes['href']); $this->url['full'] = $attributes['href']; $to_replace[] = array( 'string' => $tag, 'value' => '' ); } if ($attributes['style']) { $attributes['style'] = $this->parse_css($attributes['style']); } if ($parse[$tag_name]) { $extra_html = ''; $relink = true; $new_tag = "<$tag_name"; switch ($tag_name) { case 'form': if (strtolower($attributes['method']) == 'get' || !$attributes['method']) { $url = $attributes['action'] ? $this->encode_url($attributes['action'], false, true) : $this->encode_url($this->url['full'], false, true); $extra_html = "<input type=\"hidden\" name=\"__new_url\" value=\"$url\" /><input type=\"hidden\" name=\"__proxy_action\" value=\"redirect_get\" />"; $attributes['action'] = './'; $attributes['method'] = 'post'; $relink = false; } break; case 'head': if ($_GET['__proxy_form'] != '0') { $extra_html = "<script language=\"javascript\" type=\"text/javascript\">\n"; $extra_html .= "var __new_url = '{$this->url_first}';\n"; $no_javascript = $_SESSION['__no_javascript'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_javascript = $no_javascript;\n"; $no_images = $_SESSION['__no_images'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_images = $no_images;\n"; $no_title = $_SESSION['__no_title'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_title = $no_title;\n"; $no_meta = $_SESSION['__no_meta'] == 'yes' ? 'true' : 'false'; $extra_html .= "var __no_meta = $no_meta;\n"; $extra_html .= "</script>\n"; // $extra_html .= '<script language="javascript" type="text/javascript" src="./js/main.js"></script>'; $extra_html .= ' <div style="width:100%;margin:0;text-align:center;border-bottom:1px solid #725554; color:#000000; background-color:#F2FDF3; font-size:12px;font-weight:bold; font-family:Bitstream Vera Sans,arial,sans-serif;padding:4px;"> <form method="post" action="./" id="proxy_form"> <input type="hidden" name="__proxy_action" value="redirect_browse" /> Address: <input id="new_url" type="text" size="80" name="__new_url" value="http://www." /> <input type="submit" value="Browse" id="proxy_button"/> <br> <div id="proxy_options"> <label for="__no_javascript"> <input type="checkbox" name="__no_javascript" id="__no_javascript" /> Disable JavaScript </label> <label for="__no_images"> <input type="checkbox" name="__no_images" id="__no_images" /> Disable Images </label> <label for="__no_title"> <input type="checkbox" name="__no_title" id="__no_title" /> Strip Title </label> <label for="__no_meta"> <input type="checkbox" name="__no_meta" id="__no_meta" /> Strip Meta </label> </div> </form> <br> <a href="http://www.zelune.net">GO BACK TO ZELUNE.NET</a> </div> <p> </p> <p> </p> '; } break; } if ($attributes) { foreach ($attributes as $attribute_name => $attribute_value) { if (in_array($attribute_name, $parse[$tag_name])) { switch ($tag_name) { default: if ($relink) { if ($attribute_name == 'src') { $extra = '&__proxy_form=0'; } else { $extra = ''; } $attribute_value = $this->encode_url($attribute_value) . $extra; } break; case 'meta': if (eregi('refresh', $attributes['http-equiv']) && $tag_name == 'meta' && $attribute_name == 'content' && preg_match('#^(\s*[0-9]*\s*;\s*url=)(.*)#i', $attribute_value, $content)) { $attribute_value = $content[1] . $this->encode_url($content[2]); } break; } } $new_tag .= " $attribute_name=\"$attribute_value\""; } } $new_tag .= ">$extra_html"; $to_replace[] = array( 'string' => $tag, 'value' => $new_tag ); } } $string = $this->mass_replace($to_replace, $string); return $string; } function parse_css ($string) { $to_replace = array(); preg_match_all('#url[\s]*\([\s]*("[^"]+"|\'[^\']+\'|[^\s>]+)[\s]*\)#si', $string, $urls); for ($i = 0; $i < count($urls[0]); $i++) { $url = $this->encode_url(preg_replace('#^("([^"]+)"|\'([^\']+)\')$#', '\\2\\3', $urls[1][$i])); $to_replace[] = array( 'string' => $urls[0][$i], 'value' => "url('$url')" ); } preg_match_all('#@import[\s]*("[^"]+"|\'[^\']+\'|[^\s>]+)#si', $string, $urls); for ($i = 0; $i < count($urls[0]); $i++) { $url = $this->encode_url(preg_replace('#^("([^"]+)"|\'([^\']+)\')$#', '\\2\\3', $urls[1][$i])); $to_replace[] = array( 'string' => $urls[0][$i], 'value' => "@import '$url'" ); } $string = $this->mass_replace($to_replace, $string); return $string; } function get_tags ($string) { preg_match_all('#<([a-z-]+)([^>]+)>#si', $string, $tags); return $tags[0]; } function get_tag_name ($string) { preg_match('#^<([a-z0-9-]+)#i', $string, $matches); return strtolower($matches[1]); } function get_attributes ($string) { $attributes = array(); $string = preg_replace('#^<[a-z-]+|>$#i', '', $string); if ($string) { preg_match_all('#([a-z-]+)=?("[^">]*"|\'[^\'>]*\'|[^\s>]*)#si', $string, $matches); for ($i = 0; $i < count($matches[0]); $i++) { $attributes[strtolower($matches[1][$i])] = $this->strip_quotes($matches[2][$i]); } return $attributes; } else { return false; } } function strip_quotes ($string) { return ereg_replace('^("([^"]*)"|^\'([^\']*)\')$', '\\2\\3', $string); } function mass_replace ($array, $string) { foreach ($array as $replacement) { $string = str_replace($replacement['string'], $replacement['value'], $string); } return $string; } function encode_url ($string, $raw = false, $plain = false) { $string = $this->strip_quotes(html_entity_decode($string)); if (eregi('^[a-z]{2,}:', $string)) { } elseif (ereg('^/', $string)) { $string = "{$this->url[scheme]}://{$this->url[host]}$string"; } elseif (ereg('^#', $string)) { $raw = true; } elseif (eregi('^mailto:', $string)) { $raw = true; } elseif (ereg('^\.\./', $string)) { preg_match_all('#\.\./#', $string, $matches); $path = ereg_replace('/([^/]*)$', '/', $this->url['path']); for ($i = 0; $i < count($matches[0]); $i++) { $path = ereg_replace('([^/]*)/$', '', $path); } $path = ereg_replace('/$', '', $path) . '/'; $string = ereg_replace('\.\./', '', $string); $string = "{$this->url[scheme]}://{$this->url[host]}$path$string"; } else { $string = ereg_replace('^\./', '', $string); $path = ereg_replace('/([^/]*)$', '/', $this->url['path']); $path = ereg_replace('/$', '', $path) . '/'; $string = "{$this->url[scheme]}://{$this->url[host]}$path$string"; } return $raw ? $string : (!$plain ? './?__new_url=' : '') . base64_encode($string); } function handle_actions () { if ($_POST['__proxy_action'] == 'redirect_get') { $url = base64_decode($_POST['__new_url']); unset($_POST['__proxy_action'], $_POST['__new_url']); $get = ''; foreach ($_POST as $key => $value) { $value = urlencode($value); $get .= "&$key=$value"; } $get = ereg('\?', $url) ? $get : ereg_replace('^&', '?', $get); $url = base64_encode($url . $get); header("Location: ./?__new_url=$url"); exit; } elseif ($_POST['__proxy_action'] == 'redirect_browse') { $_SESSION['__no_javascript'] = (bool) $_POST['__no_javascript'] ? 'yes' : 'no'; $_SESSION['__no_images'] = (bool) $_POST['__no_images'] ? 'yes' : 'no'; $_SESSION['__no_title'] = (bool) $_POST['__no_title'] ? 'yes' : 'no'; $_SESSION['__no_meta'] = (bool) $_POST['__no_meta'] ? 'yes' : 'no'; header('Location: ./?__new_url=' . base64_encode($_POST['__new_url'])); exit; } } } $url = @parse_url($_GET['__new_url']) && strlen($_GET['__new_url']) ? base64_decode($_GET['__new_url']) : false; if (!$url && !$_POST['__proxy_action']) { include 'home.php'; exit; } $proxied = new proxied($url); ?> PHP: Hopefully someone can figure out what's wrong. Thanks