Page 1 of 1

weird behaviour

Posted: Sun Jun 24, 2007 5:57 am
by benyboi
Due to recent events on my forum i am trying to make a "lockdown" tool. Basically i have two folders, "forum" which has the forum and "forum_lockdown" which has pages saying that there is a lockdown.

Now, i am trying to make it so that when i click the button, it renames the "forum" folder to something like "forum_8u40350d" and then the "forum_lockdown" to just "forum", so now instead of the forum is a page i created with info on. THen if i click the button again it will undo those changes and put the forum back. But my script wont work, it will only go one way - putting the forum into "lockdown" mode and it wont go back.

Code: Select all

<?php

$status=include('D:/inetpub/www-xxxxx.com/lockdown_status.php');

if ( $status = 'off' ) {
rename("D:\inetpub\www-xxxxx.com\forum", "D:\inetpub\www-xxxxxx.com\forum_ld_975j230f70");
rename("D:\inetpub\www-xxxxx.com\forum_lockdown", "D:\inetpub\www-xxxxx.com\forum");
$myFile = ('D:/inetpub/www-xxxxx.com/lockdown_status.php');
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "on");
fclose($fh);
} else {
rename("D:\inetpub\www-xxxxx.com\forum", "D:\inetpub\www-xxxxx.com\forum_lockdown");
rename("D:\inetpub\www-xxxxx.com\forum_ld_975j230f70", "D:\inetpub\www-xxxxx.com\forum");
$myFile = ('D:/inetpub/www-xxxxx.com/lockdown_status.php');
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "off");
fclose($fh);
}

?>

the file "lockdown_status.php" does exist and has the work "off" in it currently.
anyone know whats wrong?

Posted: Sun Jun 24, 2007 7:55 am
by superdezign
That's a weird way to do it. Can't you just have a flag that you run your forum by in the database? Just make a little table called "forum_active" and have one record in it corresponding to if it's active or not. Then, have your forum check if it's active before displaying anything.

Posted: Sun Jun 24, 2007 7:59 am
by benyboi
well im using phpbb3 and wouldnt know where to start! i shall have a look tho, thanks!

Posted: Sun Jun 24, 2007 8:05 am
by superdezign
phpBB is pretty well supported... Are you sure that there isn't a plugin that does what you're after?