PDA

View Full Version : Can only enter site from certain URL.



Jahova
03-01-2009, 10:12 PM
Hey there, is there like a PHP script to stop people coming from somewhere else such as just from typing the url into the browser. But only able to view the site if they were directed from another page on the site.

If you could tell me if this is possible and where I could find code to do this, then that would be great.

- T.

Jackboy
03-01-2009, 10:14 PM
Hey there, is there like a PHP script to stop people coming from somewhere else such as just from typing the url into the browser. But only able to view the site if they were directed from another page on the site.

If you could tell me if this is possible and where I could find code to do this, then that would be great.

- T.

yh

$_SERVER[HTTP_REFERER]

Flisker
03-01-2009, 10:50 PM
yh

$_SERVER[HTTP_REFERER]


<?php

if($_SERVER[HTTP_REFERRER] == "url") {

page here

}else{
exit("Access Denied");
}
?>

Iszak
03-01-2009, 11:36 PM
But be aware people can quite easily spoof it.

Trigs
03-01-2009, 11:39 PM
If you want it to allow someone who was directed from any url it would be:

if( $_SERVER[HTTP_REFERRER] == NULL ) {
. die('soz no access');\
} else {

}

Jahova
04-01-2009, 08:24 AM
But be aware people can quite easily spoof it.
Any like security I could add, ect?

Jahova
04-01-2009, 08:47 AM
Sorry for double post, but the limit has just expired!
None of the above seem to work for me, and what I want is like;

if( $_SERVER[HTTP_REFERRER] == "pagea.php" ) {
SHOW THE PAGE, otherwise..
} else {
exit("Sorry, you need to follow the correct url.");
}

Jxhn
04-01-2009, 08:56 AM
Sorry for double post, but the limit has just expired!
None of the above seem to work for me, and what I want is like;

if( $_SERVER[HTTP_REFERRER] == "pagea.php" ) {
SHOW THE PAGE, otherwise..
} else {
exit("Sorry, you need to follow the correct url.");
}

I think it has to be an absolute url. If that still doesn't work try changing $_SERVER[HTTP_REFERRER] to $_SERVER['HTTP_REFERRER']. There is no way of stopping it from being spoofed. You could add a cookie on pagea.php and check for it on pageb.php instead.

timROGERS
04-01-2009, 09:18 AM
If you're serious about this I would try to HTTP referrer method and the cookie method - that way people will only get through if they can really be bothered :P

Jahova
04-01-2009, 09:51 AM
KK thanks.
Thread closed.

Jackboy
04-01-2009, 10:13 AM
But be aware people can quite easily spoof it.

Yeh hes right. People can just visit say paymentfinished.php and even if it denies them, they type in the link to your site and it counts as they have:p

Mistajam
04-01-2009, 10:48 AM
use htaccess?



SetEnvIfNoCase Referer http://example\.com allow_download
Order Deny,Allow
Allow from env=allow_download
Deny from all
Also i used it for a counter strike server the sv_downloadurl to only allow users on my server to connect to my web server to download files, so it may not work, you'll have to see.

Jackboy
04-01-2009, 10:54 AM
Imo, if you know how to, PHP is good for it.

I have never used .htaccess for it :P

Clownin
04-01-2009, 10:55 AM
KK thanks.
Thread closed.
Contact a member of the site to close the forum thread.

Robbie
04-01-2009, 10:58 AM
Contact a member of the site to close the forum thread.

We won't close them, you must have VIP

Mistajam
04-01-2009, 11:01 AM
To tell you the truth this might be handy in the future days for others, therefore I would say keep it open anyway.

Jackboy
04-01-2009, 11:10 AM
We won't close them, you must have VIP

Thankyou for your comments :)

Jahova
04-01-2009, 01:34 PM
Thankyou for your comments :)
Thank you for your comments.

Jackboy
04-01-2009, 01:37 PM
Thank you for your comments.

Lol, my EngLish is beter then urs.


It was a personal joke between me and Robbie! you silly monkey.

Protege
05-01-2009, 07:42 AM
Lol, my EngLish is beter then urs.


It was a personal joke between me and Robbie! you silly monkey.
I still laughed sorry.

Tomm
05-01-2009, 07:58 AM
I would not rely on HTTP Referrer as some security software and browsers can be configured to remove this from HTTP requests.

Jahova
05-01-2009, 04:03 PM
I've sorted this now. Thanks anyway.

Want to hide these adverts? Register an account for free!