Advertisement
Guest User

Untitled

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