3 or ($member_db[1] != 1 and $action == "doimagedelete")){ msg("error", "Access Denied", "You don't have permission to manage images"); } $allowed_extensions = array("gif", "jpg", "png", "bmp", "jpe", "jpeg"); // ******************************************************************************** // Show Images List // ******************************************************************************** if($action != "doimagedelete") { if($action == "quick") { echo" Insert Image "; }else{ echoheader("images","Manage Images"); } if($subaction == "upload") { if(!$image){ $image = $HTTP_POST_FILES['image']['tmp_name']; } if(!$image_name){ $image_name = $HTTP_POST_FILES['image']['name']; } $image_name = str_replace(" ", "_", $image_name); $img_name_arr = explode(".",$image_name); $type = end($img_name_arr); if($image_name == ""){ $img_result = "
No File Specified For Upload !!!"; } elseif( !isset($overwrite) and file_exists($config_path_image_upload."/".$image_name)){ $img_result = "
Image already exist !!!";} elseif( !(in_array($type, $allowed_extensions) or in_array(strtolower($type), $allowed_extensions)) ){ $img_result = "
This type of file is not allowed !!!"; } else { @copy($image, $config_path_image_upload."/".$image_name) or $img_result = "Couldn't copy image to server
Check if file_uploads is allowed in the php.ini file of your server"; if(file_exists($config_path_image_upload."/".$image_name)) { $img_result = "
Image was uploaded"; if($action == "quick"){ $img_result .= " [insert it]"; } }//if file is uploaded succesfully } } echo"
Upload Image
  
Overwrite if exist? $img_result
Uploaded Images
"; $img_dir = opendir($config_path_image_upload); $i = 0; while ($file = readdir($img_dir)) { //Yes we'll store them in array for sorting $images_in_dir[] = $file; } natcasesort($images_in_dir); reset($images_in_dir); foreach ($images_in_dir as $file) { $img_name_arr = explode(".",$file); $img_type = end($img_name_arr); if ( (in_array($img_type, $allowed_extensions) or in_array(strtolower($img_type), $allowed_extensions)) and $file != ".." and $file != "." and is_file($config_path_image_upload."/".$file)) { $i++; $this_size = filesize($config_path_image_upload."/".$file); $total_size += $this_size; $img_info = getimagesize($config_path_image_upload."/".$file); if( $i%2 != 0 ){ $bg = "bgcolor=#F7F6F4"; } else{ $bg = ""; } if($action == "quick") { $my_area = str_replace("_", " ", $area); echo" "; } else { echo""; } } } if($i > 0){ echo""; } echo"'; } echo'
  $file $img_info[0]x$img_info[1]  ". formatsize($this_size) ."
  $file $img_info[0]x$img_info[1]  ". formatsize($this_size) ."
"; if($action != "quick"){ echo"
 
Total size
 
". formatsize($total_size) .'
'; if($action != "quick"){ echofooter(); } } // ******************************************************************************** // Delete Image // ******************************************************************************** elseif($action == "doimagedelete") { if(!isset($images)){ msg("info","No Images selected","You must select images to be deleted.", "$PHP_SELF?mod=images"); } // if(!file_exists($config_path_image_upload."/".$image) or !$image){ msg("error","Error !!!","Could not delete image", "$PHP_SELF?mod=images"); } foreach($images as $image){ unlink($config_path_image_upload."/".$image) or print("Could not delete image $file"); } msg("info","Image(s) Deleted","The image was successfully deleted.", "$PHP_SELF?mod=images"); } ?>