Show DevBest [TuT]Maintenance Mysql/PHP[TuT]

Status
Not open for further replies.

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
How to make an Maintenance

Requirements:
- Xampp or webhost
- NotePad ++
- ME!

Now Starting:
Now lets go to mysql on my xampp
ChCKsXVGKtb0.png


create a table name: maintenance and number of columns: 1 and press go!
ym6KxYe0Mtb0.png

then the table should load up.. now name: status type: INT & Default: 1(1 = on, 0 = off) and now save!

now lets start coding!

config.php:
PHP:
<?php
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
?>

on Index or header put this on top:
PHP:
<?php
include 'config.php';
                $result = mysql_query("SELECT * FROM maintenance");
 
                while($row = mysql_fetch_array($result))
                if($row['status'] == 0):
                header("Location: ./maintenance.php");
        endif;
?>

then on Admin Panel create a Maintenance page, and add this:
PHP:
<?php
if(isset($_GET['save'])): {
$status = $_POST['status'];
include './config.php';
$query = "UPDATE maintenance SET status='".  $status  ."'";
$result = mysql_query($query);
endif;
}
?>
<form name="status" action="maintenance.php?save" method="POST">
<div align="center"></div>
<tr><th>
<input type="text" name="status" />
<input type="submit" value="Now" name="submit"></th></tr>
</select>
</form>

Then there you had created a an index that lead to maintenance
now you have to make a maintenance at the root of the file!!

My SupremeCMS maintenance.php:
qQWqjBOFbAb0.jpg

This code is in SupremeCMS :D
if it dont work add id on table and make it primary.
and fix this:
PHP:
<?php
if(isset($_GET['save'])): {
$status = $_POST['status'];
include './config.php';
$query = "UPDATE maintenance SET status='".  $status  ."' WHERE id='1'";
$result = mysql_query($query);
endif;
}
?>
<form name="status" action="maintenance.php?save" method="POST">
<div align="center"></div>
<tr><th>
<input type="text" name="status" />
<input type="submit" value="Now" name="submit"></th></tr>
</select>
</form>
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
I like this, it's basically the same as the one I released, only using SQL. Nice job. I'd recommend coding a little login page too, nothing fancy, you can set the username & password as variables to make it even easier.

thanks plus some coders on hhere are asses wont help no one except for m0sta
I know you're referring to me, You asked for me to build your CMS with you, never asked for actual help.
 

DaLightz

See ya'll in the afterlife.
May 19, 2012
1,136
262
I like this, it's basically the same as the one I released, only using SQL. Nice job. I'd recommend coding a little login page too, nothing fancy, you can set the username & password as variables to make it even easier.
Right right, or make it so rank4+ can avoid the maint.
 

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
I like this, it's basically the same as the one I released, only using SQL. Nice job. I'd recommend coding a little login page too, nothing fancy, you can set the username & password as variables to make it even easier.
Well then you never saw my CMS :D
 
Status
Not open for further replies.

Users who are viewing this thread

Top