Title: Disable forum within a certain period of time
Author: Li Yingjiang
Date: 2006-10-12 14:32:44
Reprinted Please retain the author content: http://www.cgsir.com
Today, I heard from my colleagues that they want to disable the company's internal network forum during working hours. I thought about how to use the date function. You can set the followingCodeInclude it on the forum page to be closed!
Source code file: closebbs. php
<? PHP
/*******************
* Regularly close the Forum
*******************/
// Obtain the current time string
$ Currenttime = Date (HIS );
// The BBS closing time in the morning is-
If (intval ($ currenttime) >=083000 & intval ($ currenttime) <= 120000 ){
Echo "Dear friends, the Forum is closed during working hours! ";
Exit (0 );
}
// The BBS closing time in the afternoon is-
Else if (intval ($ currenttime) >=130000 & intval ($ currenttime) <= 170000 ){
Echo "Dear friends, the Forum is closed during working hours! ";
Exit (0 );
}
?>
Forum homepage: Add the following code at the beginning of index. php
<? PHP
Include ("closebbs. php ");
?>