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.

2new.php 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?PHP
  2. if (isset($_POST['back'])) {
  3. $_SESSION['stage'] = 1;
  4. header('Location: /signup/1');
  5. exit;
  6. }
  7. if (isset($_SESSION['data']) && !isset($_POST['user'])) {
  8. $_POST = $_SESSION['data'];
  9. }
  10. function moo() {
  11. if (!isset($_POST['user'])) {
  12. return;
  13. }
  14. if (!ctype_alnum($_POST['user'])) {
  15. echo '<div id="message">Please choose a username that only contains letters and/or numbers.</div>';
  16. return;
  17. }
  18. if (!isset($_POST['pass1']) || !isset($_POST['pass2'])) {
  19. echo '<div id="message">Please enter a password.</div>';
  20. return;
  21. }
  22. if (($err = validPass($_POST['pass1'])) !== true) {
  23. echo '<div id="message">'.$err.'</div>';
  24. return;
  25. }
  26. if ($_POST['pass1'] != $_POST['pass2']) {
  27. echo '<div id="message">Passwords do not match. Please confirm your password.</div>';
  28. return;
  29. }
  30. if (strlen($_POST['name']) < 5 || strpos($_POST['name'],' ') === false) {
  31. echo '<div id="message">Please enter your full name.</div>';
  32. return;
  33. }
  34. if (empty($_POST['email']) || !preg_match('/^[^@]+@([^\.@:\[\]\(\)]+\.)+[a-z]{2,}$/i', $_POST['email'])) {
  35. echo '<div id="message">Please enter a valid e-mail address.</div>';
  36. return;
  37. }
  38. require_once('../control/lib/database.php');
  39. $sql = 'SELECT bu_name FROM banneduser';
  40. $res = mysql_query($sql);
  41. while ($row = mysql_fetch_array($res)) {
  42. $nick = $row[0];
  43. if (strpos(strtolower($_POST['user']), strtolower($nick)) !== false) {
  44. echo '<div id="message">That username is not permitted. Please chose another.</div>';
  45. return;
  46. }
  47. }
  48. $sql = 'SELECT user_id FROM users WHERE LCASE(user_name) = \''.mysql_real_escape_string(strtolower($_POST['user'])).'\'';
  49. $res = mysql_query($sql);
  50. if (mysql_num_rows($res) > 0) {
  51. echo '<div id="message">That username is in use. Please select another.</div>';
  52. return;
  53. }
  54. if (isset($_POST['proceed'])) {
  55. unset($_POST['proceed']);
  56. $_SESSION['data'] = $_POST;
  57. $_SESSION['stage'] = 3;
  58. header('Location: /signup/3');
  59. exit;
  60. }
  61. }
  62. moo();
  63. ?>
  64. <p>
  65. Your username and password will be the ones you use to log in to the control
  66. panel and FTP. Your password should be between 5 and 20 characters, and contain
  67. at least one upper case letter, one lower case letter, and one number.
  68. </p>
  69. <form action="/signup/2" method="post">
  70. <input type="hidden" name="proceed" value="...">
  71. <table>
  72. <tr>
  73. <th>Username:</th>
  74. <td><input type="text" name="user"<?PHP if (isset($_POST['user'])) { echo ' value="'.htmlentities($_POST['user']).'"'; } ?>></td>
  75. </tr>
  76. <tr>
  77. <th>Password:</th>
  78. <td><input type="password" name="pass1"<?PHP if (isset($_POST['pass1'])) { echo ' value="'.htmlentities($_POST['pass1']).'"'; } ?>></td>
  79. </tr>
  80. <tr>
  81. <th>Confirm password:</th>
  82. <td><input type="password" name="pass2"<?PHP if (isset($_POST['pass2'])) { echo ' value="'.htmlentities($_POST['pass2']).'"'; } ?>></td>
  83. </tr>
  84. </table>
  85. <p>
  86. The following basic contact information is required.
  87. </p>
  88. <table>
  89. <tr>
  90. <th>Full name:</th>
  91. <td><input type="text" name="name"<?PHP if (isset($_POST['name'])) { echo ' value="'.htmlentities($_POST['name']).'"'; } ?>></td>
  92. </tr>
  93. <tr>
  94. <th>E-mail address:</th>
  95. <td><input type="text" name="email"<?PHP if (isset($_POST['email'])) { echo ' value="'.htmlentities($_POST['email']).'"'; } ?>></td>
  96. </tr>
  97. </table>
  98. <p>
  99. Optional extended contact details.
  100. </p>
  101. <table style="margin-bottom: 10px;">
  102. <tr>
  103. <th>Telephone:</th>
  104. <td><input type="text" name="phone"<?PHP if (isset($_POST['phone'])) { echo ' value="'.htmlentities($_POST['phone']).'"'; } ?>></td>
  105. </tr>
  106. <tr>
  107. <th>Address:</th>
  108. <td><input type="text" name="addr"<?PHP if (isset($_POST['addr'])) { echo '
  109. value="'.htmlentities($_POST['addr']).'"'; } ?>></td>
  110. </tr>
  111. </table>
  112. <p>
  113. Your personal information will be stored on this server (which is located in
  114. the United States of America), will not be disclosed to any third parties
  115. unless required by law,
  116. and will only be used by UTD-Hosting to contact you with regard to matters
  117. directly concerning your UTD-Hosting account. All resonable actions will be undertaken to safeguard this data from external access.
  118. If you do not agree to this,
  119. please discontinue the signup process.
  120. </p>
  121. <input type="submit" name="forward" value="Next" style="float: right;">
  122. </form>
  123. <form action="/signup/2" method="post">
  124. <input type="submit" name="back" value="Previous">
  125. </form>