- Joined
- Jun 27, 2009
- Messages
- 1,571
- Reaction score
- 170
Hello!
I need assistance with Maintenance System for BrainCMS.
Here is my checkMaintenance function.
Now when I attempt to use it on my site I do get the return for "Admin::succeed" but its not updating my selection in database.
Here is my Code:
The problem is it's not updating in the database.
SQL:
I need assistance with Maintenance System for BrainCMS.
Here is my checkMaintenance function.
PHP:
function checkMaintenance()
{
global $config, $dbh;
if (isset($_POST['checkMaintenance']))
{
switch ($_POST['siteOption']) {
case 1:
$siteMode = "Site Open";
break;
case 2:
$siteMode = "Site Closed";
break;
}
$checkMaintenance = $dbh->prepare("INSERT INTO cms_system (site_closed) VALUES(:siteOption)");
$checkMaintenance->bindParam(':siteMode', $siteMode);
$checkMaintenance->execute();
Admin::succeed("Maintenance Mode Enabled");
}
}
Now when I attempt to use it on my site I do get the return for "Admin::succeed" but its not updating my selection in database.
Here is my Code:
PHP:
<form action="" method='POST' name='theAdminForm' id='theAdminForm'>
<div class='tableborder'>
<div class='tableheaderalt'>Turn your site on/off</div>
<?php admin::checkMaintenance(); ?>
<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1' width='40%' valign='middle'><b>Close Site</b><div class='graytext'>If enabled, your site will be closed and show a maintenance page to regular users. Administrators can still login through Housekeeping.</div></td>
<td class='tablerow2' width='60%' valign='middle'>
<select name="checkMaintenance" class='dropdown'>
<option name="siteOption" value='1'>Site Open</option>
<option name="siteOption" value='2'>Site Closed</option>
</select>
</td>
</tr>
<tr>
<tr><td align='center' class='tablesubheader' colspan='2' ><input type='submit' value='Apply' class='realbutton' accesskey='s'></td></tr>
</form>
The problem is it's not updating in the database.
SQL:
PHP:
CREATE TABLE `cms_system` (
`systemVar` varchar(50) NOT NULL,
`value` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cms_system`
--
INSERT INTO `cms_system` (`systemVar`, `value`) VALUES
('ip', '127.0.0.1'),
('language', 'en'),
('localhost', '0'),
('reload_url', 'http://127.0.0.1/holov3/client.php'),
('site_closed', '0');