Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.16 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
  5.  
  6. <title>HPPS :: Registration</title>
  7.  
  8. <link type='text/css' href='CSS/ui-lightness/jquery-ui-1.8.2.custom.css' rel='stylesheet' />
  9. <link type='text/css' href='CSS/register.css' rel='stylesheet' />
  10.  
  11. <script type='text/javascript' src='JS/MD5.js'></script>
  12. <script type='text/javascript' src='JS/jquery-1.4.2.min.js'></script>
  13.  
  14. <script type='text/javascript' src='JS/jquery-ui-1.8.2.custom.min.js'></script>
  15.  
  16. <script type='text/javascript'>
  17.  
  18. function LTrim(value) {
  19. var re = /\s*((\S+\s*)*)/;
  20. return value.replace(re, "$1");
  21. }
  22.  
  23. function RTrim(value) {
  24. var re = /((\s*\S+)*)\s*/;
  25. return value.replace(re, "$1");
  26. }
  27.  
  28. function trim(value) {
  29. return LTrim(RTrim(value));
  30. }
  31.  
  32. var moderatorTimer = 0;
  33. var isLoggedIn = false;
  34. var suggestValues = {
  35. playerName: 'Playername',
  36. passwordA: '',
  37. passwordB: '',
  38. emailAddress: 'EMail@Address.com',
  39. recommended: 'Who told you about this?'
  40. };
  41.  
  42. var states = {
  43. noticePasswords: 0,
  44. noticePlayerName: 0,
  45. noticeEMail: 0
  46. };
  47.  
  48. function updateStatus(classString, messageString) {
  49. $('#statusBar').removeClass('ui-state-error');
  50. $('#statusBar').removeClass('ui-state-highlight');
  51. $('#statusBar').addClass(classString);
  52.  
  53. var iconString = classString == 'ui-state-error' ? 'ui-icon-alert' : 'ui-icon-info';
  54. $('#statusBar').html('<p><span class="ui-icon ' + iconString + '" style="float: left; margin-right: .3em;"></span>' + messageString + '</p>');
  55. }
  56.  
  57. function showLoader(message) {
  58. $('#content').html('<div align=\'center\'><img src=\'Images/Loader.gif\' /><br />' + message + '</div>');
  59. }
  60.  
  61. function loadContent(url, container) {
  62. url = url.split('?');
  63. data = url[1];
  64. url = url[0];
  65. $.ajax({
  66. url: url,
  67. data: data,
  68. success: function(data) {
  69. $(container).html(data);
  70. }
  71. });
  72. }
  73.  
  74. function updateNotice(fieldID, fieldData, fieldMessage) {
  75. states[fieldID] = Number(fieldData == 'fieldNoticeFail');
  76. fieldID = '#' + fieldID;
  77.  
  78. $(fieldID).removeClass('fieldNoticeOkay');
  79. $(fieldID).removeClass('fieldNoticeFail');
  80.  
  81. $(fieldID).addClass(fieldData);
  82.  
  83. $(fieldID).html(fieldMessage);
  84. }
  85.  
  86. $(function() {
  87. $('#playerName, #recommended').keyup(function() {
  88. var playerName = this.value;
  89. var noticeID = this.id == 'playerName' ? 'noticePlayerName' : 'noticeEMail';
  90.  
  91. if(playerName.length == 0)
  92. if(this.id == 'recommended') return updateNotice(noticeID, 'fieldNoticeOkay', 'You don\'t have to edit that Field, but it\'s recommended!');
  93. else return updateNotice(noticeID, 'fieldNoticeFail', 'Please enter a Username!');
  94.  
  95. if(playerName.length < 3) return updateNotice(noticeID, 'fieldNoticeFail', 'The PlayerName is too short! 3 Chars at Minimum!');
  96. if(playerName.length > 12) return updateNotice(noticeID, 'fieldNoticeFail', 'The PlayerName is too long! 12 Chars at Maximum!');
  97.  
  98. var count = 0;
  99. for(var i = 0; i < playerName.length; ++i) if((chr = playerName.charCodeAt(i)) && (chr > 64 && chr < 91 || chr > 96 && chr < 123)) ++count;
  100. if(!count) return updateNotice(noticeID, 'fieldNoticeFail', 'The PlayerName has to contain atleast one letter!');
  101.  
  102. return updateNotice(noticeID, 'fieldNoticeOkay', 'The PlayerName is okay :)');
  103. }).trigger('keyup').blur(function() {
  104. if(states.noticePlayerName) return;
  105. $.ajax({
  106. url: 'checkName.php',
  107. data: 'username=' + this.value,
  108. success: function(data) {
  109. if(data == 'true') return updateNotice('noticePlayerName', 'fieldNoticeFail', 'Sorry, that PlayerName is already taken!');
  110. if(data == 'fail') return updateNotice('noticePlayerName', 'fieldNoticeFail', 'Sorry, we have no Database Connection currently!');
  111. if(data == 'false') return updateNotice('noticePlayerName', 'fieldNoticeOkay', 'The PlayerName is okay and not taken yet :)');
  112. alert(
  113. ['Debug TraceBack',
  114. ' at HPPS',
  115. ' at Register.php',
  116. ' at AJAX.success Callback',
  117. ' called with Parameter',
  118. ' #0: [' + typeof(data) + '] ' + data,
  119. ' at checkName.php?username=...',
  120. '',
  121. ''].join("\n"));
  122. return updateNotice('noticePlayerName', 'fieldNoticeFail', 'Something is wrong!');
  123. }
  124. });
  125. });
  126. $('#passwordA, #passwordB').keyup(function() {
  127.  
  128. this.value = trim(this.value);
  129. if(this.value.length == 0)
  130. if(this.id == 'passwordB' && $('#passwordA').val().length != 0) return updateNotice('noticePasswords', 'fieldNoticeFail', 'You have to repeat the Password!');
  131. else return updateNotice('noticePasswords', 'fieldNoticeFail', 'You have to enter a Password!');
  132.  
  133. if(this.id == 'passwordB' && $('#passwordA').val() != $('#passwordB').val())
  134. return updateNotice('noticePasswords', 'fieldNoticeFail', 'The Passwords don\'t match!');
  135.  
  136. if(this.value.length < 6) return updateNotice('noticePasswords', 'fieldNoticeFail', 'The Password is too short! 6 Chars at Minimum!');
  137. if(this.value.length > 32) return updateNotice('noticePasswords', 'fieldNoticeFail', 'The Password is too long! 32 Chars at Maximum!');
  138.  
  139. if($('#passwordB').val().length == 0) return updateNotice('noticePasswords', 'fieldNoticeFail', 'You have to repeat the Password!');
  140. if(this.id == 'passwordA' && $('#passwordA').val() != $('#passwordB').val())
  141. return updateNotice('noticePasswords', 'fieldNoticeFail', 'The Passwords don\'t match!');
  142.  
  143. return updateNotice('noticePasswords', 'fieldNoticeOkay', 'The Passwords are okay :)');
  144. }).trigger('keyup');
  145. $('#emailAddress').keyup(function() {
  146. this.value = trim(this.value);
  147.  
  148. var email = this.value;
  149.  
  150. if(email.length < 6) return updateNotice('noticeEMail', 'fieldNoticeFail', 'The EMail Address is too short! 6 Chars at Minimum!');
  151. if(email.length > 128) return updateNotice('noticeEMail', 'fieldNoticeFail', 'The EMail Address is too long! 128 Chars at Maximum!');
  152.  
  153. if(email.split('@').length != 2) return updateNotice('noticeEMail', 'fieldNoticeFail', 'The EMail Address is invalid! It has to contain exactly <b>one</b> @!');
  154. if(email.split('@')[1].split('.').length < 2) return updateNotice('noticeEMail', 'fieldNoticeFail', 'The EMail Address is invalid! The Domain is wrong!');
  155.  
  156. var emailName = email.split('@')[0];
  157. var emailDomain = email.split('@')[1].split('.');
  158. var emailTLD = emailDomain.pop();
  159. emailDomain = emailDomain.join('.');
  160.  
  161. if(emailName.length < 1) return updateNotice('noticeEMail', 'fieldNoticeFail', 'You have to specify a Username in the EMail Address!');
  162. if(emailDomain.length < 1) return updateNotice('noticeEMail', 'fieldNoticeFail', 'You have to specify a Domain in the EMail Address!');
  163. if(emailTLD.length < 2) return updateNotice('noticeEMail', 'fieldNoticeFail', 'You have to specify a valid TLD in the EMail Address!');
  164.  
  165. return updateNotice('noticeEMail', 'fieldNoticeOkay', 'The EMail is okay :)');
  166. }).trigger('keyup');
  167. $('document').ready(function() {
  168. updateStatus('ui-state-highlight', '<strong>Welcome!</strong> To Register for HPPS click the "Register" Button!');
  169.  
  170. for(var i in suggestValues) $('#' + i).addClass('suggestBox');
  171. $('.suggestBox').focus(function() {
  172. if(this.value == suggestValues[this.id]) this.value = '';
  173. this.style.color = '#000000';
  174. });
  175. $('.suggestBox').blur(function() {
  176. if(this.value == '') this.value = suggestValues[this.id];
  177. if(this.value == suggestValues[this.id]) this.style.color = '#DADADA';
  178. });
  179. $('.suggestBox').trigger('blur');
  180. });
  181. $('#registerBox').dialog({
  182. modal: true,
  183. autoOpen: false,
  184. width: 320,
  185. beforeclose: function() { updateStatus('ui-state-highlight', '<strong>Welcome!</strong> Registration aborted!'); },
  186. buttons: {
  187. 'Submit': function() {
  188. var sum = 0;
  189. for(var i in states) sum += states[i];
  190.  
  191. if(sum) {
  192. var s = sum == 1 ? '' : 's';
  193. var is = sum == 1 ? 'is' : 'are';
  194. var error = 'There ' + is + ' still ' + sum + ' Mistake' + s + ' in the Regristration Form!';
  195.  
  196. return (updateStatus('ui-state-error', '<strong>Regristration failed:</strong> ' + error) | alert(error)) && false;
  197. } else {
  198. $(this).dialog('close');
  199. $(this).dialog('close');
  200. updateStatus('ui-state-highlight', '<strong>Status:</strong> Sending Regristration...');
  201. loadContent('register.php?' +
  202. 'username=' + $('#playerName').val() +
  203. '&password=' + $('#passwordA').val() +
  204. '&email=' + $('#emailAddress').val() +
  205. '&color=' + $('#color').val(), '#content');
  206. }
  207. },
  208. 'Cancel': function() {
  209. $(this).dialog('close');
  210. }
  211. }
  212. });
  213. $('#registerLink').click(function() {
  214. $('#registerBox').dialog('open');
  215. return false;
  216. });
  217. $('#registerLink, ul#icons li').hover(
  218. function() { $(this).addClass('ui-state-hover'); },
  219. function() { $(this).removeClass('ui-state-hover'); }
  220. );
  221. });
  222.  
  223. </script>
  224.  
  225. <body>
  226. <div class='ui-widget'><div id='statusBar' class='ui-corner-all'></div></div>
  227. <div align='right'><a href='#' id='registerLink' class='ui-state-default ui-corner-all'><span class='ui-icon ui-icon-newwin'></span>Register</a></div>
  228. <div id='registerBox' title='Register for HPPS'>
  229. <div id='noticePlayerName' class='fieldNotice'></div>
  230. <input type='text' id='playerName' maxlength='12' /><br />
  231. <div id='noticePasswords' class='fieldNotice'></div>
  232. <input type='password' id='passwordA' maxlength='32' /><br />
  233. <input type='password' id='passwordB' maxlength='32' /><br />
  234. <div id='noticeEMail' class='fieldNotice'></div>
  235. <input type='text' id='emailAddress' maxlength='128' /><br />
  236. <input type='text' id='recommended' maxlength='12' /><br />
  237. <div class='fieldNotice'>If you don't pick a Color, we will surprise you by picking one randomly!</div>
  238. <select id='color'>
  239. <option value='0'>Pick a Color</option>
  240. <option value='1'>Blue</option>
  241. <option value='2'>Green</option>
  242. <option value='3'>Pink</option>
  243. <option value='4'>Black</option>
  244. <option value='5'>Red</option>
  245. <option value='6'>Orange</option>
  246. <option value='7'>Yellow</option>
  247. <option value='8'>Dark Purple</option>
  248. <option value='9'>Brown</option>
  249. <option value='10'>Peach</option>
  250. <option value='11'>Dark Green</option>
  251. <option value='12'>Light Blue</option>
  252. <option value='13'>Lime Green</option>
  253. <option value='15'>Aqua</option>
  254. </select>
  255. </div>
  256. <div id='content' class='ui-corner-all'>
  257. Registration page!
  258. <br>
  259. <br><br><br>
  260.  
  261. </div>
  262. </body>
  263. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement