Okay, now let's go over some of the changes we've made since part 1 of this tutorial. Some new files were added, and some scripts were changed to include new functions. Added 2 new configuration variables:
The value of $ME is now set by a function called qualified_me(), instead of just using $SCRIPT_NAME. A bunch of new functions have been added to stdlib.php to make it more useful:
The file mymarket.php contains some standard functions that are used by this application. For example, the build_category_list() function that used to be in admin/products.php has been moved here so that we can use it in other scripts as well (eg. the admin/categories.php page). The other functions in this script are:
Now that we've got login and privileges in place, we can put some protection on our administrative pages. If you look at the administrative pages:
You will see two new commands at the top of the file: require_login() and require_priv(). The first function makes sure the user has logged in (if not, it will present the login screen) and the latter function makes sure the user has the required privileges. The file admin/users.php is a new administrative screen that lets you (the administrator) create, edit, and remove users. It is built like the other maintenance screens, so look at the source code for details. The file admin/categories.php has been modified so that it presents the list of parent categories in a bigger list box, like the one in products.php. This doesn't really have anything to do with user management, but I thought it would be a nice change to make :) The file admin/products.php has been modified, the build_category_tree function was taken from here and placed into the shared lib/mymarket.php file. All our shared functions that are specific to MyMarket will be kept in lib/mymarket.php.
blog comments powered by Disqus |