将映像删除到目录和数据库(小型管理区域)


Delete image into directory and database (Small admin area)

>我有一个小脚本库,您可以在其中从计算机的网络摄像头拍摄照片,这些照片保存在目录图像/和数据库中。

一切正常,但现在我想创建一个管理区域(当然我目前只关心功能),带有一个假设的页面管理员.php和删除.php(包含该功能)。因此,我想出现在页面管理员.php所有图像列表中,并能够从简单的"删除"按钮中删除它们。

不幸的是,我尝试了几次,但我不是专家。

你需要什么来帮助我?

您粘贴几页:

指数。.PHP

    <style type="text/css">
body{
    margin:0;
padding:0;
}
.img
    { background:#ffffff;
    padding:12px;
    border:1px solid #999999; }
.shiva{
 -moz-user-select: none;
    background: #2A49A5;
    border: 1px solid #082783;
    box-shadow: 0 1px #4C6BC7 inset;
    color: white;
    padding: 3px 5px;
    text-decoration: none;
    text-shadow: 0 -1px 0 #082783;
    font: 12px Verdana, sans-serif;}
</style>
<html>
<body style="background-color:#dfe3ee;">
<div id="outer" style="margin:0px; width:100%; height:90px;background-color:#3B5998;">
</div>
<div id="main" style="height:800px; width:100%">
<div id="content" style="float:left; width:500px; margin-left:50px; margin-top:20px;" align="center">
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
        document.write( webcam.get_html(440, 240) );
</script>

<form>
<br />
        <input type=button value="Configure settings" onClick="webcam.configure()" class="shiva">
        &nbsp;&nbsp;
        <input type=button value="snap" onClick="take_snapshot()" class="shiva">
    </form>

</div>
<script  type="text/javascript">
    webcam.set_api_url( 'handleimage.php' );
        webcam.set_quality( 90 ); // JPEG quality (1 - 100)
        webcam.set_shutter_sound( true ); // play shutter click sound
        webcam.set_hook( 'onComplete', 'my_completion_handler' );
        function take_snapshot(){
            // take snapshot and upload to server
            document.getElementById('img').innerHTML = '<h1>Uploading...</h1>';
            webcam.snap();
        }
        function my_completion_handler(msg) {
            // extract URL out of PHP output
            if (msg.match(/(http':'/'/'S+)/)) {
                // show JPEG image in page
                document.getElementById('img').innerHTML ='<h3>Upload Successfuly done</h3>'+msg;
                document.getElementById('img').innerHTML ="<img src="+msg+" class='"img'">";
                // reset camera for another shot
                webcam.reset();
            }
            else {alert("Error occured we are trying to fix now: " + msg); }
        }
    </script>
<div id="img" style=" height:500px; width:500px; float:left; margin-left:40px; margin-top:20px;">
</div>
</div>
</body>
</html>

句柄图像.php

<?php
session_start();
$_SESSION['id']="1";
$id=$_SESSION['id'];
include 'config.php';  //assume you have connected to database already.
$name = date('YmdHis');
$newname="images/".$name.".jpg";
$file = file_put_contents( $newname, file_get_contents('php://input') );
if (!$file) {
    print "Error occured here";
    exit();
}
else
{
    $sql="INSERT INTO image VALUES ('','$name','$newname')";
    $result=mysqli_query($con,$sql);
    $value=mysqli_insert_id($con);
    $_SESSION["myvalue"]=$value;
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $newname;
print "$url'n";
?>

这些是主页,然后没有配置.php文件和网络摄像头.js以及网络摄像头.swf

您必须编写 mysql 删除查询以从数据库中删除图像路径并使用 unlink('文件路径') 功能从文件夹中删除图像。

您需要任何其他帮助重播。