Location: PHPKode > scripts > Joe Images > joe_images/index.php
<?php
// IMAGE GALLERY ADMIN PAGE
require "config_connect_functions.php";

auth();

headerPrint();

if($fuse == "del"){

   if($_SERVER[REQUEST_METHOD] == "POST"){
      
      $del = mysql_query("DELETE FROM joe_images WHERE id = '$id'");
      if(file_exists($image_config[path]."".$id."LG.jpg")){
         unlink($image_config[path]."".$id."LG.jpg");
      }
      if(file_exists($image_config[path]."".$id.".jpg")){
         unlink($image_config[path]."".$id.".jpg");
      }
      successMsg("The record has been deleted successfully");
      
   }else{
   
	  print "<form method='post'>";
	  print "Are you sure you want to delete this record?<br><input type='submit' value='Yes'> <input type='button' value='Cancel' onclick='javascript:history.back()'>";
 	  print "</form>";
 	  
   }

   footerPrint();
   exit;

}

if($fuse == "add" OR $fuse == "mod"){
   
   if($_SERVER[REQUEST_METHOD] == "POST"){
      
       if($fuse == "mod"){
          $ins = mysql_query("UPDATED joe_images SET status = '$r[status]', name = '$r[name]', info = '$r[info]'") or die("died");  
          successMsg("The record has been updated successfully!");
       }
       if($fuse == "add"){
   
          errorCheck($r, $image);
          $ins = mysql_query("INSERT INTO joe_images SET status = '$r[status]', name = '$r[name]', info = '$r[info]'") or die("died");  
          $lastID = mysql_insert_id();
          
          list($w, $h) = getimagesize($image);
          
          if($w < $h){
             $new_w = round($image_config[large_w] / 2);
             $thumb_w = round($image_config[thumb_w] / 1.5);
          }else{
             $new_w = $image_config[large_w];
             $thumb_w = $image_config[thumb_w];
          }
          
          createThumb($image,"".$image_config[path]."".$lastID."LG.jpg",$new_w,$image_config[quality]);
          sleep(1);
          createThumb($image,"".$image_config[path]."$lastID.jpg",$thumb_w,$image_config[quality]);
          
          successMsg("The record has been added successfully!");
       }
      
   }else{
      form($id, $image_config);
   }

}else{
   listTable();
}

footerPrint();

?>
Return current item: Joe Images