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.

viewticket.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?PHP
  2. require_once('lib/dashboard.php');
  3. require_once('lib/account.php');
  4. if (!isset($_GET['n']) || !preg_match('/^[0-9]+$/',$_GET['n'])) {
  5. $error = 'Invalid ticket ID!';
  6. define('TICKET_TITLE', 'Error');
  7. } elseif (!defined('UID')) {
  8. $error = 'You must be logged in to view tickets.';
  9. define('TICKET_TITLE', 'Error');
  10. } else {
  11. $ticket = $_GET['n'];
  12. $sql = 'SELECT t.ticket_id, t.ticket_status, t.ticket_body, t.ticket_title, t.ticket_time, u.user_admin, u.user_id, u.user_name, ud.ud_name FROM tickets AS t, users AS u, userdetails AS ud WHERE ud.user_id = u.user_id AND t.ticket_thread = '.$ticket.' AND u.user_id = t.user_id ORDER BY t.ticket_id ASC';
  13. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  14. if (mysql_num_rows($res) == 0) {
  15. $error = 'There is no such ticket with that ID.';
  16. } else {
  17. $row = mysql_fetch_array($res);
  18. if ($row['user_id'] != UID && !defined('ADMIN')) {
  19. $error = 'You did not raise this ticket.';
  20. } else {
  21. define('TICKET_TITLE', $row['ticket_title']);
  22. define('TICKET_STATUS', $row['ticket_status']);
  23. define('TICKET_ID', $row['ticket_id']);
  24. define('TICKET_BODY', $row['ticket_body']);
  25. define('TICKET_TIME', $row['ticket_time']);
  26. define('TICKET_USER', $row['ud_name'].' ['.$row['user_name'].']');
  27. define('TICKET_RES', $res);
  28. }
  29. }
  30. }
  31. define('TITLE', 'View ticket :: '.TICKET_TITLE);
  32. addDashboardItem('Useful links', 'Support center', 'support');
  33. addDashboardItem('Useful links', 'Raise a new ticket', 'tickets');
  34. addDashboardItem('Frequently asked questions', 'Can I file support requests without using the control panel?', 'support/005');
  35. require_once('lib/header.php');
  36. require_once('pages/viewticket.php');
  37. require_once('lib/footer.php');
  38. ?>