13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

524 Chapter 23 Using Session Control in <strong>PHP</strong><br />

This code is simple, but you need to do a little fancy footwork.You start a session, store<br />

the user’s old username, unset the valid_user variable, <strong>and</strong> destroy the session.You then<br />

give the user a message that will be different if she was logged out or was not logged in<br />

to begin with.<br />

This simple set of scripts forms the basis for a lot of the work we’ll do in later<br />

chapters.<br />

Further Reading<br />

You can read more about cookies at http://wp.netscape.com/newsref/std/cookie_<br />

spec.html.<br />

Next<br />

We’re almost finished with this part of the book. Before we move on to the projects, we<br />

briefly discuss some of the useful odds <strong>and</strong> ends of <strong>PHP</strong> that we haven’t covered elsewhere.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!