Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 KB | None | 0 0
  1. Register.php UBERCMS:
  2.  
  3. <?php
  4. /*=======================================================================
  5. | UberWeb - Lightweight site system for Uber
  6. | #######################################################################
  7. | Copyright (c) 2009, Roy 'Meth0d'
  8. | http://www.meth0d.org
  9. | #######################################################################
  10. | This program is free software: you can redistribute it and/or modify
  11. | it under the terms of the GNU General Public License as published by
  12. | the Free Software Foundation, either version 3 of the License, or
  13. | (at your option) any later version.
  14. | #######################################################################
  15. | This program is distributed in the hope that it will be useful,
  16. | but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. | GNU General Public License for more details.
  19. \======================================================================*/
  20.  
  21. require_once "global.php";
  22.  
  23. if (mysql_num_rows(mysql_query("SELECT * FROM users WHERE ip_last = '" . $_SERVER["REMOTE_ADDR"] . "'")) > 19)
  24. {
  25. die('<h1>Hold up!</h2><hr>You have way too many accounts. You are not allowed any more.');
  26. }
  27.  
  28. if (LOGGED_IN)
  29. {
  30. header("Location: " . WWW . "/me");
  31. exit;
  32. }
  33.  
  34. $tpl->SetParam('error-messages-holder', '');
  35. $tpl->SetParam('post-name', '');
  36. $tpl->SetParam('post-pass', '');
  37. $tpl->SetParam('post-tos-check', '');
  38. $tpl->SetParam('post-mail', '');
  39.  
  40. if (isset($_GET['doSubmit']))
  41. {
  42. if (isset($_POST['checkNameOnly']) && $_POST['checkNameOnly'] == 'true')
  43. {
  44. //$name = $_POST['bean_avatarName'];
  45. $name = filter($_POST['bean_avatarName']);
  46.  
  47. echo ' <div class="field field-habbo-name">
  48. <label for="habbo-name">Username</label>
  49. <input type="text" id="habbo-name" size="32" value="' . clean($name) . '" name="bean.avatarName" class="text-field" maxlength="32"/>
  50. <a href="#" class="new-button" id="check-name-btn"><b>Check</b><i></i></a>
  51. <input type="submit" name="checkNameOnly" id="check-name" value="Check"/>
  52. <div id="name-suggestions">';
  53.  
  54. if ($users->IsNameTaken($name))
  55. {
  56. echo '<div class="taken"><p>Sorry, the name <strong>' . clean($name) . '</strong> is taken!</p></div>';
  57. }
  58. else if ($users->IsNameBlocked($name))
  59. {
  60. echo '<div class="taken"><p>Sorry, that name is reserved or disallowed.</p></div>';
  61. }
  62. else if (!$users->IsValidName($name))
  63. {
  64. echo '<div class="taken"><p>Sorry, that name is invalid. Your name can contain lowercase, uppercase letters, and numbers.</p></div>';
  65. }
  66. else
  67. {
  68. echo '<div class="available"><p>The name <strong>' . clean($name) . '</strong> is available.</p></div>';
  69. }
  70.  
  71. echo ' </div>
  72. <p class="help">Your name can contain lowercase and uppercase letters and numbers.</p>
  73. </div>';
  74.  
  75. exit;
  76. }
  77. else if (isset($_POST['bean_avatarName']))
  78. {
  79. $registerErrors = Array();
  80.  
  81. $name = filter($_POST['bean_avatarName']);
  82. $password = $_POST['bean_password'];
  83. $password2 = $_POST['bean_retypedPassword'];
  84. $email = filter($_POST['bean_email']);
  85.  
  86. $tpl->SetParam('post-name', $name);
  87. $tpl->SetParam('post-pass', $password);
  88. $tpl->SetParam('post-mail', $email);
  89.  
  90. if (strlen($name) < 1 || strlen($name) > 32)
  91. {
  92. $registerErrors[] = "Your username must be 1 - 32 characters in length.";
  93. }
  94.  
  95. if ($users->IsNameTaken($name))
  96. {
  97. $registerErrors[] = "Sorry, that name is taken.";
  98. }
  99. else if ($users->IsNameBlocked($name))
  100. {
  101. $registerErrors[] = "Sorry, that name is reserved or disallowed.";
  102. }
  103. else if (!$users->IsValidName($name))
  104. {
  105. $registerErrors[] = "Sorry, that name is invalid. Your name can contain lowercase, uppercase letters, and numbers.";
  106. }
  107.  
  108. if (strlen($password) < 6)
  109. {
  110. $registerErrors[] = "Your password must be at least 6 characters long.";
  111. }
  112.  
  113. if ($password != $password2)
  114. {
  115. $registerErrors[] = "Your passwords do not match. Please try again.";
  116. }
  117.  
  118. if (!$users->IsValidEmail($email))
  119. {
  120. $registerErrors[] = "Invalid e-mail address.";
  121. }
  122. if (!isset($_POST['bean_tos']) || $_POST['bean_tos'] != "accept")
  123. {
  124. $registerErrors[] = "You need to accept the Rules and Terms and Conditions to create an account.";
  125. }
  126. else
  127. {
  128. $tpl->SetParam('post-tos-check', 'checked');
  129. }
  130. if (count($registerErrors) <= 0)
  131. {
  132. // Add user
  133. $users->add($name, $users->UserHash($password, $name), $email, 1, 'hd-180-1.ch-210-66.lg-270-82.sh-290-91.hr-100-', 'M');
  134. mysql_query("UPDATE users SET newcrypto = '1' WHERE username = '" . $name . "'");
  135.  
  136. // Log user in
  137. $_SESSION['SHOW_WELCOME'] = true;
  138. $_SESSION['UBER_USER_N'] = $name;
  139. $_SESSION['UBER_USER_H'] = $users->UserHash($password, $name);
  140.  
  141. // Redirect user to welcome page
  142. header("Location: /client");
  143. exit;
  144. }
  145. else
  146. {
  147. $errResult = '<div class="error-messages-holder">
  148. <h3>Please fix the following problems and resubmit the form.</h3>
  149. <ul>';
  150.  
  151. foreach ($registerErrors as $err)
  152. {
  153. $errResult .= '<li><p class="error-message">' . $err . '</p></li>';
  154. }
  155.  
  156. $errResult .= '</ul></div>';
  157.  
  158. $tpl->SetParam('error-messages-holder', $errResult);
  159. }
  160. }
  161. }
  162.  
  163. $tpl->Init();
  164.  
  165. //$tpl->AddGeneric('head-init');
  166. //$tpl->AddIncludeSet('register');
  167. $tpl->WriteIncludeFiles();
  168. $tpl->AddGeneric('head-bottom');
  169. //$tpl->AddGeneric('page-register');
  170. //$tpl->AddGeneric('footer');
  171.  
  172. $tpl->SetParam('page_title', 'Register your account!');
  173.  
  174. $tpl->Output();
  175.  
  176. ?>
  177.  
  178.  
  179. Page-Register.tpl :
  180.  
  181.  
  182.  
  183.  
  184. <head>
  185. <title>Zone Hotel : Register</title>
  186. <link rel="stylesheet" type="text/css" href="http://localhost/web-gallery/index/css/960_12_col.css">
  187. <link rel="stylesheet" type="text/css" href="http://localhost/web-gallery/index/css/index.css?1">
  188. </head>
  189. <body>
  190. <div class="container_12" style="margin-top:50px;">
  191. <div style="margin-bottom:20px;">
  192. <div class="grid_4" style="height:1px;">
  193. </div>
  194. <div style="height: 70px;width: 190px;background-image: url('http://localhost/web-gallery/images/v3/logoween.png');float: left;margin-left: -316px;background-repeat: no-repeat;"></div>
  195. <div class="grid_4" style="height:1px;">
  196. </div>
  197. <div class="grid_4">
  198. <div>
  199. <div id="onlinecount" style="float:left;margin-left:140px;">
  200. <div style="font-weight:bold;">%hotel_status%</div>
  201. </div>
  202. </div>
  203. </div>
  204. <div style="clear:both;"></div>
  205. </div>
  206. <div class="grid_12">
  207. </div>
  208. <div class="grid_8" style="position:relative;height:1px;">
  209. <div class="box diabox" style="position:relative;background: url(http://localhost/web-gallery/index/img/promo.png) 50% 83%;border:none;box-shadow:inset 0px 0px 1px rgba(0,0,0,0.5)">
  210. <div class="diainfo">
  211. <h1 style="margin-top: -5px;">Thank you for joining!</h1>
  212. This community is something you never experinced before, there is no drama all good vides and fun!
  213. </div>
  214. </div>
  215. </div>
  216. <div class="grid_4">
  217. <div class="box" style="height:auto;padding:10px;margin-bottom:20px;" id="loginBox">
  218. <div class="title"><b>Create your account</b></div>
  219. <div style="padding:10px;">
  220. <div id="login">
  221. <form method="post" action="submit" id="next">
  222.  
  223. <div class="label">Username</div>
  224. <input type="text" class="textbox" name="bean.avatarName" value="%post-name%">
  225.  
  226. <div class="label" style="margin-top:15px;">Email <i>( Activation required! )</i></div>
  227. <input type="text" class="textbox" name="bean.email" value="%post-mail%">
  228.  
  229. <div class="label" style="margin-top:20px;">Password</div>
  230. <input type="password" class="textbox" name="bean.password" value="%post-pass%">
  231.  
  232. <div class="label" style="margin-top:25px;">Confirm Password</div>
  233. <input type="password" class="textbox" name="bean.retypedPassword" value="">
  234. <br>
  235. <br><br><br>
  236. <div style="width:100%;padding:20px;position:absolute;bottom:0px;left:0px;margin-top:50px;">
  237. <input type="submit" id="registerBtn" class="area" style="width:100%;" value="Register">
  238. </div>
  239. </form>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. <div style="clear:both;"></div>
  245. </div>
  246. </body>
  247. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement