Exemplo n.º 1
0
 public function setPasUsu($passwordUsuario)
 {
     if (SpoonFilter::isSmallerThan(40, strlen($passwordUsuario)) && SpoonFilter::isString($passwordUsuario) && SpoonFilter::isAlphaNumeric($passwordUsuario)) {
         $this->passwdUsu = sha1($passwordUsuario);
     } else {
         echo "Introduzca una contraseña correcta, use sólo números y letras";
         exit;
     }
 }
Exemplo n.º 2
0
 public function testIsSmallerThan()
 {
     $this->assertFalse(SpoonFilter::isSmallerThan(1, 10));
     $this->assertFalse(SpoonFilter::isSmallerThan(-10, -1));
     $this->assertFalse(SpoonFilter::isSmallerThan(-1, 10));
     $this->assertTrue(SpoonFilter::isSmallerThan(1, -10));
     $this->assertFalse(SpoonFilter::isSmallerThan(0, 0));
 }
Exemplo n.º 3
0
Arquivo: text.php Projeto: szLuis/oac
 /**
  * Checks if the field is smaller than a given maximum.
  *
  * @return	bool
  * @param	int $maximum				The maximum.
  * @param	string[optional] $error		The error message to set.
  */
 public function isSmallerThan($maximum, $error = null)
 {
     // filled
     if ($this->isFilled()) {
         // post/get data
         $data = $this->getMethod(true);
         // validate
         if (!isset($data[$this->attributes['name']]) || !SpoonFilter::isSmallerThan($maximum, $data[$this->attributes['name']])) {
             if ($error !== null) {
                 $this->setError($error);
             }
             return false;
         }
         return true;
     }
     // not submitted
     if ($error !== null) {
         $this->setError($error);
     }
     return false;
 }