if (unlink($path)) {
         echo "<br>[process]:file deleted {$path}<br>";
     }
 }
 if ($firsttype != "text") {
     rename($targetdir . $firsttype . "/" . $first, $targetdir . $firsttype . "/" . "temp" . getextension($first));
     echo "<br>[process]:file renamed from {$first} to temp<br>";
 }
 $query = "DELETE from pairs WHERE id={$pairid}";
 $result = $conn->query($query);
 echo "<br>[process]:pair deleted from database<br>";
 if ($firsttype != "text") {
     udpate_database($first, $firsttype, $pairid);
 }
 if ($firsttype != $secondtype && $secondtype != "text") {
     udpate_database($second, $secondtype, $pairid);
 }
 update_id($pairid);
 echo "<br>[process]:first file type is {$firsttype}<br>";
 if ($firsttype != "text") {
     $c1name = getfilename($firsttype);
     $c1name = $c1name . "." . getextension($first);
     rename($targetdir . $firsttype . "/" . "temp" . getextension($first), $targetdir . $firsttype . "/" . $c1name);
     echo "<br>[process]:file renamed from temp to {$c1name}<br>";
 } else {
     $c1name = $first;
 }
 echo "<br>[process]:second file type is {$c2filetype}<br>";
 if ($c2filetype != "text") {
     $c2name = getfilename($c2filetype);
     if ($firsttype == $c2filetype) {
Example #2
0
        echo "<br>[process]:file deleted {$path}<br>";
    }
    $type1 = $row[1];
    $col1 = $row[0];
}
echo "<br>[process]:second file type is {$row['3']}<br>";
//deleting second file
if ($row[3] != "text") {
    $path = $localhost . "Matching-Game/assets/" . $row[3] . "/" . $row[2];
    if (unlink($path)) {
        echo "<br>[process]:file deleted {$path}<br>";
    }
    $type2 = $row[3];
    $col2 = $row[2];
}
//updating database
echo "<br>[process]:updating database<br>";
$query = "DELETE from pairs WHERE id='{$pairid}'";
$result = $conn->query($query);
if ($type1 != "") {
    udpate_database($col1, $type1, $pairid);
}
if ($type1 != $type2 && $type2 != "") {
    udpate_database($col2, $type2, $pairid);
}
update_id($pairid);
echo "::;;deletion complete";
?>