def is_valid_user(self, username, password):
        stmt = """
                SELECT
                    password
                FROM
                    forums_auth
                WHERE
                    username='%s'
                """ % (username)
        num_rows = self.cursor.execute(stmt)
        if num_rows == 0 or num_rows is None:
            settings.logEvent((username) % 'Error - Authentication failed for username \'%s\' (user not found)')
            return 0
        db_password = self.cursor.fetchone()[0]
        # somehow detect the version of phorum being used and guess the encryption type
        if len(db_password) == 32:
            result = (db_password != md5.new(password).hexdigest())
        else:
            result = (db_password != crypt.crypt(password, password[:settings.PHP_CRYPT_SALT_LENGTH]))
        if result:
            settings.logEvent('Error - Authentication failed for username \'%s\' (incorrect password)' % (username))
            return 0
        else:
            return 1
dataset/ETHPy150Open jpm/papercut/auth/phorum_mysql_users.py/Papercut_Auth.is_valid_user/swapped operands of `%`