Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. <?php
  2. require_once('../../data_classes/server-data.php_data_classes-core.php.php');
  3. header('Content-type: application/json');
  4.  
  5. if($_POST)
  6. {
  7. $failure = false;
  8. $registrationErrors = array();
  9.  
  10. // USERNAME
  11.  
  12. if(empty($_POST['registrationBean_username']))
  13. {
  14. $failure = true;
  15. $registrationErrors['registration_username'] = "Escolha o seu nome ".$sitename.".";
  16. }
  17. elseif(!preg_match("/^[A-Z0-9=?!@:.-]{2,15}$/i", $_POST['registrationBean_username']))
  18. {
  19. $failure = true;
  20. $registrationErrors['registration_username'] = "Nome inválido.";
  21. }
  22. elseif(mysql_num_rows(mysql_query("SELECT id FROM users WHERE username = '".HoloText($_POST['registrationBean_username'])."' LIMIT 1")) == 1)
  23. {
  24. $failure = true;
  25. $registrationErrors['registration_username'] = "Este nome já é utilizado por outro usuário.";
  26. }
  27.  
  28. // E-MAIL
  29.  
  30. if(empty($_POST['registrationBean_email']))
  31. {
  32. $failure = true;
  33. $registrationErrors['registration_email'] = "Digite o seu endereço de e-mail.";
  34. }
  35. elseif(!preg_match("/^[A-Z0-9._-]{2,}+@[A-Z0-9._-]{2,}\.[A-Z0-9._-]{2,}$/i", $_POST['registrationBean_email']))
  36. {
  37. $failure = true;
  38. $registrationErrors['registration_email'] = "Por favor, insira um endereço de e-mail válido.";
  39. }
  40.  
  41. // PASSWORT
  42.  
  43. if(empty($_POST['registrationBean_password']))
  44. {
  45. $failure = true;
  46. $registrationErrors['registration_password'] = "Digite a sua senha.";
  47. }
  48. elseif(strlen($_POST['registrationBean_password']) < 6)
  49. {
  50. $failure = true;
  51. $registrationErrors['registration_password'] = "A sua senha deve ter pelo menos 6 caracteres";
  52. }
  53.  
  54. elseif($_POST['registrationBean_password'] != $_POST['registrationBean_password2'])
  55. {
  56. $failure = true;
  57. $registrationErrors['registration_password'] = "As senhas não coincidem.";
  58. }
  59.  
  60. // PASSWORT CHECK
  61.  
  62.  
  63. if(empty($_POST['registrationBean_password2']))
  64. {
  65. $failure = true;
  66. $registrationErrors['registration_password2'] = "Por favor, reescreva a senha.";
  67. }
  68. elseif(strlen($_POST['registrationBean_password2']) < 6)
  69. {
  70. $failure = true;
  71. $registrationErrors['registration_password2'] = "A sua senha deve ter pelo menos 6 caracteres";
  72. }
  73.  
  74. elseif($_POST['registrationBean_password2'] != $_POST['registrationBean_password'])
  75. {
  76. $failure = true;
  77. $registrationErrors['registration_password2'] = "As senhas não coincidem.";
  78. }
  79.  
  80. // AGB
  81.  
  82. //if(!isset($_POST['tos']))
  83. //{
  84. // $failure = true;
  85. // $registrationErrors['registration_termsofservice'] = "Bitte Akzeptiere die AGB!";
  86. // }
  87.  
  88.  
  89.  
  90.  
  91.  
  92. // GEBURTSDATUM
  93.  
  94.  
  95.  
  96. if(empty($_POST['registrationBean_day']) || empty($_POST['registrationBean_month']) || empty($_POST['registrationBean_year']))
  97. {
  98. $failure = true;
  99. $registrationErrors['registration_birthday_format'] = "Escolha uma data de nascimento válida.";
  100. }
  101. elseif(!checkdate(intval($_POST['registrationBean_month']), intval($_POST['registrationBean_day']), intval($_POST['registrationBean_year'])))
  102. {
  103. $failure = true;
  104. $registrationErrors['registration_birthday_format'] = "Escolha uma data de nascimento válida.";
  105. }
  106.  
  107.  
  108.  
  109.  
  110.  
  111. if(!$failure)
  112. {
  113.  
  114. $username = HoloText($_POST['registrationBean_username']);
  115. $email = HoloText($_POST['registrationBean_email']);
  116. $password = HoloText($_POST['registrationBean_password']);
  117. $password2 = HoloText($_POST['registrationBean_password2']);
  118. $tag = HoloText($_POST['registrationBean_day']);
  119. $monat = HoloText($_POST['registrationBean_month']);
  120. $jahr = HoloText($_POST['registrationBean_year']);
  121. $sexe = HoloText($_POST['registrationBean_gender']);
  122. if($sexe == "M") {
  123. $look = $register['look_m'];
  124. } else {
  125. $look = $register['look_f'];
  126. }
  127.  
  128. mysql_query("INSERT INTO users (online,vip_points,vip,username,password,mail,auth_ticket,rank,look,gender,motto,last_online,account_created,ip_last,ip_reg)
  129. VALUES ('0','0','0','".$username."','".HoloHashMD5($password)."','".$email."','','1','hd-180-1.ch-210-66.lg-270-82.sh-290-91.hr-100-','M','I <3 ".$sitename."','".time()."','".time()."','".$remote_ip."','".$remote_ip."')") or die(mysql_error());
  130.  
  131. $_SESSION['username'] = $username;
  132. $_SESSION['password'] = HoloHashMD5($password);
  133.  
  134. $userdata2 = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'");
  135. $userdata = mysql_fetch_assoc($userdata2);
  136. mysql_query("INSERT INTO `user_info` (user_id,reg_timestamp) VALUES ('".$userdata['id']."','".time()."')");
  137. mysql_query("INSERT INTO `user_stats` (id) VALUES ('".$userdata['id']."')");
  138.  
  139. echo json_encode(array("registrationCompletionRedirectUrl" => $path."/me"));
  140. }
  141. elseif(!empty($registrationErrors))
  142. {
  143. $encoded = json_encode(array("registrationErrors" => $registrationErrors, "registrationMessages" => array()));
  144. echo $encoded;
  145. }
  146. }
  147. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement