PDA

View Full Version : Need javascript help with hack!


blackice912
09-14-2002, 02:53 AM
Hello everyone!

I'm working on my first hack and I need some help with the javascript part of it.

I want to tell the script if the location in the browser does not equal a certain location that I specified, then to go to that location I specified and if it does equal that location specified, then to do nothing.

If you help, I will be most happy!

I also plan on releasing this nifty hack once it is done, as I think I don't think it's been released yet (or so it seems)

What is it? It's a template editing system so certain moderators can have access to their own style/templates for their forum so they may edit their forum to however they like.

Issvar
09-14-2002, 09:16 AM
<script language=JavaScript>
if (document.location.href == "http://www.wrongsite.com/wrongfile.html") {
document.location.href = "http://www.rightsite.com/rightfile.html";
}
</script>

blackice912
09-14-2002, 09:59 AM
Ok I re-wrote some of my code to ensure security and now I have another little problem...

if ($expandset=$post[field7]) {
echo "";
} else {
echo "<script language=\"javascript\">
<!--

location.replace(\"http://www.stardust-one.net/forums/mod/\");

//-->

</script>";

}

Now, the problem is that it isn't reading $post[field7]...so I know I screwed up somewhere (hey, it's my first hack!). Any help with this little bit of code would be great.

$post[field7] is a custom profile field that will equal the expandset number

blackice912
09-14-2002, 12:23 PM
Nevermind, I got it :)

TECK
09-19-2002, 11:45 PM
<a href="http://www.stardust-one.net/forums" target="_blank">http://www.stardust-one.net/forums</a> = $bburl
just in case you didnt know...

filburt1
09-20-2002, 01:00 AM
If you haven't sent headers yet (i.e., not written any HTML) then you can do this in PHP:

if (strpos($_SERVER['PHP_SELF'], 'wrongfile.html'))
{
header('Location: rightfile.html');
exit;
}