Stopping a user from browsing via the address bar?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Stopping a user from browsing via the address bar?

Post by DynamiteHost »

Hello,

How would I be able to stop a user from using the address bar of their browser to navigate a section of my site? I want it so they have to click the links to navigate....

Thanks!
f1nutter
Forum Contributor
Posts: 125
Joined: Wed Jun 05, 2002 12:08 pm
Location: London

Post by f1nutter »

You could open your site up in a new window with JavaScript. Just leave out the address bar. Have a look at the JavaScript documentation to find out what you can put in the third parameter.

Code: Select all

window.open('page_name.htm', 'window_name', 'width=600,height=800');
However, you could view the source of the page, find the link, and open a full browser your self. PHP won't be able to help here, its server-side, and this is a client-side problem.
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

The thing is, I know it can be done with Perl because i've seen it...
i'm not sure about PHP though.... there must be some sort of way even if its complicated...

:(
Sunthas
Forum Newbie
Posts: 9
Joined: Sun Dec 08, 2002 12:43 am

Post by Sunthas »

Can't you setup Apache and certian directories using .htaccess to only allow access to files when linked from within? Same way you keep someone from using their images on your website without hosting them themselves.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

you would have to make a form for each link and then use javascript to submit it by the click of a link, then use POST to determine the content.
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post by dusty »

Code: Select all

if(empty($_SERVER['HTTP_REFERER'])) die("Do not enter URLS manually");
try putting this at the top of your pages
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

Thanks dusty, thats exactly what i'm looking for!

How would I be able to do this:

Code: Select all

if NOT (empty($_SERVERї'HTTP_REFERER'])) {

}
Thanks :)
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post by dusty »

if(!empty($_SERVER...
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

whenever the client sends a referer the script shall die?
unlikely ;)
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

er... it works so.... whatever...
Post Reply