Does anyone know what code...

admin

Administrator
Staff member
...makes it so that if someone comes from an outside website to a certain page that it doesn't work?<br />
<br />
Like, if there was a <!-- w --><a class="postlink" href="http://www.theconfusedone.com">www.theconfusedone.com</a><!-- w --> and could you make it so that the only way to get to <!-- w --><a class="postlink" href="http://www.theconfusedone.com/cool.htm">www.theconfusedone.com/cool.htm</a><!-- w --> would be by going to the original website (<!-- w --><a class="postlink" href="http://www.theconfusedone.com">www.theconfusedone.com</a><!-- w -->), and if someone attempted to enter from a different site, it wouldn't work,<br />
<br />
If that is html, please tell me the code. If that is some other type of coding, please tell me which type of coding it is.<br />
<br />
Thanks.<!--content-->No, you need some kind of language to do that. You could use Javascript or a server-side language - preferably the latter. You'll be interested in the HTTP REFERER variable.<!--content-->Hi -<br />
Well, I know of a couple of ways you could try this:<br />
1. Can you change / create an .htaccess file for your server - that would allow you to assign a password to that page, or (I believe) only allow specified IP's to access the DIR that you place this file in.<br />
2. You could password-protect in a flimsy sort of way with a cgi or perl script - I used one called password.cgi that worked fine. It was a link on one site's homepage that allowed access to another site...<br />
<br />
Good luck,<br />
El<!--content--><?php <br />
$host = preg_split("/\\//", $_SERVER['HTTP_REFERER']);<br />
if($host[2] != $_SERVER['SERVER_NAME'])<br />
{ header("Location: <!-- m --><a class="postlink" href="http://www.theconfusedone.com">http://www.theconfusedone.com</a><!-- m -->"); }<br />
?> <br />
<br />
<br />
That little PHP script redirects users who access the page if they didn't get to the page from the site. There are other alternatives, but Server Side Languages are the most efficient and secure.<!--content-->
 
Back
Top