I can see now that I poorly asked or wrote what I need help with, since I can not add images it's hard for me. If there is a way please private message me @Fred -ii- and @Dagon thanks.
Asked
Active
Viewed 113 times
0
-
1do you have a front-end controller\ framework or just a bunch of *.php files? – Aug 11 '15 at 04:05
-
I'm having trouble understanding what you're asking. Do you just need a button to activate that, or is that a multiple question? – Funk Forty Niner Aug 11 '15 at 04:07
-
What do you mean by a front-end controller? Like a control panel? If so no, I made all the files and folders so its mostly *.php – GrimmRP Aug 11 '15 at 04:07
-
@Fred-ii- I am sorry about that, I would like a to understand how I could make a button to activate it yes but the problem with the second code, '$_CONFIG["game"]' one is that its coming from another .php which is management file. I have no idea if I could have button within a .php file change the management.php file? – GrimmRP Aug 11 '15 at 04:10
-
see below - this approach will save you having to edit each and every page – Aug 11 '15 at 04:10
-
Have a look at Dagon's answer. That way you won't need a button. Plus, in creating a page for it, you'd still have to use htaccess to hide that file, or protect it from anyone finding it. – Funk Forty Niner Aug 11 '15 at 04:13
-
button changes db field `maintenance` 0\1 every page checks that value? except for the slight overhead its a fine option - just makes sure you don't mind people visiting image's etc while in maintenance mode. – Aug 11 '15 at 04:18
-
I can see I poorly asked what I am trying to do its very hard for me to explain. I am sorry for wasting every ones time here. @Fred-ii- If you could Pm me that would be great also with you Dagon, I tried to pm you Fred but couldn't see where I could. – GrimmRP Aug 11 '15 at 04:29
-
See this Q&A http://stackoverflow.com/questions/1396848/how-to-implement-maintenance-mode-on-already-established-website and http://phpsnips.com/40/Maintenance-Mode#.Vcl6isvbJdg and https://github.com/MisterPhilip/maintenance-mode many other hits. Just Google "maintenance mode PHP". I'm headed to bed now, sorry. – Funk Forty Niner Aug 11 '15 at 04:32
-
php can write to its own files theoretically with permissions. php File I/O google it. have your server try to modify its own htaccess. Of course, you need a back door in not affected by ReWrite so you can set it back via PHP – Drew Aug 11 '15 at 04:35
1 Answers
1
non php method:
add or edit .htaccess file in the web root directory
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://yoursite.com/maintenance.html [R=307,L]
will send all visitors to the maintenance.html page.
this will also stop people accessing images and other resources which you may want to be available during maintenance mode
-
I can do this just by going into my management file and change it to 'true' but I am trying to find a way to just do it by clicking a button on my 'lets say admin.php page once I make it' and it would turn maintenance on or off. – GrimmRP Aug 11 '15 at 04:12
-
1the button could edit the .httaccess file - but if you would rather edit every php page that's your call – Aug 11 '15 at 04:14
-
Wait so I could make a *.php file and have it edit the .htaccess file and update it with a press of a button? – GrimmRP Aug 11 '15 at 04:18
-
Yes but I have never done that before so I have no idea how to make it write a file. Only think I mainly know how to do is grab stuff from a database. – GrimmRP Aug 11 '15 at 04:23
-
if you have a new question of "how do i read and write .htaccess file" you should really post that *as a new question*. – Aug 11 '15 at 04:24
-
@Dagon Hm... I remember seeing a question about something like this. What the OP would need to do is check if the current IP is their own 127.0.0.1 type of thing, what do you think? – Funk Forty Niner Aug 11 '15 at 04:29