<SCRIPT LANGUAGE="JavaScript" SRC="SomePage.php?J=H"></SCRIPT>
Then if you want to protect:
<?php
header("Content-type: text/x-javascript");
if($J == "H") { ?>
// your javascript here
<? } else { ?>
<SCRIPT LANGUAGE='JavaScript'>
history.back();
</SCRIPT>
<? } ?>
I think that's how you do it. If they go to SomePage.php without the J in query, then they will be sent back by the javascript.