Unsupported scripts and control panel web app for a hosting company
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

editsite.domains.php 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <div class="block">
  2. <h2>Domain associations</h2>
  3. <div class="innerblock">
  4. <p class="blurb">
  5. To view this website, you must associate it with at least one domain name.
  6. You will then be able to view the site simply by typing the domain name
  7. in your browser.
  8. </p>
  9. <form action="<?PHP echo CP_PATH; ?>editsite" method="POST">
  10. <input type="hidden" name="task" value="domains">
  11. <input type="hidden" name="site" value="<?PHP echo SITE_ID; ?>">
  12. <table class="form">
  13. <?PHP
  14. $sql = 'SELECT domain_id, domain_name, domain_parent FROM domains WHERE domain_enabled = 1 AND user_id = '.SUID.' ORDER BY domain_name';
  15. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  16. $doms = array();
  17. while ($row = mysql_fetch_array($res)) {
  18. $doms[$row['domain_parent']][] = $row;
  19. }
  20. foreach ($doms[0] as $row) {
  21. doDomain($row);
  22. }
  23. function doDomain($row, $indent = 0) {
  24. $sql2 = 'SELECT r.record_value, s.site_name 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';
  25. $res2 = mysql_query($sql2) or mf(__FILE__, __LINE__, $sql2);
  26. if (mysql_num_rows($res2) > 0) {
  27. $row2 = mysql_fetch_array($res2);
  28. $asite = $row2['site_name'];
  29. } else {
  30. $asite = '';
  31. }
  32. ?>
  33. <tr>
  34. <td><input type="checkbox" id="domain<?PHP echo $row['domain_id']; ?>" name="domain<?PHP echo $row['domain_id']; ?>"<?PHP if ($asite == SITE_NAME) { echo " checked=\"checked\""; } elseif ($asite != '') { echo " disabled=\"disabled\""; } ?>></td>
  35. <td<?PHP echo $indent == 0 ? ' style="font-weight: bold;"' : ''; ?>>
  36. <?PHP echo str_repeat('&gt; ', $indent).h($row['domain_name']); ?>
  37. </td>
  38. <td><?PHP if ($asite != '' && $asite != SITE_NAME) { ?>
  39. Already associated with <?PHP echo h($asite); ?>.
  40. <?PHP } ?>
  41. </td>
  42. </tr>
  43. <?PHP
  44. global $doms;
  45. if (isset($doms[$row['domain_id']])) {
  46. foreach ($doms[$row['domain_id']] as $nrow) {
  47. doDomain($nrow, $indent+1);
  48. }
  49. }
  50. }
  51. ?>
  52. <tr><td colspan="2" style="text-align: right"><input type="submit" value="Save"></td></tr>
  53. </table>
  54. </form>
  55. </div>
  56. </div>