public function getRequest($key, $type)
    {
        $return['error'] = true;

        $query = "SELECT id, uid, expire FROM {$this->config->table_requests} WHERE token = ? AND type = ?";
        $query_prepared = $this->dbh->prepare($query);
        $query_prepared->execute([$key, $type]);

        if ($query_prepared->rowCount() === 0) {
            $this->addAttempt();
            $return['message'] = $this->__lang( $type."key_incorrect" );

            return $return;
        }

        $row = $query_prepared->fetch(\PDO::FETCH_ASSOC);

        $expiredate = strtotime($row['expire']);
        $currentdate = strtotime(date("Y-m-d H:i:s"));

        if ($currentdate > $expiredate) {
            $this->addAttempt();
            $this->deleteRequest($row['id']);
            $return['message'] = $this->__lang( $type."key_expired" );

            return $return;
        }

        $return['error'] = false;
        $return['id'] = $row['id'];
        $return['uid'] = $row['uid'];

        return $return;
    }
public function getRequest($key, $type)
    {
        $return['error'] = true;

        $query = "SELECT id, uid, expire FROM {$this->config->table_requests} WHERE token = ? AND type = ?";
        $query_prepared = $this->dbh->prepare($query);
        $query_prepared->execute([$key, $type]);

        if ($query_prepared->rowCount() === 0) {
            $this->addAttempt();
            $return['message'] = $this->__lang( $type."key_incorrect" );

            return $return;
        }

        $row = $query_prepared->fetch(\PDO::FETCH_ASSOC);

        $expiredate = strtotime($row['expire']);
        $currentdate = strtotime(date("Y-m-d H:i:s"));

        if ($currentdate > $expiredate) {
            $this->addAttempt();
            $this->deleteRequest($row['id']);
            $return['message'] = $this->__lang( $type."key_expired" );

            return $return;
        }

        $return['error'] = false;
        $return['id'] = $row['id'];
        $return['uid'] = $row['uid'];

        return $return;
    }
public function getRequest ( $ key , $ type ) { $ return [ 'error' ] = true ; $ query = "SELECT id, uid, expire FROM {$this->config->table_requests} WHERE token = ? AND type = ?" ; $ query_prepared = $ this -> dbh -> prepare ( $ query ) ; $ query_prepared -> execute ( [ $ key , $ type ] ) ; if ( $ query_prepared -> rowCount ( ) === 0 ) { $ this -> addAttempt ( ) ; $ return [ 'message' ] = $ this -> __lang ( $ type . "key_incorrect" ) ; return $ return ; } $ row = $ query_prepared -> fetch ( \ PDO :: FETCH_ASSOC ) ; $ expiredate = strtotime ( $ row [ 'expire' ] ) ; $ currentdate = strtotime ( date ( "Y-m-d H:i:s" ) ) ; if ( $ currentdate > $ expiredate ) { $ this -> addAttempt ( ) ; $ this -> deleteRequest ( $ row [ 'id' ] ) ; $ return [ 'message' ] = $ this -> __lang ( $ type . "key_expired" ) ; return $ return ; } $ return [ 'error' ] = false ; $ return [ 'id' ] = $ row [ 'id' ] ; $ return [ 'uid' ] = $ row [ 'uid' ] ; return $ return ; }
Returns request data if key is valid
@param string $key
@param string $type
@return array $return
Returns request data if key is valid