...

View Full Version : Check Name , Comment length



ajloun
09-02-2009, 12:22 AM
Hello

I use this code to make sure the Name and Comment are not embty , but How to make it also check if the Name less than 10 letters and if comment less than 10 letters too.

I replaced
if ( empty($_POST["name"])) { with
if ( strlen($_POST["name"]) < 10 ){ it worked but not when the comment has smillie code like (My Form includes SMillies ) they pass thru and comment will be accepted , Dont know why , i tried use (strlen) and (mb_strlen) but same problem

// Check if name exist
if ( empty($_POST["name"])) {
redirect_header(site_URL . "/index.php" , 3, _MD_MSGNAMEINS);
} else if (mb_strlen($_POST["name"]) > $b) {
redirect_header(site_URL . "/index.php" , 3, _MD_MSGENAMEINS_LONG);
}
// Check if comment exist
if ( empty($_POST["comment"])) {
redirect_header(site_URL . "/index.php" , 3, _MD_MSGEINS);
} else if (mb_strlen($_POST["comment"]) > $a) {
redirect_header(site_URL . "/index.php" , 3, _MD_MSGECOMMENTINS_LONG);
}

sea4me
09-02-2009, 01:27 AM
How are the smilies passed??

with symbols or html code? maybe the html code made it longer than 10 chars...

ajloun
09-02-2009, 02:27 AM
Simple just code 's the same way you add smile when u make post in this forum.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum