Advertisement
Guest User

Untitled

a guest
Nov 21st, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.17 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="favicon-16.png" sizes="16x16">
  5. <link rel="icon" href="favicon-32.png" sizes="32x32">
  6. <meta charset="UTF-8">
  7. <title>Knautiluz</title>
  8. <meta name="description" content="Crie sua conta, cadastre-se e jogue gratuitamente! Free to play, play to win!" />
  9. </head>
  10. <body>
  11. <link href="css/index.css" rel="stylesheet">
  12. <script src="js/jquery.js"></script>
  13. <script src="js/jquery-ajax.js"></script>
  14. <script src="js/general.js"></script>
  15. <div id="game-title">Trabson</div>
  16. <div id="currency">Free to play, pay to win</div>
  17. <menu id="main"></menu>
  18. </body>
  19. </html>
  20.  
  21. $(document).ready(function() {
  22. //inicio
  23. $('#main').load('content/login.php');
  24. });
  25.  
  26. <script src="js/general.js"></script>
  27.  
  28. <?php
  29. require ("includes/connection.php");
  30. require ("includes/start-session.php");
  31. require ("includes/encript.php");
  32. ?>
  33. <!DOCTYPE html>
  34. <html>
  35. <head>
  36. </head>
  37. <body>
  38. <script src='https://www.google.com/recaptcha/api.js'></script>
  39. <div id="login-screen">
  40. <img src="/css/img/login_img.png" id="login-img"><img/>
  41. <img src="/css/img/password_img.png" id="password-img"><img/>
  42. <img src="/css/img/captcha_img.png" id="captcha-img"><img/>
  43. <form name="loginx" action="" method="post">
  44. <input type="email" required placeholder="LOGIN/USUÁRIO" name="rlogin" id="rlogin" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$">
  45. <input type="password" required placeholder="SENHA" name="rpass" id="rpass" pattern="(?=.*d)(?=.*[a-z])(?=.*[A-Z]).{6,}" title="Precisa ter pelo menos uma letra maiúscula uma letra minúscula, um numero e 6 ou mais caracteres">
  46. </form>
  47. </div>
  48. <div id="register-field">
  49. <span id="register-title">CRIE SUA CONTA</span>
  50. <form name="formulario" id="formulario" action="" method="post" enctype="multipart/form-data">
  51. <div id="login-field">LOGIN</div>
  52. <input type="text" required placeholder="LOGIN" name="login" id="login" pattern="[A-z]{3,}" maxlength="12">
  53. <div id="password-field">SENHA</div>
  54. <input type="password" required placeholder="SENHA" name="password" id="password" pattern="(?=.*d)(?=.*[a-z])(?=.*[A-Z]).{6,}" title="Precisa ter pelo menos uma letra maiúscula uma letra minúscula, um numero e 6 ou mais caracteres">
  55. <div id="cpassword-field">CONFIRMAR SENHA</div>
  56. <input type="password" required placeholder="CONFIRMAR SENHA" name="cpassword" id="cpassword" pattern="(?=.*d)(?=.*[a-z])(?=.*[A-Z]).{6,}" title="Precisa ter pelo menos uma letra maiúscula uma letra minúscula, um numero e 6 ou mais caracteres">
  57. <div id="email-field">E-MAIL</div>
  58. <input type="email" required placeholder="E-MAIL" name="email" id="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$" title="Isto não é um formato de e-mail correto, verifique!"></input>
  59. <div id="cemail-field">CONFIRMAR E-MAIL</div>
  60. <input type="email" required placeholder="CONFIRMAR E-MAIL" name="cemail" id="cemail" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$" title="Isto não é um formato de e-mail correto, verifique!"></input>
  61. <div class="g-recaptcha" data-sitekey="6LeSEBwTAAAAAOD2kcTBvz8401DSvI5RTbtG79xK"></div>
  62. <input type="checkbox" id="checkbox" name="checkbox" value="5" /><div id="checkBoxText">Leia e aceite nossos&nbsp;<a href="documentos/termos de uso.pdf">termos de uso</a> para continuar!</div></input>
  63. <input type="hidden" name="botao" value="botao">
  64. <input type="image"id="buttonSubmit" value="cadastrar" src="/css/img/register_img.png" style="width:283px;height:79px"/>
  65. </form>
  66. </div>
  67. <div id="news-updates">
  68. <span id="news-title">NOTÍCIAS E ATUALIZAÇÕES</span>
  69. </div>
  70. </body>
  71. </html>
  72. <?php
  73. //RECUPERA INFORMAÇÕES AO ENVIAR OS DADOS.
  74. if(isset($_POST["botao"])) {
  75. $username = mysqli_real_escape_string($mysqli, $_POST["login"]);
  76. $password = mysqli_real_escape_string($mysqli, $_POST["password"]);
  77. $cpassword = mysqli_real_escape_string($mysqli, $_POST["cpassword"]);
  78. $email = mysqli_real_escape_string($mysqli, $_POST["email"]);
  79. $cemail = mysqli_real_escape_string($mysqli, $_POST["cemail"]);
  80. $picture = mysqli_real_escape_string($mysqli, $_POST["foto"]);
  81. $valid = mysqli_real_escape_string($mysqli, $_POST["valid"]);
  82. if($password != $cpassword) {
  83. echo "<script> alert('As senhas não conferem.'); </script>";
  84. return true;
  85. }
  86. if($username == "") {
  87. echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
  88. return true;
  89. }
  90. if($email == "") {
  91. echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
  92. return true;
  93. }
  94. if($cemail == "") {
  95. echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
  96. return true;
  97. }
  98. if($password == "") {
  99. echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
  100. return true;
  101. }
  102. if($cpassword == "") {
  103. echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
  104. return true;
  105. }
  106. // FAZ A BUSCA NO BDD PRA VER SE O EMAIL JA EXISTE
  107. $select = $mysqli->query("SELECT * FROM data WHERE email='$email'");
  108. if(select) {
  109. $row = $select->num_rows;
  110. if ($row > 0) {
  111. echo "<div id="emailExiste">E-MAIL EM USO!</div>";
  112. } else {
  113. // FAZ A BUSCA NO BDD PRA VER SE O USUARIO JA EXISTE
  114. $select = $mysqli->query("SELECT * FROM data WHERE username='$username'");
  115. if(select) {
  116. $row = $select->num_rows;
  117. if ($row > 0) {
  118. echo "<div id="usuarioExiste">NOME DE USUÁRIO JÁ EXISTE!</div>";
  119. } else {
  120. // Se o CHECKBOX foi marcado ele continua o procedimento:
  121. if (isset($_POST['checkbox'])) {
  122. // AQUI COMEÇA A VALIDAÇÃO DO reCAPTCHA
  123. if (isset($_POST['g-recaptcha-response'])) {
  124. $captcha_data = $_POST['g-recaptcha-response'];
  125. }
  126.  
  127. // Se nenhum valor foi recebido, o usuário não realizou o captcha
  128. if (!$captcha_data) {
  129. echo "<div id="recaptchaUndone">COMPLETE O RECAPTCHA!</div>";
  130. return true;
  131. }
  132. $resposta = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LeSEBwTAAAAAFtLThduvZTdMpE6Bdm19CMrCil_&response=".$captcha_data."&remoteip=".$_SERVER['REMOTE_ADDR']);
  133. if ($resposta.success) {
  134. // CASO TUDO ESTIVER OK ELE INSERE AS INFORMAÇÕES NO BDD
  135. // Recupera os dados dos campos
  136. $foto = $_FILES["foto"];
  137. $nopic = $_POST["nofoto"];
  138. // Se a foto estiver sido selecionada
  139. if (!empty($foto["name"])) {
  140.  
  141. // Largura máxima em pixels
  142. $largura = 2048;
  143. // Altura máxima em pixels
  144. $altura = 2048;
  145. // Tamanho máximo do arquivo em bytes
  146. $tamanho = 500000;
  147. // Verifica se o arquivo é uma imagem
  148. if(!preg_match("/^image/(pjpeg|jpeg|png|gif|bmp)$/", $foto["type"])){
  149. $error[1] = "";
  150. echo "<script> alert('Isso não é uma imagem!');</script>";
  151. return true;
  152. }
  153. // Pega as dimensões da imagem
  154. $dimensoes = getimagesize($foto["tmp_name"]);
  155. // Verifica se a largura da imagem é maior que a largura permitida
  156. if($dimensoes[0] > $largura) {
  157. $error[2] = "";
  158. echo "<script> alert('Largura da imagem superior ao permitido.');</script>";
  159.  
  160. return true;
  161. }
  162. // Verifica se a altura da imagem é maior que a altura permitida
  163. if($dimensoes[1] > $altura) {
  164. $error[3] = "";
  165. echo "<script> alert('Altura da imagem superior ao permitido.');</script>";
  166. return true;
  167. }
  168. // Verifica se o tamanho da imagem é maior que o tamanho permitido
  169. if($foto["size"] > $tamanho) {
  170. $error[4] = "";
  171. echo "<script> alert('Essa imagem é pesada demais para uma imagem de 120x120px, tamanho máx de 500KB');</script>";
  172. return true;
  173. }
  174. // Se não houver nenhum erro
  175. if (count($error) == 0) {
  176.  
  177. // Pega extensão da imagem
  178. preg_match("/.(gif|bmp|png|jpg|jpeg){1}$/i", $foto["name"], $ext);
  179. // Gera um nome único para a imagem
  180. $nome_imagem = md5(uniqid(time())) . "." . $ext[1];
  181. // Caminho de onde ficará a imagem
  182. $pathName = "/home/u756477073/public_html/fotos/" . $username;
  183.  
  184. if(!file_exists($pathName )){
  185. mkdir($pathName); //aqui ele irá criar a pasta
  186. } else {
  187. $pathName .= time(); //concatena a pasta para gerar com um nome diferente
  188. mkdir($pathName); //aqui ele irá criar a pasta
  189. }
  190. $caminho_imagem = "fotos/$username/" . $nome_imagem;
  191. // Faz o upload da imagem para seu respectivo caminho
  192. move_uploaded_file($foto["tmp_name"], $caminho_imagem);}} else {
  193. // o que acontece se não selecionar uma imagem.
  194. }
  195. //acaba envio da foto
  196.  
  197. $valid = md5(uniqid(rand(), true));
  198. $uid = md5(uniqid(time()));
  199. $ip = $_SERVER["REMOTE_ADDR"];
  200. $insert = $mysqli->query("INSERT INTO `data`(`username`, `email`, `password`, `valid`, `status`, `ip`, `pic`, `life`, `maxlife`, `mana`, `maxmana`, `str`, `def`, `intel`, `agl`, `dex`, `luck`, `points`, `gold`, `exp`, `maxexp`, `level`, `battlepower`, `guild`, `class`, `energy`, `maxenergy`) VALUES ('$username', '$email', '".md5($password)."', '$valid', '3', '$ip', '".$nome_imagem."', '100', '100', '100', '100', '5', '5', '5', '5', '5', '5', '30', '50000', '0', '99999999', '1', '95', 'NÃO TEM GUILDA', 'INICIANTE', '120', '120')");
  201. // Se os dados forem inseridos com sucesso
  202. if($insert) {
  203. //ENVIO DO E-MAIL DE ATIVAÇÃO
  204. require("includes/activation-email.php");
  205. //FIM DO ENVIO DO E-MAIL
  206. } else {
  207. echo "<script> alert('ERRO FATAL! O cadastro não foi criado por causa do erro: 055::user-database! Contatar o administrador através de knautiluz@gmail.com'); </script>";
  208. }
  209. // CASO CONTRÁRIO:
  210. } else {
  211. echo "<script> alert('Possivel BOT detectado. Todos os dados inseridos foram deletados.'); </script>";
  212. exit;
  213. }}else {
  214. echo "<div id="termosUso">LEIA E ACEITE OS TERMOS!</div>";
  215. }
  216. }
  217. }}
  218. }}
  219. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement