Diferior CMS on steroids
+1570 / 1945748 ( online 13 )

Maintenance/Repair Page


Forum posts: 98
p2pmylife (Talks a lot) @ 09 02 15 - 13:13:11
I think Diferior need a Maintenance Page wich be activate with a variable or something like that, when the website is in this state, the default main page cannot be accessed, simple but very usefull for online debugging !

Thanks again !
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 572
UnrealX (Lead code monkey) @ 09 02 15 - 17:21:24
It's pretty easy to implement:
Open index.php and right after <?php add
die ( 'Site is undergoing maintenance, please be patient and try again after a minute or two.' );
Added downloads: 1
Comments: 5
Forum posts: 56
Method (Chatterbox) @ 09 02 16 - 00:10:49
It's pretty easy to implement:
Open index.php and right after <?php add
die ( 'Site is undergoing maintenance, please be patient and try again after a minute or two.' );


I think he means to make the front page show that the site is under maintenance, but allow the rest of the site accessible to admins. Or have a separate page with a login, and above the login it will say the sites under maintenance, and only allow admins to log in. I don't know as that will work with „die“ as last I knew that essentially cancels out the entire page, which is great if you're doing something back end, not front end.
Forum posts: 98
p2pmylife (Talks a lot) @ 09 02 16 - 10:56:10
Yes indeed, good thinking, that's right, in the case of front end work its difficult to access to the website with die() ...

But thanks for the code I will do this for the moment ;) !
Forum posts: 98
p2pmylife (Talks a lot) @ 09 02 16 - 14:37:11 (edited 09 02 16 - 15:02:53)
Well i've find out this :

Insert into .htaccess file :

RewriteEngine On RewriteCond %{REMOTE_ADDR} !12.345.6.789 RewriteRule .* <a href="http://mywebsite.net/maintenance.htm\" rel=\"external\">http://mywebsite.net/maintenance.htm</a> [L]

Replace 12.345.6.789 by your current IP, with that only you can access to your website !
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 572
UnrealX (Lead code monkey) @ 09 02 16 - 14:44:34
Neat little tip, p2pmylife ^_^
Forum posts: 8
djhowarth (Junior member) @ 09 03 07 - 01:31:46
thats only good if u use a static ip

the correct way of doing this is

stating the session is admin if not then dont load the page show a blank screen with a message or u could build it into the error handler like i have done on my site

say for a function i use

if ($notice !== false && and $maintence !==true)
{
begin_block(„Notice“);

end_block();
}

here i state that if notice is turned on then show but it also checks to see if maintenance mode is off then i make $maintence global then make it a function like

begin_block(„Site-Maintenance“);
print(„Be Back Soon“);
end_block();

This Way I Can Keep my site on and let users know its still alive