I am trying to build an application that detect if user's input(first 20 byte) exist on my database.
But I am stuck at sanitizing and making placeholder to it. Especially, this part $stmt->execute(), any advise and recommendation will be appreciated!
<?php
    echo <<<_END
            <form method='post' action='test.php' enctype='multipart/form-data' >
                Tester: <input type='file' name='uploadfile'>
                <input type='submit'>
            </form>
    _END;
    if($_FILES){
        require_once 'login.php';
        if (!$conn) {
            die(mysql_fatal_error());
          }
        $type = $_FILES['uploadfile']['type'];
        if($type == "text/plain"){
            $name = $_FILES['uploadfile']['name'];
            $fh = fopen($name, 'r') or die("File Does not exist");
            $content = file_get_contents($name, FALSE, NULL, 0, 20);
            $content = sanitizeMySQL($conn, $content);
            fclose($fh);
            $stmt = $conn->prepare("SELECT * FROM storage WHERE mydata like ?");
            $stmt->bind_param("s", $content);
            $stmt->execute();
            //$stmt->bind_result($content);
            if (!$stmt) {
                echo "Not Exist";
            } else {
                    echo "Exist";
            }
        } else {
            echo  "txt only <br>";
        }
}
 
     
     
    