Web hosting support - 570 Part IV: Using PHP for Sysadmin Tasks

570 Part IV: Using PHP for Sysadmin Tasks Features of the reminder tool The reminder tool will offer the following features: . It will process reminders for all users on the system. . All users can have their own set of reminders, which they can manage using configuration files and message templates. . Each reminder can be sent using a separate message template. . Types of reminders supported are daily, weekly, monthly, and yearly. . For each type of reminder, there can be an unlimited number of reminders per user. Now let s implement this tool. Implementing the reminder tool Listing 16-5 shows a configuration file that we will use for our reminder tool. The DEBUG constant will be used for enabling and disabling debug messages. The PASSWD_FILE constant points to the system s password file. You can use a different file, but two fields are required by the reminder system: username and home directory. If you use a custom user list file, make sure it mimics the /etc/passwd file in terms of the formatting and placement of username, and the home directory field. Reading man htpasswdand/or man passwdwill help with managing and mimicking the /etc/passwdfile. The $XMAILER variable is used to name the reminder in an X-header for each mail message sent. This can be set to anything. The USER_REMINDER_DIR constant is used to store the expected name of the user s reminder directory. Each user can have a reminder directory inside the home directory as ~username/%USER_REMINDER_DIR/. For example, ~kabir/reminders is the default reminder directory per the following configuration for the user kabir. Each user s reminder configuration is stored in the reminders.txt file pointed to by the USER_REMINDER_FILE constant. This file must reside in a directory specified by USER_REMINDER_DIR, within a user s home directory. For example, the user sheila, whose home directory is /home/sheila (i.e., ~sheila), can have /home/sheila/ reminders/reminders.txt as the full path for her reminder configuration file. The configuration file is as follows:

Leave a Reply