In the book €œThe Joy of PHP€ we introduced new programmers to the world of creating interactive web sites using PHP. To make the topic more interesting we invented a case study of €œSam€s Used Cars€ to describe the how someone who sells used cars could use PHP and mySQL together to create a website that accurately reflects the ever-changing inventory of used cars. That book has been a consistent best-seller and is the top-rated book in its primary category (Computers & Technology --> Programming --> PHP).
Readers told me (overwhelmingly) that they wanted more, and specifically wanted a series short books that cover a particular topic in detail. This way you can pick out just the topics that interest you.
In this SHORT book we extend Sam€s story (and the accompanying sample website and source code) to take advantage of a feature of PHP called €œsessions€Â. By using sessions we€ll allow people to log into Sam€s website (if they want to) and present different features and information to different people.
For example, Sam (the owner) should be able to see how much a car actually cost while the car shopper should only be able to see the asking price. Other features might be appropriate for sales people, data entry people, etc. We call this role-based features and explain how it works in the book.
This book will walk you through--step by step-- in creating a user table in your cars database to store users' name, password and role. We'll explain how to create a login form, submit that form to a PHP script to perform the necessary user lookup, and then assign the user a set of session variables to that user based on who they are.
Every line of code is explained in clear, easy-to-understand English.
While it isn€t required that you first read The Joy of PHP, I do (naturally) recommend it. This book is a continuation of that story and builds on the knowledge (and code base) that The Joy of PHP presents. Although I€ll try to make this book stand on its own, I do want you to succeed so I€ll warn you right up front. For this book to make sense, you will need to know some basic PHP syntax, you will have PHP already installed and running on your computer, and you will know how to use phpMyAdmin. You will also need to know basic SQL queries such as INSERT, UPDATE, DELETE, and CREATE TABLE. If you know these things already then you should be just fine with this book. Amazon even lets you return it if you are not satisfied.
Are you ready to take the next step and take a Deep Dive into Sessions?