PHP Solutions

Chapter 9

The theme of this chapter is logins and multi-page forms.

Solution Index

PHP Solution 9-1
A simple session example
This doesn't quite work on my server, but if it were, the name entered on the first page would appear on the third with a PHP-specific error.
PHP Solution 9-2
Buffering the output with ob_start
Again, doesn't work on my server. It's still forgetting the session on the third page. However, if it were working, the error that should have appeared in the previous exercise would be gone.
PHP Solution 9-3
Building the login page
The logins are — • chris/codeslave • david/bigboss — but this still doesn't work on my server. Sessions aren't working.
PHP Solution 9-4
Restricing access to a page with a session
This doesn't work, but the point is that, had they worked, going to session protected pages after logging in would not redirect to the login page.
PHP Solution 9-5
Creating a reusable logout button
This (again) doesn't work for me, so I just included the code that should work.
PHP Solution 9-6
Creating a file-based user registration form
Yay! Something that works! Create a username and password. The password is encrypted on the server, you can see the results, if you like. By the way, that is not the password; it's encrypted so you can't glean the password just from having the file.
PHP Solution 9-7
Using an encrypted login
Make a username and password in Solution 9-6, then use it in this solution. The sessions aspect of this still doesn't work, but the usernames and passwords do.
PHP Solution 9-8
Ending a session after a period of inactivity
Yeah, I don't know if this is working or not...but the session is supposed to expire in 15 seconds.
PHP Solution 9-9
Using sessions for a multipage form
I did not do this solution, because there is no way to test it on my server.