I have several sites hosted with the same hosting company (blueho..) and they are all having this issue. Same code is used on sites NOT on that hosting do not have this issue.
When the DELETE scripts are published to the server, the content will vanish randomly, with no notice and no sort of predictable pattern. Will just be gone... and the hosting company cannot see why it's happening. If I remove the DELETE scripts from the server, this does not happen at all. All admin scripts are protected via user login password.
Can anyone look at the code and see what would be causing this? PLEASE HELP!! 😕
<?php
$id = $_GET['id'];
$sql = "SELECT * ";
$sql .= "FROM gallery ";
$sql .= "WHERE id='$id' ";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$img_sm = $row['img_sm'];
$img_lg = $row['img_lg'];
if(is_file("../gallery/$img_sm")) {
unlink("../gallery/$img_sm");
}
if(is_file("../gallery/$img_lg")) {
unlink("../gallery/$img_lg");
}
$sql = "DELETE FROM gallery ";
$sql .= "WHERE id='$id' ";
if(mysql_query($sql)) {
header('Location: gallery_index.php');
}
else {
die('<h1>Unable to remove image</h1>');
}
?>