-
Notifications
You must be signed in to change notification settings - Fork 0
/
submitpage.php
executable file
·112 lines (93 loc) · 3.83 KB
/
submitpage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?
/*********************************************************************/
/*
Writen By: Martin Settle
Last Modified: December 28, 2001
Called By: infopages.php
Calls: Nothing
Description: This processes edits of the system information
pages.
Modification History:
December 28, 2001 - File created.
*/
/*********************************************************************/
/* Get the includes out of the way */
include "configuration.php";
include "connectdb.php";
/* The major piece of processing that needs to be done of entered data is
altering non-html formatted data fields to html so that the page can be
properly displayed. Of course, some only needs to be done if the data
submitted is not already HTML formatted. */
$Data = rawurldecode($Data);
if($html == 'no')
{
$Data = htmlentities($Data);
$Data = nl2br($Data);
}
/* There should be a function here to check to make sure that that no more
than one page is identified as the MainPage */
if($MainPage == 'Yes')
{
}
/* initialize a message variable */
$SystemMessage = '';
/* The process for inputting the data is dependent on whether or not the
page is being submitted for the first time. This is shown by the presence
or absence of a PageID */
if(!empty($PageID))
{
$query = "UPDATE infopages SET Parent = '$Parent', Title='$Title',Menu='$Menu', MenuPlacement='$MenuPlacement',Data='$Data',MainPage='$MainPage' WHERE PageID='$PageID'";
if(!mysql_query("$query"))
{
$title = 'InfoPage update failed';
include "header.php";
print ("The system was unable to update the info page as requested.<p>
The database returned the following:<p>");
print mysql_error();
include "footer.php";
exit();
}
$SystemMessage .= "<strong>$Title</strong> was successfully changed in the LETSystem database.<p>\n";
$time = time();
mysql_query("INSERT INTO adminactions VALUES (NULL,'$MemberID','Edited information Page #$PageID and menu priority')");
}
else
{
/* need to lookup the next priority */
$PriorityLookup = mysql_query("SELECT Max(Priority) AS Last
FROM infopages
WHERE Parent='$Parent'");
$Priority = mysql_result($PriorityLookup,0,'Last');
$Priority++;
$query = "INSERT INTO infopages VALUES ('','$Parent','$Title','$Menu','$MenuPlacement','$Priority','$Data','$MainPage')";
if(!mysql_query("$query"))
{
$title = 'Unable to add page';
include "header.php";
print ("The system was unable to add the $Title page to the LETSystem Database.<p>
The database returned the following:<p>");
print mysql_error();
include "footer.php";
exit();
}
mysql_query("INSERT INTO adminactions VALUES (NULL,'$MemberID','Added information Page #$PageID')");
$SystemMessage .= "<strong>$Title</strong> was successfully added to the LETSystem database.<p>";
include "infopages.php";
exit();
}
/* If still in this system, we may need to process priority changes. These are held
in an array of $Priority["$PageID"] */
while(list($newPageID,$newPriority) = each($MenuPriority))
{
$query = "UPDATE infopages SET Priority='$newPriority' WHERE PageID = '$newPageID'";
if(!mysql_query("$query"))
{
$SystemMessage .= "The system was unable to change the priority of page #$newPageID.<br>";
}
}
/* Should be done now, so clear the PageID (so that the infopage will show a blank
form) and exit */
unset($PageID);
include "infopages.php";
exit();
?>