View Full Version : Random Question / Incoming Pages
Kevin.N
01-15-2009, 08:10 AM
I know this is pretty ridiculous but I am looking for a script that only allows that page to be viewed from a specific origin page. IE if you want to view example.com/somepage.html you have to come from example.com/thepageyouareallowedtocomefrom.html LOL. I know its crazy and there may be better ways to do what I am thinking of but anything that would get the job done would be great. Basic js or php would work best. Thanks guys!
nighthawks
01-15-2009, 11:38 AM
Its a good question, its too crazy.
Webmasters please take it as a challenge.
Snookerman
01-15-2009, 11:53 AM
That could be done with .htaccess (possibly) or with cookies (probably), take a look at this article:
http://www.webmasterworld.com/forum92/1292.htm (http://www.webmasterworld.com/forum92/1292.htm)
Good luck!
QuinS33
01-17-2009, 06:40 AM
Yeah you can do this with php and luckily its pretty basic. What you are asking about is called the Referer URL. In PHP it is accessed like so: "@$HTTP_REFERER"
here is an example that tests if the user came from 'http://www.example.com/allow.html'
<?php
$ref=@$HTTP_REFERER;
if($ref == 'http://www.example.com/allow.html')
{
echo "<html><head></head><body><p>Hello World!</p></body></html>";
}
else
{
die "Wrong way";
}
?>
Thats a simple example. And with alittle more work you could have it doing what you want.
npsari
01-22-2009, 12:02 AM
Exactly what i was thinking
Use >>>>>> $ref=@$HTTP_REFERER;
Then add a normal if function
Note that the people may come from
http://www.example.com/allow.html or http://example.com/allow.html
So....
<?php
$ref=@$HTTP_REFERER;
if($ref == 'http://www.example.com/allow.html' OR $ref == 'http://example.com/allow.html' )
{
echo "<html><head></head><body><p>Hello World!</p></body></html>";
}
else
{
die "Wrong way";
}
?>
Master_script_maker
01-22-2009, 01:16 AM
$ref=@$HTTP_REFERER
This is depreciated use $ref=$_SERVER['HTTP_REFERER'] instead.
Jerome
01-22-2009, 12:51 PM
Maybe a differrent approach like using a password lock for the page mentioned.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.