The place to find new web proxies
Written By: Keldorn Firecam
Date: 2009-09-17
In addition to running PHProxy you may wish generate revenue to help pay for your hosting costs. Implementing your adverting codes on your proxy pages is fairly simple. I recommend to use NotePad++ to edit the PHProxy script. If you do not have that, please download it and install it, its a really great program for coding with syntax highlighting. I code everything with it. In fact this entire website was made from scratch only in Notepad++
Next open up the "index.php" in the source files of PHProxy and find this part on line 1141
if ($_flags['include_form'] && !isset($_GET['nf']))
{
$_url_form = '<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="' . $_script_url . '">'
. ' <label for="____' . $_config['url_var_name'] . '"><a href="' . $_url . '">Address</a>:</label> <input id="____' . $_config['url_var_name'] . '" type="text" size="80" name="' . $_config['url_var_name'] . '" value="' . $_url . '" />'
. ' <input type="submit" name="go" value="Go" />'
. ' [go: <a href="' . $_script_url . '?' . $_config['url_var_name'] . '=' . encode_url($_url_parts['prev_dir']) .' ">up one dir</a>, <a href="' . $_script_base . '">main page</a>]'
. '<br/><hr />';
If you dont entirely understand PHP, what this does is create a variable that contains
$variable = 'something' . 'something' . 'Something';
Each of the (dots) on every line is basically a joining convention in PHP to join strings together, but usually by including a variable inside 2 dots. The author of this script is using them so they can break the string into more managable lines rather then having it all on one line. So After this line
. '<br /><hr />';
You will have to remove the colon (;) on that line, as that denotes the end of the string. You will want to re-add the colon after you put the extra line with your adcode.
After that line your adcode as such and then readd the colon:
.'<IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=120 HEIGHT=600 SRC="http://ad.example.com/st?ad_type=iframe&ad_size=120x600§ion=0000000"></IFRAME>';
(Note: That if your advertising code contains any single quotation ( ' ) marks in it. You will have to escape them with a like ( \' ) else PHP will take them litterally as ending the string. Since the string is contained in a Single Quote marks.
So for example, if You had this ad code.
.'<script type='text/javascript' src='url' ></script>;You wil have to make it
.'<script type=\'text/javascript\' src=\'url\' ></script>';Here is what the finished code would be with your advertising code added on with an extra line.
if ($_flags['include_form'] && !isset($_GET['nf']))
{
$_url_form = '<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="' . $_script_url . '">'
. ' <label for="____' . $_config['url_var_name'] . '"><a href="' . $_url . '">Address</a>:</label> <input id="____' . $_config['url_var_name'] . '" type="text" size="80" name="' . $_config['url_var_name'] . '" value="' . $_url . '" />'
. ' <input type="submit" name="go" value="Go" />'
. ' [go: <a href="' . $_script_url . '?' . $_config['url_var_name'] . '=' . encode_url($_url_parts['prev_dir']) .' ">up one dir</a>, <a href="' . $_script_base . '">main page</a>]'
. '<br/><hr />'
.'<IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=120 HEIGHT=600 SRC="http://ad.example.com/st?ad_type=iframe&ad_size=120x600§ion=0000000"></IFRAME>';
You might also might want to throw some Line breaks in there, (<br /> ) to push the banner down a bit more, and, to contain the advert in a center aligned DIV. Such as.
.'<br /><div align="center"><IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=120 HEIGHT=600 SRC="http://ad.example.com/st?ad_type=iframe&ad_size=120x600§ion=0000000"></IFRAME></div><br /><br />';
Example of what you will get:
To do this follow the logic from first part of the tutorial.
Find Line 1155 in the code where you see:.
$_url_form .= '</form></div>';
Add another block below like this, and dont forget to add a few line breaks and center tag!
$_url_form .= '<br/><center>(your add code)</center><br/>';
Notice the .= ? When the = operator has a (dot) in front of it that means to join strings together. So you could imagine it stacked like this. Notice the similiarites again with dots on each line.
$_url_form = . $_url_form . $_url_form . $_url_form
Now back to the code, you should have this:
$_url_form .= '</form></div>'; $_url_form .= '<br/><center>(your add code)</center><br/>';
What you will get:
To put a banner advert or add anything to the footer. Find this line in "index.php", on line 1156.
$_response_body = preg_replace('#<\s*body(.*?)>#si',[...]
What were doing here is taking the $_response_body which contains the html of the page and using preg_replace with a regural expression to find the end </body> tag in the html and put our advert there and then re-add the </body> tag. Since at this point the parsing of the page is already complete we call this "postParsing" editing. So you will not have to worry that the proxy script will rewrite your adcodes to load threw the proxy script. (That process is called "preParsing" and its deffinatly not the point of entry you would want to be inserting your ads. But you dont have to worry about that here. )
Now this requires the target site to have a properly formated </body> tag present. Right now Google.com does not have a </body> tag for some reason so I used Bing instead for the example screenshot. But 99% of websites should have a properly formatted body tag. ( and 80% of all statistics are made up )
Now back to the code. Find this line on 1156
$_response_body = preg_replace('#<\s*body(.*?)>#si', "$0n$_url_form" , $_response_body, 1);
Put underneath it
$_response_body = preg_replace('#</body>#si', "<br/><div align=\"center\">(your ad code)</div></body>" , $_response_body, 1);
So you have now,
$_response_body = preg_replace('#<\s*body(.*?)>#si', "$0n$_url_form" , $_response_body, 1); $_response_body = preg_replace('#</body>#si', "<br/><div align=\"center\">(your ad code)</div></body>" , $_response_body, 1);
Note: Once again make sure that you escape Quote marks with a ( \ ) if your adcode contains the same type of Qoutes that the string is contained in.
Now you should be done, and will have adverts on your proxy pages. Remember if you have any trouble its mostly likely becuase you have a syntax error.
All parts of this article except the PHP code and the screenshots
© Hidefinder.com 2009 DO NOT COPY.
I've noticed url.php file sometimes getting slow on this site, simply can't have that! I've fixed this by enabled memcached into the redirect url.php file. So if
Do you Smell that? Its that new website smell you have been waiting for! Just joking, the owner of hidefinder, has been busy these past nearly 2 weeks, designing and programming the ne
When you open the CGIProxy script with notepad you may become overwhelmed at the sheer about code in it. That can be a problem if you are trying to figure out how to put avertisemen
CGIProxy is a script that acts as a HTTP or FTP proxy. It was created to help people over come censorship of information and to surf anonymously online. By installing it on a server, it can
Glype is a proxy script that had its first release beta in may 2007. Glype may of been created to replace the unsupported PHProxy script although its not certain of the moti
