[nycphp-talk] Login schemes.
tomsartain at gmail.com
Thu Aug 16 13:53:52 EDT 2007
On 8/16/07, Anthony Wlodarski <aw at sap8.com> wrote:
> I was thinking about login schemes so I had an idea about using a form on
> the front page which would authenticate against a database (already done
> this part) but I am having problems getting people to the members/lobby
> area. One way of doing it is to use the $_SERVER['PHP_SELF'] variable and
> when index.php calls itself the checks for cookie data would tell them
> that they have successfully logged in and maybe use an include statement.
> The other alternative is that as soon as the checks against the SQL database
> are complete I could use a header ("Location: ./foobar.php") statement to
> move them to the right page and then pull data based on the user id that is
> stored in a session/cookie, but the problem is that once I send a HTML
> header (stylesheets for the form) I can't use the header function as it
> burps an error.
> How do you guys handle events like this?
Output buffering. It's fantastic. http://us3.php.net/ob_start
You can change the headers anywhere you like in your script, and not have to
worry about it tossing errors.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk