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.

domains.list.php 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <div class="block">
  2. <h2>Domains</h2>
  3. <div class="innerblock">
  4. <p class="blurb">
  5. A domain may not be deleted while it is associated with a site.
  6. </p>
  7. <table class="form">
  8. <?PHP
  9. $sql = 'SELECT domain_id, domain_name, domain_parent FROM domains WHERE domain_enabled = 1 AND user_id = '.UID.' ORDER BY domain_name';
  10. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  11. if (mysql_num_rows($res) == 0) {
  12. echo '<p>You do not have any domains associated with your account.</p>';
  13. }
  14. $doms = array();
  15. while ($row = mysql_fetch_array($res)) {
  16. if (!isset($doms[$row['domain_parent']])) {
  17. $doms[$row['domain_parent']] = array();
  18. }
  19. $doms[$row['domain_parent']][] = $row;
  20. }
  21. foreach ($doms[0] as $row) {
  22. doDomain($row);
  23. }
  24. function doDomain($row, $indent = 0) {
  25. global $doms;
  26. $sql2 = 'SELECT r.record_value, s.site_name, s.site_id FROM records AS r, sites AS s WHERE r.domain_id = '.$row['domain_id'].' AND r.record_type = \'UTD\' AND s.site_id = r.record_value';
  27. $res2 = mysql_query($sql2) or mf(__FILE__, __LINE__, $sql2);
  28. if (mysql_num_rows($res2) > 0) {
  29. $row2 = mysql_fetch_array($res2);
  30. $asite = $row2['site_name'];
  31. $asiteid = $row2['site_id'];
  32. } else {
  33. $asite = '';
  34. }
  35. $name = h($row['domain_name']);
  36. ?>
  37. <tr>
  38. <td<?PHP echo $indent == 0 ? ' style="font-weight: bold;"' : ''; ?>>
  39. <?PHP echo str_repeat('&gt; ', $indent).$name; ?>
  40. </td>
  41. <td><?PHP if ($asite != '') { ?>
  42. Associated with <a href="<?PHP echo CP_PATH; ?>editsite/<?PHP echo $asiteid; ?>"><?PHP echo h($asite); ?></a>.
  43. </td><td>
  44. <?PHP if (gethostbyname($row['domain_name']) != '63.246.141.80') { ?>
  45. <a href="<?PHP echo CP_PATH; ?>support/017" style="color: red;">DNS Error</a>
  46. <?PHP } ?>
  47. <?PHP } else { ?>Not associated with any site.</td><td>
  48. <?PHP if (gethostbyname($row['domain_name']) != '63.246.141.80') { ?>
  49. <a href="<?PHP echo CP_PATH; ?>support/017" style="color: red;">DNS Error</a>
  50. <?PHP } ?>
  51. </td><td>
  52. <form action="<?PHP echo CP_PATH; ?>domains" method="post"><input type="hidden" name="action" value="deldom"><input type="hidden" name="domain" value="<?PHP echo $row['domain_id']; ?>"><input type="submit" value="Delete"></form><?PHP } ?>
  53. </td>
  54. </tr>
  55. <?PHP
  56. if (isset($doms[$row['domain_id']])) {
  57. foreach ($doms[$row['domain_id']] as $nrow) {
  58. doDomain($nrow, $indent + 1);
  59. }
  60. }
  61. }
  62. ?>
  63. </table>
  64. </div>
  65. </div>