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.

ticketoverview.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?PHP
  2. if (!defined('LIB_DATABASE')) { require_once('lib/database.php'); }
  3. if (!defined('LIB_COMMON')) { require_once('lib/common.php'); }
  4. ?>
  5. <div class="block">
  6. <h2>My tickets opened in the past month</h2>
  7. <table class="innerblock">
  8. <tr>
  9. <th>&nbsp;</th>
  10. <th>Title</th>
  11. <th>View</th>
  12. <th>Date</th>
  13. <th>Replies</th>
  14. <th>Status</th>
  15. </tr>
  16. <?PHP
  17. $i = 0;
  18. $n = 0;
  19. $sql = 'SELECT ticket_id, ticket_status, ticket_title, ticket_time FROM tickets WHERE ticket_thread = ticket_id AND ticket_time > '.(time() - 60*60*24*31).' AND user_id = '.UID;
  20. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  21. if (mysql_num_rows($res) == 0) {
  22. echo '<tr><td colspan="6" style="font-style: italic; text-align: center;">No tickets opened recently</td></tr>';
  23. }
  24. while ($row = mysql_fetch_array($res)) {
  25. $n++;
  26. $sql2 = 'SELECT COUNT(*) FROM tickets WHERE ticket_thread = '.$row['ticket_id'];
  27. $res2 = mysql_query($sql2) or mf(__FILE__, __LINE__, $sql2);
  28. $num = mysql_fetch_array($res2); $num = (int)$num[0] - 1;
  29. ?>
  30. <tr class="<?PHP echo ($i == 0) ? 'even' : 'odd'; ?>">
  31. <td><?PHP echo $n; ?>.</td>
  32. <td><?PHP echo htmlspecialchars($row['ticket_title']); ?></td>
  33. <td><a href="<?PHP echo CP_PATH; ?>viewticket/<?PHP echo $row['ticket_id']; ?>">View</a></td>
  34. <td><?PHP echo substr(gmdate('r', $row['ticket_time']),0,-6); ?></td>
  35. <td><?PHP echo $num; ?></td>
  36. <?PHP
  37. if ($row['ticket_status'] == 'new' || $row['ticket_status'] == 'reopened') {
  38. echo '<td class="err">'.ucfirst($row['ticket_status']).'</td>';
  39. } else {
  40. echo '<td>'.ucfirst($row['ticket_status']).'</td>';
  41. }
  42. ?>
  43. </tr>
  44. <?PHP
  45. $i = 1 - $i;
  46. }
  47. ?>
  48. </table>
  49. </div>