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.

addemail.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <form action="<?PHP echo CP_PATH; ?>email" method="post">
  2. <div class="block">
  3. <h2>Add e-mail address</h2>
  4. <div class="innerblock">
  5. <p class="blurb">
  6. This will associated an e-mail address with an existing mailbox.
  7. </p>
  8. <table class="form leftpad">
  9. <tr>
  10. <th>E-Mail address</th>
  11. <td><input type="text" name="email_user" class="inflat"> @
  12. <select name="email_domain" class="inflat">
  13. <?PHP
  14. $sql = 'SELECT domain_name, domain_id FROM domains WHERE user_id = '.UID.' AND domain_enabled = 1 ORDER BY domain_name';
  15. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  16. $found = false;
  17. while ($row = mysql_fetch_array($res)) {
  18. $found = true;
  19. echo '<option value="'.$row['domain_id'].'">'.h($row['domain_name']).'</option>';
  20. }
  21. if (!$found) { echo '<option value="err">&lt;No domains&gt;</option>'; }
  22. ?>
  23. </select></td>
  24. </tr>
  25. <tr>
  26. <th>Mailbox</th>
  27. <td><select name="email_mailbox" class="inflat">
  28. <?PHP
  29. $sql = 'SELECT mailbox_id, mailbox_user, domain_name FROM mailboxes NATURAL JOIN domains WHERE user_id = '.UID.' ORDER BY mailbox_user, domain_name';
  30. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  31. if (mysql_num_rows($res) == 0) {
  32. echo '<option value="err">&lt;No mailboxes&gt;</option>';
  33. } else {
  34. while ($row = mysql_fetch_assoc($res)) {
  35. echo '<option value="'.$row['mailbox_id'].'">';
  36. echo h($row['mailbox_user'] . '@' . $row['domain_name']);
  37. echo '</option>';
  38. }
  39. }
  40. ?>
  41. </select></td>
  42. </tr>
  43. <tr>
  44. <th>Actions</th>
  45. <td><input type="submit" value="Add"> <input type="reset" value="Cancel"></td>
  46. <td></td>
  47. </tr>
  48. </table>
  49. </div>
  50. </div>
  51. </form>