Jump to content

Archived

This topic is now archived and is closed to further replies.

Picatta

Problem with dynamically created javascript for proxy form

Recommended Posts

Well, I decided to make a script in php which would pase a text file and then depending on the get data attached to ?type= would print out the appropriate proxy form and a drop down menu which would change the action of the script. This script gets called like a normal .js file, except like src="script.php?type=cgi". The text file is in the format

URL |-@-| TYPE

Where TYPE is either cgi or php. Anyway, all was going well, and I got CGI working but now php won't work. I can't figure out what's wrong.

(I am pretty sure I screwed up the javascript)

[code]<?php
$type = $_GET['type'];
if ($type == 'cgi') {
print "
document.write('<FORM name=\"Proxy\" method=post><p align=center><select style=\"color: #ffffff; background-color: #000000\" id=\"ProxyChange\">');
";
}
if ($type == 'php') {
print "
document.write('<div id=\"container\"><div id=\"menu\"><a href=\"$website\">URL Form</a> | ')
document.write('    <a href=\"" . $website . "?action=cookies\">Manage Cookies</a> |')
document.write('  </div>  <div class=\"title\">PHProxy</div>  <noscript><div class=\"error\"><big>You have Javascript disabled. Please enable it to use the proxy</big></div></noscript>')
document.write('  <form name=\"poxy_url_form\" method=\"get\" action=\"/anticencorship/phpProxy/index.php\">')
document.write('  <select style=\"color: #ffffff; background-color: #000000\" id=\"PProxyChange\">
";
}
$file = 'proxies.txt';
$file = file_get_contents($file);
$file = preg_split('/\n/',$file);
$limit = count($file);
for ($int=0; $int<$limit; $int++) {
$website = $file[$int];
$line = $file[$int];
$line = explode('|-@-|',$line);
$website = $line[0];
$name = explode('://',$website);
$name = $name[1];
$name = preg_split('/\.[cnobuCNOBU]/',$name);
$name = $name[0];
if ((strpos($website,'https://')) !== FALSE) {$secure = 'Secure';} else {$secure = 'Insecure';}
if (strpos($line[1],$type) !== FALSE)
print "document.write('<option value=\"$website\">$name ($secure)</option>');
";
}
if ($type == 'cgi') {
print "
document.write('</select></p><br /><br /><p align=center><FONT COLOR=\"#ffffff\"><INPUT size=80 name=URL style=\"color: #ffffff; background-color: #000000\"><b><INPUT type=submit onClick=\"Proxy.action=document.Proxy.ProxyChange.options[document.Proxy.ProxyChange.selectedIndex].value\"          value=\"\" style=\"color: #ffffff; background-color: #000000\"> <BR><INPUT type=checkbox name=rc value=\"ON\"> Destroy Cookies (except some proxy cookies) <BR><INPUT type=checkbox name=rs value=\"ON\"> Remove Scripts (For anonymity) <BR><INPUT type=checkbox name=fa value=\"ON\"> Filter ads <BR><INPUT type=checkbox name=br value=\"ON\"> Spoof Referrer <BR><INPUT type=checkbox name=if value=\"ON\"> Show small Address form </p></b></FONT></FORM>');";
}
if ($type == 'php') {
print "
document.write('<input type=hidden name=formsub value=true>  <input type=\"hidden\" name=\"q\" value=\"\" id=\"url_input\" />  <input type=\"hidden\" name=\"hl\" value=\"\" />')
document.write('  </form>  <form name=\"poxy_settings_form\" method=\"get\" action=\"\" onsubmit=\"return submit_form();\">  <input type=hidden name=formsub value=true>')
document.write('  <table style=\"width: 100%\">  <tr><td class=\"option\" style=\"width: 20%\">URL</td><td class=\"option\" style=\"width: 80%\">&nbsp;<input type=\"text\" name=\"url\" size=\"70\" value=\"\" /></td></tr>')
document.write('  <tr><td class=\"option\">Include Form</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Includes a mini URL-form on every HTML page</td></tr><tr><td class=\"option\">Remove Scripts</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Remove client-side scripting (i.e. Javascript)</td></tr><tr><td class=\"option\">Accept Cookies</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Accept HTTP cookies</td></tr><tr><td class=\"option\">Show Images</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Show images</td></tr><tr><td class=\"option\">Show Referer</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Show referring website in HTTP headers</td></tr><tr><td class=\"option\">Rotate13</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" /> Use rotate13 encoding on the URL</td></tr><tr><td class=\"option\">Base64</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Use base64 encoding on the URL</td></tr><tr><td class=\"option\">Strip Meta</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" /> Strip meta HTML tags</td></tr><tr><td class=\"option\">Strip Title</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" /> Strip Website title</td></tr><tr><td class=\"option\">Session Cookies</td><td class=\"option\"> <input type=\"checkbox\" name=\"ops[]\" checked=\"checked\" /> Store cookies for this session only</td></tr>  <tr><td class=\"option\" style=\"width: 20%\">New Window</td><td class=\"option\" style=\"width: 80%\"><input type=\"checkbox\" name=\"new_window\" />Open URL in a new window </td></tr>')
document.write('  </table>  <div style=\"text-align: center\"><input type=\"submit\" name=\"browse\" value=\"Browse\" onclick=\"return submit_form(); poxy_url_form.action=document.poxy_url_form.PProxyChange.options[document.poxy_url_form.PProxyChange.selectedIndex].value\" /></div>')
document.write('  <div style=\"text-align: center\">PHProxy 0.4 &copy; 2005 <a href=\"http://www.whitefyre.com/\">whiteFyre</a></div>  </form>  </div>')
";
}
?>


[/code]

Share this post


Link to post
Share on other sites
Hi,,
maybe try:
[code]print "<s cript>document.write(\"<font face='Impact, Arial' size=3 color='#008000'>Hello World</font>\")</s cript>";
[/code]
because 'document.write' is javascript,,

nb: replace 's cript' by 'script',,

Hoping it helps,
l8tr,,

Share this post


Link to post
Share on other sites
I want to include the file like a .js file, you know, like

<script language=text/javascript src=script.php?type=php></script>.

So I don't need the script tags.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.