Example #1
0
 public static function is_valid($password, $hash, $salt)
 {
     list($tmp_hash, $tmp_salt) = crypt::password($password, $salt);
     if ($tmp_hash === $hash and $tmp_salt === $salt) {
         return true;
     }
     return false;
 }
Example #2
0
 public static function add($name, $password, $role_id)
 {
     list($hash, $salt) = crypt::password($password);
     $q = new cquery(RUDE_DATABASE_TABLE_USERS);
     $q->add(RUDE_DATABASE_FIELD_NAME, $name);
     $q->add(RUDE_DATABASE_FIELD_HASH, $hash);
     $q->add(RUDE_DATABASE_FIELD_SALT, $salt);
     $q->add(RUDE_DATABASE_FIELD_ROLE_ID, $role_id);
     $q->query();
     return $q->get_id();
 }