Uridium Posted May 8, 2010 Posted May 8, 2010 There is a mod that closes pages which can be found here Websters Mod But I decided to make some adjustments to my own mod which i never released so this mod will allow 1 = Reason for closure of page or Site.. 2 = Timestamp is included when page/site is closed so users know what time it shut down 3 = Admins can add A Reopening time so users can come back at that time to view.. 4 = Actual time is given so users can see what is the current time... 5 = Users above level 1 can still access pages even when closed... 6 = One click Function to reopen entire site or page... Few Screenies Staff Section all site offline staff all pages online Staff Page with 1 file offline Onfirmation on page closure Let me get my edits together and i will post... Quote
Uridium Posted May 8, 2010 Author Posted May 8, 2010 Sorry for delay was editing the admin page so it showed moe details... Will post up when finished Quote
Uridium Posted May 8, 2010 Author Posted May 8, 2010 [mysql]CREATE TABLE IF NOT EXISTS `maintenance` ( `offline` varchar(7) NOT NULL, `online` varchar(6) NOT NULL, `reason` text NOT NULL, `hour` int(11) NOT NULL, `minute` int(11) NOT NULL, `timenow` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `maintpage` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `maintenance` (`offline`, `online`, `reason`, `hour`, `minute`, `timenow`, `maintpage`) VALUES ('', 'Online', '', 2, 4, '2010-05-08 20:01:30', 'No Pages Are being Worked On'); [/mysql] Second MYSQL for users table [mysql]ALTER TABLE `users` ADD `offline` INT( 2 ) NOT NULL default '0'; ALTER TABLE `users` ADD `maintpage` VARCHAR( 255 ) NOT NULL;[/mysql] Call this file staff_maintenance.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Now open up header.php and add and where the CSS PART ends add You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. now the Boring part and yes sorry but this is needed for everything to work add this Piece of code under each page that users can view... after the include"globals.php"; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. The above is for Inventory Where the mention of inventory is you need to replace that to match the script it will be going into... Final part for smenu.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And your done Quote
Jordan Palmer Posted May 8, 2010 Posted May 8, 2010 Why add to users table, Would it not be 100% more better if you use a new table and see if the filename exists then simply block it.. Good effort though man, I just wouldn't off doing all u've done tbh Quote
Richard Posted May 8, 2010 Posted May 8, 2010 Brilliant illusions! Well done mate, It looks great! Quote
Uridium Posted May 8, 2010 Author Posted May 8, 2010 Why add to users table, Would it not be 100% more better if you use a new table and see if the filename exists then simply block it.. Good effort though man, I just wouldn't off doing all u've done tbh Thats quite true Pudda but at moment i havent got the time i used to have to make things more impressive :( Quote
Jordan Palmer Posted May 8, 2010 Posted May 8, 2010 I don't have any spare time, however I take my time with modifactions then simply enough you're outcome will be a lot better, That then allows your mod to get better feedback ;P Quote
Uridium Posted May 8, 2010 Author Posted May 8, 2010 1 mod out of 45 that ive done cant be too bad ;) Quote
AlabamaHit Posted May 9, 2010 Posted May 9, 2010 You could do something like adding a timestamp or using what you have in the matenince table. Example When you go offline. add unix_timestamp to field say 'time_off' Then you don't need the users. Just somethign like this. select it from table with example $j if(time() > $j['time_off']) { die(''); } That would be of course if the Current time is greater than the Time_off WHich is the Time stamp put in. Then when you cutt if back on. You just set clear the time_off field. Quote
BludClart Posted May 9, 2010 Posted May 9, 2010 You could do something like adding a timestamp or using what you have in the matenince table. Example When you go offline. add unix_timestamp to field say 'time_off' Then you don't need the users. Just somethign like this. select it from table with example $j if(time() > $j['time_off']) { die(''); } That would be of course if the Current time is greater than the Time_off WHich is the Time stamp put in. Then when you cutt if back on. You just set clear the time_off field. No offence but i wouldnt use die(''); it is better to use echo "Page closed blah blah"; $h->endpage(); exit(); just means that if they have a custom header half the images after where you add die(''); wouldnt show =\ so i would use exit(); Quote
AlabamaHit Posted May 9, 2010 Posted May 9, 2010 None taken. :) It was strictly an example. Not ment to be used in the form I did it in, just pointing in right direction :thumbsup: Did you know you can put the $h->endpage() in the exit also. To help save lines. exit($h->endpage()); :D Quote
Uridium Posted May 9, 2010 Author Posted May 9, 2010 If anyone wishes to improve on this Mod i dont mind you taking the credit for it. Youve probably got the start of a decent mod so im okies about anyone wishing to expand or remodify it. Quote
Zero-Affect Posted May 10, 2010 Posted May 10, 2010 Illusions may i suggest something, i was intending on making this for myself which you know of and i came up with a easier solution for the staff panel part. It's possible to use something like the following code (ty DJkanna/Nickson). You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. @ AB you can also do the following You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote
Dayo Posted May 10, 2010 Posted May 10, 2010 just reading thro i think you said put it under globals.php on every page, y not just add it to the bottom of globals? and add an if statment, ill have a go at making one that will be a bit more simpler, this is how i would of done it admin enters in the url of the page in maintance ie index.php, in globals the check would be some thing like select * from `pages` where `page='all' OR `page`=URL of page here (with it just thefile name no GET vars etc) then if it returns TRUE it shows maintance this could be a realy simple mod and would only be 1 addition to globals and not the user table Quote
Djkanna Posted May 10, 2010 Posted May 10, 2010 Illusions may i suggest something, i was intending on making this for myself which you know of and i came up with a easier solution for the staff panel part. It's possible to use something like the following code (ty DJkanna/Nickson). I did something like this You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. By the way the reason I removed the code from your quote is because the syntax is failing (I mean actually giving the close button within the textbox :O) Quote
Zero-Affect Posted May 11, 2010 Posted May 11, 2010 Thanks for that DJK one question though with your code you put the checkbox before <form does that still work? Quote
Djkanna Posted May 11, 2010 Posted May 11, 2010 Yes :) Much like <input type="****" works without or within a form :) But don't expect it to do anything :L (this is where Javascript comes in) Quote
Maniak Posted May 11, 2010 Posted May 11, 2010 Looks good; I might have to convert this to Lite. Quote
kcmajor36 Posted May 11, 2010 Posted May 11, 2010 What if we want to close the whole site so people can't login? Quote
kcmajor36 Posted May 11, 2010 Posted May 11, 2010 And can you be a bit more specific about installing the last two. Quote
kcmajor36 Posted May 12, 2010 Posted May 12, 2010 " $q = $db->query("SELECT offline, online, reason, hour, minute, timenow, maintpage FROM maintenance WHERE maintpage='inventory.php'"); $t = $db->fetch_row($q); $db->query("SELECT * FROM users WHERE maintpage='inventory.php'"); if ($ir['maintpage']==$t['maintpage']) { echo'<h1>Inventory Closed for Maintenance</h1>'; echo' <font size=3>'.$t['reason'].'</font> this Page will be back online in '.$t['hour'].' Hour(s) And '.$t['minute'].' Minute(s) Time from when page was Placed in Maintenance mode at '.$t[timenow].''; echo " Time Now: ".date('g:i:s a').""; die(); } " This isn't working right. Quote
Uridium Posted May 12, 2010 Author Posted May 12, 2010 This was fixed for KC on msn but for those having problems heres the solution when adding this part to each page as suggested on page 1 of this topic... FOR INVENTORY.PHP You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. FOR FORUMS.PHP You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. As you can see from the above all ive done is altered the name inventory.php to forums.php Continue this task until all files are done except globals.php global_func.php and any class files. Quote
kcmajor36 Posted May 12, 2010 Posted May 12, 2010 Isen't suppose to close only if the admin closes that page or site because I haven't closed the site or page and it says "(Page) Closed for maintenance" Quote
Uridium Posted May 12, 2010 Author Posted May 12, 2010 Pages will only close if in users the offline or maint is set to 1 Quote
kingdkknox Posted May 27, 2010 Posted May 27, 2010 Pages will only close if in users the offline or maint is set to 1Great mod I would love this. Thanks! Im having the same issue but neither is set to 1. Every page I put the code on gives a closed for maintenance message. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.