You need to be using sessions for your login system, not cookies. The only way a cookie relates to a login system is possibly auto filling the user/pass -or- auto logging returning customers (if they accepted your cookies, just like webmaster-talk.com does).
Your login page will look "similar" to this:
session_start();
if ($login) {
$valid_user = $username;
session_register("valid_user"); }
On any pages you want protected by login, just add this at the top of the page:
session_start();
if (!session_is_registered("valid_user")) {
header("Location: login.php"); }
Content for logged people will go here.
Realize this is a very basic sample. I'd do some reading on sessions.
Jim Webster
http://www.idevdirect.com/
|