diff --git a/public/delete.php b/public/delete.php index 813a15c..b7efd5c 100644 --- a/public/delete.php +++ b/public/delete.php @@ -1,113 +1,112 @@ . **/ /* function getimg($url) { #$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg'; $headers[] = 'Connection: Keep-Alive'; $headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'; $user_agent = 'php'; $process = curl_init($url); curl_setopt($process, CURLOPT_HTTPHEADER, $headers); curl_setopt($process, CURLOPT_HEADER, 0); curl_setopt($process, CURLOPT_USERAGENT, $user_agent); curl_setopt($process, CURLOPT_TIMEOUT, 30); curl_setopt($process, CURLOPT_USERPWD, "ubuntu:ubuntu."); curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); $return = curl_exec($process); curl_close($process); return $return; } * */ //$CN_APTH = "/mnt/volume-fra1-11/var/www/cdn/pling-cdn"; $CN_APTH = "."; //echo "Test-URL". urlencode('8/d/9/f/b3eae1990699459eac56beb682b5e79f45e0.png'); $imgurl = urldecode($_GET['path']); echo "

Deleting file: ".$imgurl.'

'; $delete_post_name = $_GET['post']; $imagename = basename($imgurl); if (!$imgurl || !$imagename) { print "Error, param: path missing"; return; } if (!$delete_post_name) { print "Error, param: post missing"; return; } $fileExists = file_exists($CN_APTH.'/img/' . $imgurl); print_r("

File exists: ".$CN_APTH.'/img/' . $imgurl.' = ' . $fileExists); if($fileExists) { echo ''; } print_r("

Rename file..."); +print_r('

cp '.$CN_APTH.'/img/' . $imgurl . ' ' . $CN_APTH.'/img/' . $imgurl . $delete_post_name); //$last_line = system('mv '.$imgurl . ' ' . $imgurl . $delete_post_name, $retval); //TODO -$last_line = system('cp '.$imgurl . ' ' . $imgurl . $delete_post_name, $retval); +$last_line = system('cp '.$CN_APTH.'/img/' . $imgurl . ' ' . $CN_APTH.'/img/' . $imgurl . $delete_post_name); echo $last_line; -echo $retval; $fileExists = file_exists($CN_APTH.'/img/' . $imgurl . $delete_post_name); print_r("

New File exists: ".$CN_APTH.'/img/' . $imgurl . $delete_post_name.' = ' . $fileExists); if($fileExists) { echo ''; } //TODO print_r("

Search for cached files: "); +print_r('

cd '.$CN_APTH.'/cache/ && locate -i "' . $imgurl.'"'); -$last_line = system('locate -i "'.$imagename.'"', $retval); +$last_line = system('cd '.$CN_APTH.'/cache/ && locate -i "' . $imgurl.'"'); echo $last_line; -echo $retval; - /* $image = getimg($imgurl); file_put_contents('img/' . $imagename, $image); if (file_exists('./img/' . $imagename)) { print ""; } else { print "Error"; } */ \ No newline at end of file