<?php
ini_set('display_errors', 1);
error_reporting(E_ERROR);  

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);

$success = "";
$imagedb = "lrimage";
$vouchno = $_REQUEST["vouchno"];
$source = "SL";
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

$path = "images/lr/" . $myyear . "/";

$fileName = "$source" . "-" . $vouchno . ".jpg";
$img_file = $path . ($fileName);

unlink($img_file);
//print "UPDATE `salemain` SET `imgpath`='' WHERE `vouchno`='$vouchno'";
mysqli_query($conn, "UPDATE `salemain` SET `imgpath`='' WHERE `vouchno`='$vouchno'") or die(mysqli_error($conn));
echo "Done";
?>