582 Part IV: Using PHP for Sysadmin Tasks (Florida web design)

582 Part IV: Using PHP for Sysadmin Tasks The default content type is set to text/plain in this function. Then the $body string is created by concatenating the lines in the $messages array using the implode() function. Both the $body and the $subject line are parsed for the <%TODAY%> tag, which is replaced with the current date and time. The $subject line is stored outside the $headers array even though it is a header too. This is done because the PHP mail() function requires the subject as a separate argument from the other headers. The same is true for the To: header, which is also stored outside $headers in $to . Finally, the $headers are imploded into $headerString, and the mail() function is called with all the necessary arguments. The mail is sent out. If the actual mail() function encounters any errors a log entry is added to that effect. getRemindersForToday () This function receives a list of lines (the contents of the reminders.txt file), and parses through each line to determine whether the line is a reminder configuration or should be ignored (blank or a comment line starting with the # character). Each reminder configuration line is compared against the current date (MM, DD, and weekday) values to determine whether any of the lines match a reminder for today. If a match is found, the reminder mail filename is added into the $reminders array, which is returned by the function. writeLog () This function writes a log file as ~username/reminders/username.log. The log entries are generated by other functions in the script. getUsers () This function loads the user list file (/etc/passwd) in an array, loops through each record, and finds the username (field position 0) and home directory (field position 5) from each line separated by colons. It stores each username and home directory in an associative array called $user and returns it. Installing the reminder tool as a cron job To set up reminder.php as a cron job under Linux, do the following: 1. As root, create a symbolic link in /etc/cron.daily as follows: ln -s /path/to/reminder.php

WordPress database error: [Table 'armadillowebhosting_com_-_jsp.wp_comments' doesn't exist]
SELECT * FROM wp_comments WHERE comment_post_ID = '638' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply