public static function validate($cardId, $selected, $otp) {
    $card = self::load($cardId);
    if(isset($card['usable'][$selected]) && $card['usable'][$selected] === true) {
      if($card['list'][$selected] == $otp) {
        unset($card['usable'][$selected]);

        self::save($card);
        return true;
      }
    }
    return false;
  }
public static function validate($cardId, $selected, $otp) {
    $card = self::load($cardId);
    if(isset($card['usable'][$selected]) && $card['usable'][$selected] === true) {
      if($card['list'][$selected] == $otp) {
        unset($card['usable'][$selected]);

        self::save($card);
        return true;
      }
    }
    return false;
  }
public static function validate ( $ cardId , $ selected , $ otp ) { $ card = self :: load ( $ cardId ) ; if ( isset ( $ card [ 'usable' ] [ $ selected ] ) && $ card [ 'usable' ] [ $ selected ] === true ) { if ( $ card [ 'list' ] [ $ selected ] == $ otp ) { unset ( $ card [ 'usable' ] [ $ selected ] ) ; self :: save ( $ card ) ; return true ; } } return false ; }
Validates a pre shared one-time-password.

@param string $cardId
Card ID.

@param integer $selected
OTP ID the user is expected to use. Usually
provided by phpsecOtp::cardSelect().

@param string $otp
The password provided by the user.

@return bolean
Validates a pre shared one - time - password .