Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Question: Code of Shoubox

Asked Modified Viewed 1,791 times
B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
asked
Veteran Member

Hi,
I am rewriting my mod against spam in the shoutbox, and I found something, where I have a question:

Take a look at
http://www.php-fusion.co.uk/infusions...ile_id=114

Line 32:
if (!iSUPERADMIN || dbrows($result) > 0) {

should it better be
if (!iSUPERADMIN && dbrows($result) > 0) {
0 replies

7 posts

B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
answered
Veteran Member

Ok, let's wait until Master Digi spoke ;)

But if it is right, its funny, because nobody saws this.
This code exists sice 31.01.2006 :D
0 replies
H
HACKERSOFT
H
  • Member, joined since
  • Contributed 63 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

There's no problem with that...
The logic is to check shoutbox flooding for members or if the user_ip exists as the last shout. If last shout = user_ip and the user does not have superadmin privilege, then it will count and compare the number shouts incurred successively against the flood interval settings. If it's less than the flood settings, the shout is accepted, if more than the flood interval, the shout is rejected. Super Admins therefore, based on the logic, can flood the shoutbox regardless of the IP.

If you will make it to && instead of ||, the code:
if (!$flood) $result = dbquery("INSERT INTO ".$db_prefix."shoutbox (shout_name, shout_message, shout_datestamp, shout_ip) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."')");


will be useless, or should I say it will always allow any user to shout with no flooding control, since it should be set as true inside the condition if it meets the criteria.

I should say, there's really nothing wrong with the condition and the boolean is acceptable and logical.

That's just my point. Others may share their own... ;)
Edited by HACKERSOFT on 16-10-2007 19:42,
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

forget about this post ;)
Edited by Matonor on 17-10-2007 00:50,
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

damn, your're right, I switched slaughter's suggestion and the original line ;)
Edited by Matonor on 17-10-2007 00:53,
0 replies
B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
answered
Veteran Member

When you tell Digi about my suggestion, please report this, too:
http://www.php-fusion.co.uk/forum/vie...ost_103453
Edited by Basti on 17-10-2007 18:57,
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

Note: In v7, the flood handling code was moved to an include that can be used wherever you want and the issue you posted above is not present in this system anymore.
0 replies
B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
answered
Veteran Member

Ah this sounds well :)
I didn't know this...

But take a look at the other thread, which I have posted, because I found this bug on this website (which works on v7 :P)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 7 posts
  • Votes 0 votes
  • Topic users 3 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet