Building web applications with membership management is one of the most frequent tasks that every programmer does. Managing membership data, such as username, password and the member's profile with sessions in PHP is the easiest and simplest solution, although it is not the only one.
Login using Cookies
Copy and paste the following code into your body tags and run it (code comments are included).
If you want to see the live result, try it here (new window).
This script set a cookie to save the user information sent by an online form. The online form is displayed only if the cookies has been saved.
PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. You can set cookies using the setcookie() or setrawcookie() function.
This simple code shows you how to use cookies (THE BASICS OF IT!). This code basically checks if the user has been on the site before. It first sets a cookie and then checks if it exists using an IF.
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.