dynamic_php
1| <!-- Place script here -->
2| <?php
3|
4| define("LIST_ONE", "dynamic.dat");
5|
6| //Read in the external functions file
7| require("dynamic_routines.php");
8|
9| $file_passed_tests = true;
10|
11| //Does the file exist?
12| if(!file_lives(LIST_ONE))
13| {
14| $file_passed_tests = false;
15| }
16| else
17| {
18| //Can the file be read?
19| if(!file_is_readable(LIST_ONE))
20| {
21| $file_passed_tests = false;
22| }
23| }
24|
25| //Did not pass test
26| if(!$file_passed_tests)
27| {
28| error_page("Dynamic List Web Page", "Web page is unavailable at this time. Please come back later.");
29|
30| exit();
31| }
32|
33| ?>
34| <html>
35| <head>
36| <title>Dynamic Web Page</title>
37| </head>
38|
39| <table>
40| <tr>
41| <td>
42| <img src='ratscheese.gif' border='0' />
43| </td>
44|
45| <td>
46| <table>
47| <tr>
48|
<td class='center'><h1>Dynamic Web Page</h1></td>
49| </tr>
50| </table>
51| </td>
52| </tr>
53| <tr>
54| <td><h2>Please note the following events:</h2></td>v
55| </tr>
56| <tr>
57| <td>
58|
59| <!-- Nested table -->
60| <table>
61| <tr><td>
62| <ul>
63|
64| <!-- Place script here -->
65| <?php
66|
67| $all_records = array();
68|
69| //Open the file for reading only
70| $fHandle = open_a_file(LIST_ONE, "r");
71|
72| //Did the file open
73| if($fHandle)
74| {
75| $all_records = read_file_by_record($fHandle);
76|
77| close_a_file($fHandle);
78|
79| //select only valid records
80| $all_records = validate_records($all_records, 9, "|", 9);
81|
82| //sort in date order
83| sort($all_records);
84|
85| //strip off sort data and bar
86| $all_records = retrieve_data_only($all_records, "|", 1);
87|
88| if(count($all_records) > 0)
89| {
90| foreach($all_records as $record)
91| {
92| echo "<li>$record</li>";
93| }
94| }
95| else
96| {
97| echo "<li>No events at this time.</li>";
98| }
99| }
100|
101| ?>
102| </ul>
103| </td></tr>
104|
105| </table>
106| <!-- end of nested table -->
107|
108| </td>
109| </tr>
110|
111| </table>
112| </body>
113| </html>