Creating an activity log
The idea here is to create an activity log for bookings to a file on the server.
Below there are a lot of steps that I attempted to get to where I wanted. The use of SESSIONS was dropped due to the fact that cookies were used, even though they were set on the server-side (this distincion would not be understood by the "unwashed").
The outcome of all this was a quite simple addition to a form. The logging code amounts to just 4 lines of php - this can be modified to include the logging info for seperate events or activities. In addition, I have added a facility to review the log files and a means to reset them. The review and deletion will only be available to administrators of the Village Hall Commitee.
The testing of the logging function is carried out on the test form, where an optional email cn also be sent. This can be used to develop new form techniques outside of the Village Hall "live" website.
Steps that were performed to get to where I wanted
Data will be passed between the booking forms and the logging php via a PHP session.
Creating and appending data to a file
This following PHP file (booking_log.php) should create and append to a file called booking_log.txt
The process above is quite trivial and just adds a line to the file. The data is set in a session in sessions.php - The page php sessions needs to be run to set the SESSION variables.
What I am trying to do
First, for this test (proof of concept) I need a simple form that has SESSIONS enabled. This form can be based on the Village Hall template - test_form.php
Problem that I am seeing
When I started the validation of the forms I changed from my original use of the GET method to a POST. This was how the examples on the W3C site had said. I assumed that this was mainly due to security concerns as the form variable are passed to the processing php via the URL.
The use of SESSIONS sets a server-side cookie
If I get the logging to work it may need to be embeded into the form php.
Date and time stamp
The format of the PHP functions are:
// Prints the day, date, month, year, time, AM or PM
echo date("l jS \of F Y h:i:s A") . "<br>";
// Prints October 3, 1975 was on a Friday - adapt this to get correct format for booking date of event.
echo "Oct 3,1975 was on a ".date("l", mktime(0,0,0,10,3,1975)) . "<br>";
The mktime function returns a Unix timestamp hour minute second month day year etc i.e daylight savings time
so mktime(0,0,0,10,3,1975) is midnight on the American date of 3rd of October 1975 actually the 2nd
Activity Log Administration
The ability to open and view the log and to reset it to an empty file.