CRUD PHP系统“不可接受!”尝试创建新的mysql行时出错

时间:2019-10-25 23:43:20

标签: php html

这是我的html表单:

pd.read_csv('http://fonetik.fr/foo.csv')

这是blog_editor.php文件:

CertificateError                          Traceback (most recent call last)
<ipython-input-27-030762f24a0e> in <module>()

----> 1 df = pd.read_csv('http://fonetik.fr/foo.csv')
 /usr/lib/python3.6/ssl.py in match_hostname(cert, hostname)
   325         raise CertificateError("hostname %r "
   326             "doesn't match either of %s"
--> 327             % (hostname, ', '.join(map(repr, dnsnames))))
   328     elif len(dnsnames) == 1:
   329         raise CertificateError("hostname %r "

CertificateError: hostname 'fonétik.fr' doesn't match either of 'fonetik.fr', 'www.fonetik.fr', 'www.xn--fontik-dva.fr', 'xn--fontik-dva.fr'

但是,当我尝试发布新链接时,出现此错误:

“不可接受!在此服务器上找不到所请求资源的适当表示。此错误是由Mod_Security生成的。”

,不会记录任何PHP错误。我完全感到困惑,任何帮助将不胜感激。 哦,我也尝试将其添加到我的.htaccess文件中,但无济于事。

function callback(results, status) {

            if (status == google.maps.places.PlacesServiceStatus.OK) {

                document.getElementById("ulPlaces").innerHTML = "";

                for (var i = 0; i < results.length; i++) {

                    var placeRequest = {
                        placeId: results[i].place_id
                    };

                    service.getDetails(placeRequest, function(resultDetails, status) {
                        if (status == 'OK') {

                            placeWebsite = resultDetails.website;
                            placePhoneNumber = resultDetails.formatted_phone_number;
                        }
                    });


                    var node = document.createElement("li");
                    node.setAttribute("class", "liPlaces");
                    node.setAttribute("id", results[i].place_id);

                    node.innerHTML = '<img class="imgPlaces" src="' + results[i].icon + '" alt="" /><h4 class="h4Places">' + results[i].name + '</h4><p>Open: ' + results[i].opening_hours.open_now + ' | Rating: ' + results[i].rating + '</p><p><input type="button" onclick="loadDirections(' + results[i].geometry.location + ')" value="Directions" /> | <input type="button" onclick="window.location.href=tel:' + placePhoneNumber + ';" value="Telephone" /> | <input type="button" onclick="window.location.href=' + placeWebsite + ';" value="Website" /></p>';


                    document.getElementById("ulPlaces").appendChild(node);


                    /*
                    infoWindow.setPosition(results[i].geometry.location);
                    infoWindow.setContent(results[i].name);
                    infoWindow.open(map, marker);
                    */

                    var image = {
                        url: results[i].icon,
                        size: new google.maps.Size(71, 71),
                        origin: new google.maps.Point(0, 0),
                        anchor: new google.maps.Point(17, 34),
                        scaledSize: new google.maps.Size(25, 25)
                    };

                    var marker = new google.maps.Marker({
                        map: map,
                        icon: image,
                        title: results[i].name,
                        position: results[i].geometry.location
                    });

                    marker.addListener('click', (function(marker, i) { 
                        return function() {
                            //if( prev_infowindow ) {
                            //   prev_infowindow.close();
                            //}

                            window.scrollTo(0, document.getElementById(results[i].place_id).offsetTop)

                            //loadDirections(results[i].geometry.location)

                            //prev_infowindow = infoWindow;
                        }
                    })(marker, i));
                }
            }
        }

        function loadDirections(end){

            var path = {
                origin: pos,
                destination: end,
                travelMode: 'WALKING'
            };

            directionsService.route(path, function(resultDirections, statusRoute) {
                if (statusRoute == 'OK') {
                    directionsRenderer.setDirections(resultDirections);
                }
            });
        }

1 个答案:

答案 0 :(得分:0)

您必须使用准备好的语句来安全地传递信息而不会出错

if (isset($_POST['blog_add'])) {
    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
    $link = mysqli_connect("localhost", "user", "pass", "databaseName");

    $id = $_POST['id'];
    $category = $_POST['cat'];

    $sql = "INSERT INTO blog_links (id, category) VALUES (?, ?)";

    $stmt = mysqli_prepare($link, $sql);
    // Bind variables to the prepared statement as parameters
    mysqli_stmt_bind_param($stmt, "ss", $param_0, $param_1);

    // Set parameters
    $param_0 = $id;
    $param_1 = $category;

    // Attempt to execute the prepared statement
    mysqli_stmt_execute($stmt);
    // Records created successfully. Redirect to landing page
    header("location: https://www.yoursite.com/blog_editor_path");
    exit();

    // Close statement
    mysqli_stmt_close($stmt);

    // Close connection
    mysqli_close($link);
}