PDA

View Full Version : User cant post in specific hour


BenH
06-27-2002, 06:44 AM
Hello ,
i'm running forum for kids , and i have problem the each night there are ppl that put porn pics in the forum , and all the mods are asleep .
what im asking is if anyone can make a small hack that will prevent group X from posting between 24:00 to 9:00 or something like that .
is that possible ?

thanks
Ben

Logician
06-27-2002, 10:58 AM
They cant be a large group of (sick) people doing this, probably it's one person. So I suggest tracking his posts, capture his IP and ban the IP range for an effective solution. Also enabling moderation for new users can help. So does approving new members while they register (together with "who might this new user be?" hack).

But here is the hack anyway. And IMO it's a little bit better than you asked because it does not reject the posts but just put them into moderation so you wont lose legitimate posts either. ;) You can approve/reject posts in the morning..

Edit newthread.php, find:

$visible=iif($foruminfo[moderatenew],0,1);


After that insert:

// Moderate Users Hack
if ($bbuserinfo[usergroupid]==X AND (int)date("H", time())>0 AND (int)date("H", time())<9)
{
$visible=0;
}
// Moderate Users Hack


Replace X with usergroupid. You can also edit 0 and 9 according to your wishes. With these numbers usergroup X's posts between 00.00 to 09.00 AM will be moderated in your board in all forums.

Insert the same code to newreply.php after line:
$visible=!$foruminfo[moderatenew];

I didnt test it but it should work, if not holler and I'll fix it..

By the way, time is calculated according to your server time so set banned hours accordingly.

Enjoy! :)
Logician

Ps. he can still send pms though, so you better get him and ban his IP.

BenH
06-27-2002, 04:10 PM
i think there is something wrong with this part :
(int)date("H", time())>0 AND (int)date("H", time())<9

this just doesnt work

Logician
06-27-2002, 05:35 PM
no I cant see anything wrong with that code. What's the problem?Give me the exact line you applied to your board and plz be more specific about term "not working".. Gives an error or smt?

And you are aware that time banning will work according to your server time, right? So you must set the allowed times considering the time zone of your server not your own.

BenH
06-27-2002, 06:15 PM
I've no idea whats going on .. when i posted the replay , it didnt work , when i checked agian after seeing your replay it worked , now its not working agian ..
i checked the server time and the usergroupid
the code i have is


// Moderate Users Hack
if ($bbuserinfo[usergroupid]==46 AND (int)date("H", time())>21 AND (int)date("H", time())<9)
{
$visible=0;
}
// Moderate Users Hack

it just put the post / replay and doesnt add this to the queue

thanks alot
Ben

Xenon
06-27-2002, 06:28 PM
(int)date("H", time())>21 AND (int)date("H", time())<9

this clause can never be 1
when date(H)>21 it is never <9

if ($bbuserinfo[usergroupid]==46 AND ((int)date("H", time())>21 OR (int)date("H", time())<9))
should be the right if-clause

Logician
06-27-2002, 06:32 PM
and of course you are testing if it's working by using a useraccount with usergroupid=46, right?

If you are sure about
a) usergroupid is correct (Is it really 46???)
b) You testing it with an account with the same usergroup id
c) times set according to server time
try this:

Before the hack add:

echo '$bbuserinfo[usergroupid]='.$bbuserinfo[usergroupid];
echo '<br>server time now='.date("H", time());

lines, for debugging purposes, send a post and note what info is posted in your screen (In the screen "thank you for your post")

Logician
06-27-2002, 06:38 PM
Xenon is right.

I got stuck to my own code which was designed according to the hours you asked in your first message and didnt notice you changed the hours there. If you want to use hours from 21.00 to 09.00, use Xenon's code..

if it's 00.00-09.00, my code (in the first post) will do the trick..

BenH
06-27-2002, 06:41 PM
Ok , Its working now

Thanks Alot to both of you

Ben

Xenon
06-27-2002, 06:43 PM
you're welcome :)

Logician, we're a good team ;)

Logician
06-27-2002, 06:50 PM
Ok , Its working now
Glad it is ok now, enjoy..

Originally posted by Xenon
Logician, we're a good team ;)
sure we are pal.. ;) Guardians of the Request Forum hehe