deeemm-cms /admin/includes/delete_item.php

Language PHP Lines 55
MD5 Hash 69a73694555bed5752fa3dee1acea4eb Estimated Cost $306 (why?)
Repository https://bitbucket.org/mpercy/deeemm-cms View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

defined( '_INDM' ) or die( 'POSSIBLE HACK ATTEMPT!' );

/*===========================================================================
Check user priviledges
===========================================================================*/
require VALIDATE;

if ($user != 'ADMIN') header("Location: " . $default_url . "index.php");



if ($action == 'delete') {
	$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . "$page` WHERE `id` = '$id'");
	while($sql_result = mysql_fetch_array($sql_query)){
		$filename = $sql_result[image];
	}

	//	//check to make sure image stored in image field not used elsewhere
	//	//may need to only check this for media type articles
	//	$no_times_used = 1;
	//	for($count=0;$count<$num_tables+1;$count++){
	//	  $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . $all_tables[$count] . "` WHERE `title_lan_" . $language . "` LIKE '%" . $filename . "%' OR `description_lan_" . $language . "` LIKE '%" . $filename . "%' ");
	//
	//	  while($sql_result = @mysql_fetch_array($sql_query)){
	//			//keep tally of number of times file used
	//	    $no_times_used += 1;
	//			//generate list of items for the messagebox
	//			$file_list .= '<a href = "' . $default_url . 'index.php?page=' . $all_tables[$count] . '&id=' . $sql_result[id] . '">' . $sql_result['title_lan_'.$language] . '</a><br>';
	//	  }
	//	}
	//
	//	if ($no_times_used > 1) {
	//		$page = 'messagebox';
	//		$warning_message = $lan['image_used'] . $file_list;
	//	} else {
	
	//delete image
	unlink ("$media_dir/$filename");
	
	//remove article
	mysql_query("DELETE FROM `" . $db_table_prefix . 'cat_' . "$page` WHERE `id` = '$id'");
	
	//defragment table
	mysql_query("ALTER TABLE `" . $db_table_prefix . 'cat_' . "$page` ENGINE=INNODB");
	
	//return to where you came from
 	header("Location: " . $default_url . "index.php");
	exit;
	//	}
}

?>
Back to Top