/inc/php/unlink.php
PHP | 42 lines | 34 code | 3 blank | 5 comment | 7 complexity | 1c11fb07bf51de63b1beccea787ec660 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-2.0
- <?
- error_reporting(E_ALL);
- ini_set("display_errors", "1");
- include_once("../../config.php");
- include_once("../../functions.php");
- if($_REQUEST["op"] == "top_image"){
- @unlink("../../top-images/".$_REQUEST["img"]);
- @unlink("../../top-images/thumbs/".$_REQUEST["img"]);
- @unlink("../../top-images/pixelated/".$_REQUEST["img"]);
- header("Location: ../../admin.php?op=".$_REQUEST["op"]);
- }
- elseif($_REQUEST["op"] == "db_data"){
- @unlink($GLOBALS["cwd"].$_REQUEST["file"]);
- $path = explode("/",$_REQUEST["file"]);
- $length = count($path);
- $thumb[0] = "../..";
- for($i = 1; $i < $length; $i++){
- $thumb[] = $path[$i];
- if(($length - 2) == $i) $thumb[] = "thumbs";
- }
- @unlink($GLOBALS["cwd"].implode("/",$thumb));
-
- $sql->query("delete from files_$GLOBALS[db_lang] where file = '".filename_to_db(str_replace("/assets/", "", $_REQUEST["file"]))."'");
- //echo "delete * from files_$GLOBALS[db_lang] where file = '".filename_to_db(str_replace("/assets/", "", $_REQUEST["file"]))."' ";
- //var_dump($mysqli); die();
- echo "Fails $_REQUEST[file] dzēsts";
- }
- elseif($_REQUEST["op"] == "db_graphics"){
- $file = substr($GLOBALS["cwd"], 0, strlen($GLOBALS["cwd"]) - 1).$_REQUEST["file"];
- @unlink($file);
- //echo $file;
- $pi = pathinfo($file);
- @unlink($pi["dirname"]."/thumbs/".$pi["basename"]);
- @unlink($pi["dirname"]."/thumbs/".$GLOBALS["thumbsize"]."/".$pi["basename"]);
-
- $sql->query("delete from graphics_$GLOBALS[db_lang] where filename = '".$pi["basename"]."'");
- //echo "delete from graphics_$GLOBALS[db_lang] where filename = '".$pi["filename"]."'";
- //var_dump($mysqli); die();
- echo "Fails $_REQUEST[file] dzēsts";
- }
- ?>