Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

direct typing url not allowed

0 views
Skip to first unread message

Birdy

unread,
Jan 14, 2003, 11:50:13 AM1/14/03
to
Hello everybody,

Does anobody know how to prevent visitors on the internet to type in
directly a URL to enter a page on my site.
I want this because de ïndex.htm alway should be loaded first before anybode
can enter other sections of the site.

Now they enter the Forum by typing in the url and that is what i want to
prevent.

Thanks


Hades

unread,
Jan 14, 2003, 12:18:39 PM1/14/03
to

"Birdy" <webm...@z-a-m.org> wrote in message
news:1042563002.386777@cache1...

Set a session variable on your index page, then check to see that the
variable isset() on all other pages.

If it is they've been to the index page, otherwise redirect them to it.

Hope that helps, although sessions are not so reliable unless you also use
SID to append to urls.

Regards,

Lee Conlin


Kevin Thorpe

unread,
Jan 15, 2003, 6:19:51 AM1/15/03
to

You can check $_SERVER['HTTP_REFERER'] to see where this page has been
linked from.

If it doesn't start with your website address then header('Location:
http://my.server.com/') to bounce them to the index.

I use this on a lot of my pages to wrap pages in my frameset if another
site has deep linked to them.

<?php
if (substr($_SERVER['HTTP_REFERER'],0,20) != 'http://my.server.com') {
header("Location: http://my.server.com/frame.php?page=".
$_SERVER['SCRIPT_URL']);
exit();
}
?>
<html>
...
...

.... obviously frame.php has to do some security checking.

Steven Vasilogianis

unread,
Jan 15, 2003, 2:53:47 PM1/15/03
to
In article <3e2541e0$0$26381$afc3...@news.easynet.co.uk>,
ke...@pricetrak.com says...

> Birdy wrote:
> > Does anobody know how to prevent visitors on the internet to type in
> > directly a URL to enter a page on my site.
> > I want this because de ïndex.htm alway should be loaded first before anybode
> > can enter other sections of the site.
> >
> > Now they enter the Forum by typing in the url and that is what i want to
> > prevent.

I doubt they're typing it in, they're most likely using a bookmark. This
is a good thing.

> You can check $_SERVER['HTTP_REFERER'] to see where this page has been
> linked from.

"'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will
set this, and some provide the ability to modify HTTP_REFERER as a
feature. In short, it cannot really be trusted." -
<http://www.php.net/manual/en/reserved.variables.php#reserved.variables.
server>

Anyway, I can think of no better way to piss off visitors then to force
them to enter through the home page.

"I do not like this approach to linking because it contradicts the
basic nature of the Web: Users are in control of their own destiny.
Get over it. You don't own them." - Jakob Nielsen

So your choice is to either set a session on the index page and require
its presence on the forum (as explained in another thread), or drop the
awful concept of linearizing the web. It's obvious which is the better
choice.

HTH,
--
steven vasilogianis

0 new messages