Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deletecategory.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?PHP
  2. require_once('lib/dashboard.php');
  3. require_once('lib/common.php');
  4. if (!isset($_GET['n']) || !ctype_digit($_GET['n'])) {
  5. header('Location: '.CP_PATH.'categories');
  6. }
  7. $categories = getCategories();
  8. if (!isset($categories[$_GET['n']])) {
  9. header('Location: '.CP_PATH.'categories');
  10. return;
  11. }
  12. $sql = 'SELECT COUNT(*) FROM issues_issues WHERE icat_id = '.m($_GET['n']);
  13. $res = mysql_query($sql);
  14. $data = mysql_fetch_array($res);
  15. if ($data[0] == 0) {
  16. if (isset($_POST['confirm'])) {
  17. $sql = 'DELETE FROM issues_categories WHERE icat_id = '.m($_GET['n']);
  18. mysql_query($sql);
  19. $sql = 'DELETE FROM issues_assigns WHERE icat_id = '.m($_GET['n']);
  20. mysql_query($sql);
  21. logger::log('Issue tracker: category deleted: '.getCategoryName($_POST['n']), getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
  22. header('Location: '.CP_PATH.'categories');
  23. return;
  24. } else {
  25. $sql = 'SELECT icat_id, icat_name FROM issues_categories WHERE icat_id = '.m($_GET['n']);
  26. $res = mysql_query($sql);
  27. $data = mysql_fetch_assoc($res);
  28. $data[0] = 0;
  29. }
  30. } else {
  31. $sql = 'SELECT i_id, i_title FROM issues_issues WHERE icat_id = '.m($_GET['n']);
  32. $res = mysql_query($sql);
  33. }
  34. define('TITLE', 'Issue tracker :: Delete Category :: '.h($categories[$_GET['n']]));
  35. addDashboardItem('Actions', 'Raise new issue', 'addissue');
  36. include_once('res/commonDashboard.php');
  37. require_once('lib/header.php');
  38. require_once('pages/deletecategory.php');
  39. require_once('lib/footer.php');
  40. ?>