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.

admin.discounts.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?PHP
  2. require_once('lib/database.php');
  3. require_once('lib/common.php');
  4. ?>
  5. <div class="block" id="log">
  6. <h2>ADMIN: Discounts</h2>
  7. <table class="innerblock">
  8. <tr>
  9. <th>&nbsp;</th>
  10. <th>Code</th>
  11. <th>Time</th>
  12. <th>Money</th>
  13. <th>Type</th>
  14. <th>Package</th>
  15. <th>Start</th>
  16. <th>End</th>
  17. </tr>
  18. <?PHP
  19. $i = 0;
  20. $n = 0;
  21. $sql = 'SELECT discount_id, discount_code, discount_time, discount_money, ';
  22. $sql .= 'discount_type, discount_start, discount_end, package_name FROM ';
  23. $sql .= 'discounts NATURAL JOIN packages ORDER BY discount_end';
  24. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  25. while ($row = mysql_fetch_array($res)) {
  26. $n++;
  27. echo '<tr class="'.(($i != 0) ? 'odd':'even').'">';
  28. echo ' <td>' . $n . '.</td>';
  29. echo ' <td style="font-family: monospace;">' . h($row['discount_code']) . '</td>';
  30. echo ' <td>' . duration($row['discount_time']) . '</td>';
  31. echo ' <td>&pound;' . ($row['discount_money'] / 100) . '</td>';
  32. echo ' <td>' . ucfirst($row['discount_type']) . '</td>';
  33. echo ' <td>' . h($row['package_name']) . '</td>';
  34. echo ' <td' . ($row['discount_start'] > time() ? ' style="color: red"' : '') . '>';
  35. echo substr(date('r', $row['discount_start']), 0, -15) . '</td>';
  36. echo ' <td' . ($row['discount_end'] < time() ? ' style="color: red"' : '') . '>';
  37. echo substr(date('r', $row['discount_end']), 0, -15) . '</td>';
  38. echo '</tr>';
  39. $i = 1 - $i;
  40. }
  41. ?>
  42. </table>
  43. </div>