<?php
include "./config.php";

if (
preg_match('/session/isUD'$_SERVER['QUERY_STRING'])) {
    exit(
'not allowed');
}

//parse_str($_SERVER['QUERY_STRING']);
parse_str($_SERVER['QUERY_STRING'], $arr);
foreach (
$arr as $key => $value) {
    $
$key $value;
}

$db dbconnect();
if (isset(
$column) && isset($keyword)) {
    if (isset(
$ie) && !empty($ie)) {
        if (
in_array($ie, ['utf8''ucs2''utf16'])) {
            
$_SESSION['format'] = "convert(%s using $ie)";
        } else {
            
$_SESSION['format'] = 'convert(%s using latin1)';
        }
    }
    
$format = isset($_SESSION['format']) ? $_SESSION['format'] : 'convert(%s using latin1)';
    if (
        
preg_match('/^convert\(/'$format) &&
        
preg_match('/\)$/'$format)
    ) {
        
$column sprintf($format$column);
        
$column preg_replace('/[^\w\s(),]/'''$column);
        if (
strlen($column) > 24) {
            exit(
"no hack!");
        }

        
$keyword addslashes($keyword);
        
$query "select * from prob_invisible_dragon where $column='$keyword'";
        echo 
"<hr>query : <strong>{$query}</strong><hr><br>";
        
$result = @mysqli_fetch_array(mysqli_query($db$query));
        if (
$result) {
            echo 
"<h2>Search {$result[0]}!</h2>";
        }
    }
}

if (isset(
$secret)) {
    
$query "select secret from prob_invisible_dragon";
    
$result = @mysqli_fetch_array(mysqli_query($db$query));
    if (
$result['secret'] === $secret) {
        echo 
"<h2>Yes, that is the FLAG what you want ;)</h2>";
    }
}

highlight_file(__FILE__);

///////////////////////
//                   //
//  made by dmbs335  //
//                   //
///////////////////////

?>