Clan Adverts

PHP Web Host - Quality Web Hosting For All PHP Applications

 

Minimum post length

Description: Allows you to set a minimum post length Checks for "whitespace hacks". Compatibility: 2.0.x
Version: 1.0
Added on: 24 June 2007
Author: Brian Crescimanno
Difficulty Level: Very Easy
Views: 328
Rating: 7.7 (3 Votes)
Detailed ProfileView Comments (1)

Code:
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
else if ( $submit || $confirm )
{

#
#-----[ AFTER, ADD ]------------------------------------------
#
# Here you can change 9 to the minimum amount you want and you
# can also specify your own error message.  Just change the
# 'Message is too short.' phrase to suit you.  NOTE:  9
# is the number of characters needed to ensure that no single
# default emote (smiley) can be used as a response.

        if($HTTP_POST_VARS['mode'] != "delete")
        {
           // Set up minimum post length
             $briansTmp = $HTTP_POST_VARS['message'];
             $briansTmp = trim($briansTmp);
           if (strlen($briansTmp) < 9)
           {
                   $error_msg = 'Message too short.';
                   $error = true;
           }
        }


#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------