Jump to content

Simple php website shutdown script


patgod

Recommended Posts

Hi everyone,

I am look for over an hour for a simple script to "take down" my website whenever i trigger it to (though a simple backend?)

I have a website baker based website and i need to take down the site in specific times - in which the people trying to view the website will only be able to get the html page i designed for these cases.

 

Is there such a thing?

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/103706-simple-php-website-shutdown-script/
Share on other sites

create a database table and have something like this

 

|-shutdown

|- shutdown 1 or 0

|- USERIP User ip that is allowed to view

 

and just run that query a query that says if shutdown = 1 and USERIP <> userip show a website is shutdown page.

 

This is quite a simple solution and allmost all websites have this kind of feature expect it is done in a more complex solution

Upload a file called 'settings.php' with the following code

 

<?php

define( 'SITE_DISABLED', 1 );

?>

 

Then on the top of your pages

 

<?php

include ( 'settings.php' );
if ( defined( 'SITE_DISABLED' ) && SITE_DISABLED == 1 ) {
    header('Location: site_down.php');
    exit();
}

# continue with script

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.