View Single Post
  #4   Spotlight this post!  
Unread 05-05-2004, 15:23
Jack's Avatar
Jack Jack is offline
FIRST Scouting Network
AKA: Andrew Schenk
FRC #0201 (The FEDS)
Team Role: Alumni
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Rochester Hills
Posts: 643
Jack is a jewel in the roughJack is a jewel in the roughJack is a jewel in the rough
Send a message via AIM to Jack
Re: A question to all you Forum Gurus

in phpBB you'd need to run the MySQL query to disable your forums:
Code:
UPDATE `phpbb_config` SET `config_value` = '1' WHERE `config_name` = 'board_disable'
you'd need to then run another query to turn the forms back on:
Code:
UPDATE `phpbb_config` SET `config_value` = '0' WHERE `config_name` = 'board_disable'
A little script i just threw together that i *think* would work...
Make a file called formonoff.php Place this file in your main forums directory (That's the one with the files like index.php, posting.php, etc..)
Even though the script does use some simple security to prevent people from using their web browser to use the script, you might want to edit your .htaccess file, or set the permissions in such a way that your web server can't execute it. Place the following code in the file:

PHP Code:
<?php
define
('IN_PHPBB'true);
$phpbb_root_path './';
include(
$phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);
$userdata session_pagestart($user_ipPAGE_INDEX);
init_userprefs($userdata);

$action $argv['1'];
$key $argv['2'];

if (
$key != 'e7YMe8')
{
    die(
'Not allowed to run script!');
}

if(
$action == 'off')
{
    
$sql "UPDATE `phpbb_config` SET `config_value` = '1' WHERE `config_name` = 'board_disable'";
} else if (
$action == 'on')
{
    
$sql "UPDATE `phpbb_config` SET `config_value` = '0' WHERE `config_name` = 'board_disable'";
} else {
    die(
'No action given!');
}
if (!(
$db->sql_query($sql)))
{
    die(
'SQL Error!');
}
?>
You'll then need to make a cron tab to run the following command to turn off your forums:
Code:
php -f /PATH_TO_FORUMS_HOME/formonoff.php off e7YMe8
... and then this one to turn them back on:
Code:
php -f /PATH_TO_FORUMS_HOME/formonoff.php on e7YMe8
fyi.. you can change the key if you'd like.. just be sure to change it both in the cron tab thingie and in the script

hope this helps ya

(ps: I'm not really sure why you'd want them to turn off/on at times of the day.. but.. heh. whatever works for ya )

Jack
__________________
Team 201 - 2003 Great Lakes Semifinalists & 2003 Archimedes Division Finalists :|: Webmaster of www.feds201.com -> FBI Scouting
Winner of The 2003 ChiefDelphi Web Award for: User That Started The Most Non Chit Chat Threads
Winner of: 2003 FIRST Ventures with 5451.68 End Points

All about me: http://knehcsa.vze.com
**Check out the New FIRST Scouting Network**