|
|
|
|
|
|
|
|
Creating a PHP-Based Content Management System, Part 5
Peter Zeidman 11/8/2004 Go to page: 1 2
Creating the Login Form We're going to create a form to allow the user to login using the Sentry class we created on the previous page. You can create this using any HTML editor, I include a simple one in the source files at the end. We want it to look something like:
Make sure the form's action is set to the filename of the page containing it (e.g., login.php), and the method is set to post. The PHP we put on this page is simple: <?php $sentry = new Sentry(); // Create a sentry object // Check the user's submitted login
is valid
} // Log out the user
} And that should all work nicely. The final step is to secure a page. For the purposes of the demonstration we'll create a page called welcome.php, that just says "welcome to the admin area." We only want people in groups 1 and 2 (admin and editors) to be able to access it, so at the start of the file we put: <?php And hey presto, your page is secure. Make sure you include that code on every page you want to protect. Once you have these basics in place, creating a fully fledged user management system isn't far away. You can create pages to allow for the automatic signup, editing, deleting and emailing of your members. Samples of all of these functions will be included in the final part of the series, which you can find here next month. Until next time! Source Files: Windows .zip Read Part 6 of this series at: http://www.intranetjournal.com/articles/200412/ij_12_08_04a.html
Go to page: 1 2
|
Intranet Journal's Tutorials |
|
Managing Editor |