Received: from waugh.econ.queensu.ca (waugh.econ.QueensU.CA [130.15.74.5]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f2TNfOK22516 for ; Thu, 29 Mar 2001 18:41:24 -0500 (EST) (envelope-from drew@waugh.econ.queensu.ca) Received: from drew by waugh.econ.queensu.ca with local (Exim 3.12 #1 (Debian)) id 14im2X-0003KA-00 for ; Thu, 29 Mar 2001 18:41:17 -0500 Date: Thu, 29 Mar 2001 18:41:17 -0500 To: "[PHP] PostgreSQL" Subject: Re: the "correct" way to login. Message-ID: <20010329184117.A12756@waugh.econ.queensu.ca> References: <01031319422609.24705@math.unl.edu.ar> <20010315053738.A15125@waugh.econ.queensu.ca> <008301c0ad49$b9dd9ba0$4905a8c0@bh.embare.com.br> <002f01c0ad7e$2114cdf0$533987cf@corp.peoplesoft.com> <006e01c0aec8$c90ae300$6501a8c0@genesis> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <006e01c0aec8$c90ae300$6501a8c0@genesis>; from jon@tgpsolutions.com on Sat, Mar 17, 2001 at 01:58:15AM -0800 From: Andrew Hammond X-Archive-Number: 200103/63 X-Sequence-Number: 248 On Sat, Mar 17, 2001 at 01:58:15AM -0800, Jon Tai wrote: > HTTP auth is bad for several reasons. > > 1) The user/pass is submitted upon each request to the page. As it is with the cookie solution you provide below. Assuming you have one, what's your point? > 2) There is no way to control how long a session lasts (auto-logout after a > certain time) That is incorrect. Not only is this possible but it's relatively trivial. I know because I've done it. > 3) There is no way to end the session explicitly (logout button) IBID. And a much more severe problem is present with your form based login. You may be shocked to hear this, but some web browsers have a history feature which allows evil bad people to discover userid/password combinations in URL's accessed by GET forms. So of course you have to POST the form instead. The variables from POSTed forms are typically cached so you'd better not forget to expire the content. So you're good to go, except for that damned cookie file. While you can easily set a expiry date on a cookie, that doesn't necessarily purge it from the cookie file. In fact, some browsers only vacuum their cookie jar on startup / shutdown. And it doesn't take a whole lot of clue to dissect a cookie file. > 4) There is built-in session support in PHP4. Use it. =) There is built-in authorization support in the HTTP standard. Use it. Try reading "HTTP 1.1" RFC 2068 sections 10.4.2, 11 and 14.8. So, I say again: the correct way to solve this problem is to use HTTP authentication. Standards exist for a reason.