452 Part III: Developing E-mail Solutions Creating a (Web hosting isp)

452 Part III: Developing E-mail Solutions Creating a Tell-a-Friend Form Manager Application This application, taf_form_mngr.php, is responsible for managing forms. This application is included on the CD-ROM in the ch13/apps directory. It implements the following functionality: . Allows any user to add a new form. . Allows users from authenticated IP addresses to delete or modify selected forms. This application has the following methods. run() When the application is run, this method is called. It does the following: . First it retrieves the $cmd value from the user request. . Depending on the $cmd value, different methods are called. . When the $cmd is add or modify, it calls the addModifyDriver() method with the appropriate mode (add or modify). . And when the $cmd is delete, it calls the deleteForm() method to delete the form. authorize() This method checks whether the IP address from where the user is accessing the application is an authorized one. This is how it works: . This application allows everyone to add forms. So when the request $cmd is add, it directly returns true. . In case of modify and delete, the AccessControl object is used to verify whether the request IP is allowed to access the given form. It returns TRUE or FALSE depending on the verification result. addModifyDriver() This method is responsible for driving the add/modify procedure. Depending on the hidden form value $step, it decides whether to call the add/modify menu rendering method, displayAddModifyMenu(), or the add/modify method, addModifyForm(). Both the methods are called with the proper mode (add or modify).

Leave a Reply