On Sun, Dec 21, 2003 at 04:11:36PM -0300, Fernando M. Maresca wrote:
: On Sun, Dec 21, 2003 at 01:03:43PM -0600, Eugene Lee wrote:
: > On Sun, Dec 21, 2003 at 03:57:24PM -0300, Fernando M. Maresca wrote:
: > : 
: > : Well, i'm trying to avoid access to the site for the middle. Say
: > : there is a initial page with a form and other pages that depends
: > : on this. Is there a way to force users access the site thru the
: > : initial form page, regardless of the url?
: > : Something like this:
: > : lynx http://mysite/forma2.php/
: > : produce the browser to redirect to 
: > : http://mysite/index.php/
: > : 
: > : Of course, the forma2.php must be served if its accesed after
: > : index.php.
: > 
: > There are several ways to do this.  The most obvious is with cookies.
: > Set up your index.php to initially create a cookie that authorizes a
: > user to look in the site.  On the rest of your PHP pages, check that
: > this authorization cookie exists.  If not, redirect to index.php.
:
: Thanks for the response.
: No, this way don't do it: once the cookie is set up in the client's
: browser, there is no way for me to prevent the client to type the url
: pointing to another page, and the cookie will be valid on that page.
: What i'm trying to do is to force the client to travel pages in the
: order expected, forbidding him/her to access a page out of sequence,
: wich take him to an error message (because, for example, for abscense
: of POST data or something).
: So i'm stuck.

Not really.  It depends on how you use your cookie.  The cookie could be
some unique ID to some session-based system (whether you use PHP session
functions or not) that keeps a track of where the user is.  So let's say
the user did the right thing, went to index.php, got a cookie, and went
to the next page (let's say forma1.php).  Your session system notes that
the user is currently on forma1.php.  But the same user gets distracted,
does not go through the form normally, leaves for a few hours, and then
tries to return but jump directly to forma2.php.  Your session system
realizes that he's not supposed to be there, and kicks him out to
whereever you want him.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to