我无法在我的脚本中搜索

时间:2016-11-08 12:09:30

标签: php search search-engine

为什么当我使用" ab cdefgh"脚本刚读完" ab"太空后无法阅读?

<?php
$con = @mysqli_connect($host,$user,$pass,$db_name);
if (isset($_GET['c']) and isset($_GET['v'])) {
    $license = $_GET['v'];
    $mac = $_GET['c'];

    $mac_query = mysqli_query($con,"SELECT * FROM app WHERE mac='$mac'");
    $fetch_query = mysqli_fetch_array($mac_query);
    if ($fetch_query == 0 ) {
        $license_query = mysqli_query($con,"SELECT * FROM app WHERE license='$license'");
        if (mysqli_fetch_array($license_query) > 0 && $license !=='') {
            $insert = mysqli_query($con,"UPDATE app SET mac='$mac'");
        }
        else { 
            print "Unexpected license";
        }
    }
    else {
        $mac_query = mysqli_query($con,"SELECT * FROM app WHERE mac='$mac'");
        $fetch_mac = mysqli_fetch_array($mac_query);
        if ($fetch_mac['active'] == "") {
            if ($license == $fetch_mac['license']) {
                $query = mysqli_query($con,"UPDATE app SET active='active' WHERE mac='$mac'");
                echo "Active";
            }
            else {
                echo "Deactive";
            }
        }
        elseif ($fetch_mac['active'] == "active") {
            ?>
            <form method="post">
            <input type="text" name="search">
            <button type="submit" name="btn-search">Search</button>
            </form>
            <?php
            if (isset($_POST['btn-search'])) {
                $word = $_POST['search'];
                $select_lic = mysqli_query($con,"SELECT * FROM app WHERE mac='$mac'");
                $content_s = file_get_contents("http://ask.com/web?q=$word");
                if (strpos($content_s,"did not match with any Answers results.")) {
                    echo "false";
                }
                else {
                    $select_lic = mysqli_query($con,"SELECT * FROM app WHERE mac='$mac'");
                    $row = mysqli_fetch_array($select_lic);
                    $word = md5($word).",";
                    if ($row['license'] === $license) {
                        echo "true";
                        $query = mysqli_query($con,"INSERT INTO words (index) VALUES ('$word')");
                    }
                    else {
                        echo "Error";
                    }
                }
            }
            else 
                echo "";
            }
        }
    }
}
else {
    exit;
}
?>

例如我搜索&#34; ab cdefgh&#34;但 我的剧本只读了#34; ab&#34;并且不读 &#34; cdefgh&#34;我该如何解决?

0 个答案:

没有答案