Guest User

Untitled

a guest
Feb 20th, 2015
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. function addData($userName, $userMail, $type, $warningLevel, $text)
  2. {
  3.     $type= (int)$type;
  4.     $warningLevel = (int)$warningLevel;
  5.     $userName = htmlspecialchars(mb_substr($userName, 0, MAXSIZE_USERNAME), ENT_QUOTES);
  6.     $userMail = htmlspecialchars(mb_substr($userMail, 0, MAXSIZE_USERMAIL), ENT_QUOTES);
  7.     $text = BBCode(getTextWithBr(htmlspecialchars(mb_substr($text, 0, MAXSIZE_COMMENT), ENT_QUOTES)));
  8.     if (empty($userName) || empty($userMail) || empty($text))
  9.     {
  10.         return RESULT_EMPTYTEXT;
  11.     }
  12.     else
  13.     {
  14.         if (validate(VALID_MAIL, $userMail))
  15.         {
  16.             $add = mysql_query("INSERT INTO `data` VALUES ('', '".$userName."', '".$userMail."', '".$_SERVER["REMOTE_ADDR"]."', '".time()."', '".$warningLevel."', '".$text."', '0', '".$type."')");
  17.             if ($add)
  18.             {
  19.                 return RESULT_OK;
  20.             }
  21.             else
  22.             {
  23.                 return RESULT_MYSQLERROR;
  24.             }
  25.         }
  26.         else
  27.         {
  28.             return RESULT_DONTVALIDMAIL;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment