Jump to content
MakeWebGames

Recommended Posts

Posted

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

inv.jpg

Staff Section all site offline

staffbit.jpg

staff all pages online

online.jpg

Staff Page with 1 file offline

pageoffline.jpg

Onfirmation on page closure

pageclosed.jpg

Let me get my edits together and i will post...

Posted

[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

Posted

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

Posted
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 :(

Posted

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.

Posted
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();

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted
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)

Posted

" $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.

Posted

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.

  • 3 weeks later...
Posted
Pages will only close if in users the offline or maint is set to 1
Great 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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...