Maintenance System.

Detox

Member
Jul 24, 2010
365
24
Hello!

I need some professionals help on this and Im puzzled.

So I'm trying to re-create HoloCMS housekeeping Theme with BrainCMS and I know Brain is poorly coded but this is just for educational purpose. Once I get the assistance I'm looking for from this community. I am planing on releasing all my work to community as there is lot of new beginners.

Anyways with that being said let's begin.

So what matter what code I use, its not updating into the database and I'm puzzled. It's all here to look at.

Modified Code:

All of this is currently in my class.admin.php

PHP:
function checkMaintenance()
    {
        global $dbh;
        if (isset($_POST['checkMaintenance']))
        {
       
            $siteMode = $_POST['site_closed'];

                }
                $checkMaintenance = $dbh->prepare("UPDATE cms_site SET siteMode=:site_closed");
                $checkMaintenance->bindParam();
                $checkMaintenance->execute();

                if ($checkMaintenance) {
                    Admin::succeed("Maintenance Mode Enabled");
                }
               
            }

PHP:
public static function siteMode()
        {
            global $dbh;
            if (isset($_POST['siteMode']))
            {
                if (!empty($_POST['siteMode']))
                {
                    if (!empty($_POST['siteMode']))
                    {
                        $closedSite = $dbh->prepare("UPDATE cms_site(site_closed)
                        VALUES
                        (
                        :site_closed
                        )");
                        $closedSite->bindParam(':site_closed', $_POST['site_closed']);
                        $closedSite->execute();
                        Admin::succeed("Site Closed?");
                    }
                    else
                    {
                        Admin::error("Fuc*ing Messed Up");
                        return;
                    }
                }
           
        }
    }

PHP:
public static function UpdateSite()
        {
            global $dbh;
            if (isset($_POST['update']))
            {
                $updateSite = $dbh->prepare("UPDATE cms_site SET
                site_closed=:site_closed,
                WHERE site_closed = :site_closed");
                $updateSite->bindParam(':site_closed', $_POST['site_closed']);
                $updateSite->execute();
                Admin::succeed("I highly doubt this updated the database");
            }
        }

Here is my sitesettings.php

PHP:
<?php
    include_once "includes/head.php";
    include_once "includes/header.php";
    //include_once "includes/navi.php";
?>
<table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
<tr> <td width='22%' valign='top' id='leftblock'>
<div>
<!-- LEFT CONTEXT SENSITIVE MENU -->
<?php include_once('includes/sitenavi.php'); ?>
<!-- / LEFT CONTEXT SENSITIVE MENU -->
</div>
</td>
<td width='78%' valign='top' id='rightblock'>
<div><!-- RIGHT CONTENT BLOCK -->


<form action="" method='POST' name='theAdminForm' id='theAdminForm'>
<div class='tableborder'>
<div class='tableheaderalt'>Turn your site on/off</div>
<?php admin::updateSite(); ?>
<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="update"  class='dropdown'>
                                    <option name="siteMode" value='open'>Site Open</option>
                                    <option name="siteMode" value='closed'>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></table></div><br />     </div><!-- / RIGHT CONTENT BLOCK -->
     </td></tr>
</table>
</div><!-- / OUTERDIV -->
<div align='center'><br />
<?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Time: %.3f', $totaltime);
?>
</div>


            <?php
                include_once "includes/footer.php";
                include_once "includes/script.php";
            ?>

And yes to change the respect name class and in this following section of the code.

PHP:
 <select name="update"  class='dropdown'>

                                    <option name="siteMode" value='open'>Site Open</option>

                                    <option name="siteMode" value='closed'>Site Closed</option>          

    </select>

Here is the MySQL structure Im using.

You must be registered for see images attach


UPDATE:

I almost forgot. I do change the respect code for the function as well.

PHP:
<?php admin::updateSite(); ?>
 

Users who are viewing this thread

Top