Mini Shell Moded By TiGER HeX
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
var
/
www
/
ridazz
/
admin
/
Linux midnightridazz 4.19.0-11-cloud-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64
Upload File :
New :
File
Dir
//var/www/ridazz/admin/imagesPurge.php
<? include_once('../includes/static/configure.php'); include_once('../includes/static/util.php'); include_once('../includes/static/dbcon.php'); include_once('../includes/static/gdimg.php'); include_once('../includes/static/sessions.php'); include_once('includes/static/util.php'); include_once('includes/appTop.php'); $page_id = str_replace(".php","",basename($_SERVER['PHP_SELF'])); if(!has_permission($page_id)){ die("You don't have permission to view this page!"); } include_once('includes/header.php'); ?> <div class="title">Image Purge</div> <? //delete old forum entries if(isset($_REQUEST['confirm'])){ /****************** remove all old gallery images ***********************/ $sql = "SELECT image FROM 50mm_gallery"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die($sql_error['message']); } $db_imgs = Array(); while($row = $db->sql_fetchrow($result)){ array_push($db_imgs,$row['image']); } //compute the differences between images in the db and on the server //delete large image files $large_img = dir_ls(ROOT_DIR.GALLERY_LIMG_DIR); $del_imgs = array_diff($large_img, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.GALLERY_LIMG_DIR.$file); } //delete small image files $small_img = dir_ls(ROOT_DIR.GALLERY_SIMG_DIR); $del_imgs = array_diff($small_img, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.GALLERY_SIMG_DIR.$file); } /****************** remove all old forum images ***********************/ $sql = "SELECT image FROM 50mm_forum_topics"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die($sql_error['message']); } $db_imgs = Array(); while($row = $db->sql_fetchrow($result)){ if(!empty($row['image'])){ array_push($db_imgs,$row['image']); } } $sql = "SELECT image FROM 50mm_forum_replies"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die($sql_error['message']); } while($row = $db->sql_fetchrow($result)){ if(!empty($row['image'])){ array_push($db_imgs,$row['image']); } } $large_img = dir_ls(ROOT_DIR.FORUM_LIMG_DIR); $del_imgs = array_diff($large_img, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.FORUM_LIMG_DIR.$file); } //delete small image files $small_img = dir_ls(ROOT_DIR.FORUM_SIMG_DIR); $del_imgs = array_diff($small_img, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.FORUM_SIMG_DIR.$file); } /************************** delete profile images ********************/ $sql = "SELECT image FROM 50mm_users"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die($sql_error['message']); } $db_imgs = Array(); while($row = $db->sql_fetchrow($result)){ if(!empty($row['image'])){ array_push($db_imgs,$row['image']); } } $image = dir_ls(ROOT_DIR.PROFILE_IMG_DIR); $del_imgs = array_diff($image, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.PROFILE_IMG_DIR.$file); } /********************* delete story images *****************/ $sql = "SELECT image FROM 50mm_embed"; if( !($result = $db->sql_query($sql)) ){ $sql_error = $db->sql_error(); die($sql_error['message']); } $db_imgs = Array(); while($row = $db->sql_fetchrow($result)){ if(!empty($row['image'])){ array_push($db_imgs,$row['image']); } } $large_img = dir_ls(ROOT_DIR.STORY_LIMG_DIR); $del_imgs = array_diff($large_img, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.STORY_LIMG_DIR.$file); } //delete small image files $small_img = dir_ls(ROOT_DIR.STORY_SIMG_DIR); $del_imgs = array_diff($small_img, $db_imgs); while(list($key,$file) = each($del_imgs)){ unlink(ROOT_DIR.STORY_SIMG_DIR.$file); } $html = "<div class=\"hilite\">Successfully Modified</div>"; }else{ $html = "Are you sure that you want to delete all non used images? <a href=\"".$_SERVER['PHP_SELF']."?confirm=1\">yes</a> | <a href=\"javascript:history.back();\">no</a>"; } echo $html; ?> <? include_once('includes/footer.php'); include_once('includes/appBottom.php'); ?>