Re: Another sessions question
| From: | Scott Fletcher | Date: | Wed, 30 Apr 2003 14:13:27 +0000 |
| Subject: | Re: Another sessions question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145776@lists.php.net to get a copy of this message | ||
There is other method of error checking for the login feature only. What I
do is I don't create a session, instead what I do is to display the html
login form. When the user submit it, the webpage reload by itself upon
submit by using $PHP_SELF in the action attribute. This is when I receive
the user id and password then I run the database query to see if there is a
match or not. Well, I'm using database because of lot of information on hte
website require the use of the database, so since I have it, so I use it
anyway. If there is no match then I use the header() to move the webpage
back to the login page with a failed message. If there is a match, then I
create a session before using hte header() to direct the user to a different
webpage. This amke it possible for me to put most of the database info into
the session before going to the next webpage...
As for the error session, I'll leave that open to interpretation.
FletchSOD
"C.R." <odcs@rogers.com> wrote in message
news:000801c30f9d$c4f50560$6401a8c0@p1...
> I have a login, registration, update, and a form if you forget your
> password. I am using sessions to control the login and error messages. So
> this is my problem
>
> When a user enters the login page a session is started, if the user enters
> the wrong login info they will get an error message which is set in a
> session variable called $error['whatever'] (this will change depending on
> the error). If the user then decides he should register first, and goes to
> the register page - he gets a message on the page that simply says
'Array'.
> This is because the session is still active and $error['whatever'] is
still
> set, although I've cleared the array with - $error = array(); On each
page
> I have something like if($error) { echo $error['whatever']; }. I have used
> done it this way to make things more uniform and understandable, but I may
> also have shot myself in the foot - is there a way to get around this
> without having to change the session variables for each of these pages.
>
> I hope I have explained this properly, or for that matter used sessions
> properly - I am still trying to learn about sessions and problems like
this
> keep popping up.
>
> TIA
>
>