Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="icon" href="favicon-16.png" sizes="16x16">
- <link rel="icon" href="favicon-32.png" sizes="32x32">
- <meta charset="UTF-8">
- <title>Knautiluz</title>
- <meta name="description" content="Crie sua conta, cadastre-se e jogue gratuitamente! Free to play, play to win!" />
- </head>
- <body>
- <link href="css/index.css" rel="stylesheet">
- <script src="js/jquery.js"></script>
- <script src="js/jquery-ajax.js"></script>
- <script src="js/general.js"></script>
- <div id="game-title">Trabson</div>
- <div id="currency">Free to play, pay to win</div>
- <menu id="main"></menu>
- </body>
- </html>
- $(document).ready(function() {
- //inicio
- $('#main').load('content/login.php');
- });
- <script src="js/general.js"></script>
- <?php
- require ("includes/connection.php");
- require ("includes/start-session.php");
- require ("includes/encript.php");
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <script src='https://www.google.com/recaptcha/api.js'></script>
- <div id="login-screen">
- <img src="/css/img/login_img.png" id="login-img"><img/>
- <img src="/css/img/password_img.png" id="password-img"><img/>
- <img src="/css/img/captcha_img.png" id="captcha-img"><img/>
- <form name="loginx" action="" method="post">
- <input type="email" required placeholder="LOGIN/USUÁRIO" name="rlogin" id="rlogin" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$">
- <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">
- </form>
- </div>
- <div id="register-field">
- <span id="register-title">CRIE SUA CONTA</span>
- <form name="formulario" id="formulario" action="" method="post" enctype="multipart/form-data">
- <div id="login-field">LOGIN</div>
- <input type="text" required placeholder="LOGIN" name="login" id="login" pattern="[A-z]{3,}" maxlength="12">
- <div id="password-field">SENHA</div>
- <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">
- <div id="cpassword-field">CONFIRMAR SENHA</div>
- <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">
- <div id="email-field">E-MAIL</div>
- <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>
- <div id="cemail-field">CONFIRMAR E-MAIL</div>
- <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>
- <div class="g-recaptcha" data-sitekey="6LeSEBwTAAAAAOD2kcTBvz8401DSvI5RTbtG79xK"></div>
- <input type="checkbox" id="checkbox" name="checkbox" value="5" /><div id="checkBoxText">Leia e aceite nossos <a href="documentos/termos de uso.pdf">termos de uso</a> para continuar!</div></input>
- <input type="hidden" name="botao" value="botao">
- <input type="image"id="buttonSubmit" value="cadastrar" src="/css/img/register_img.png" style="width:283px;height:79px"/>
- </form>
- </div>
- <div id="news-updates">
- <span id="news-title">NOTÍCIAS E ATUALIZAÇÕES</span>
- </div>
- </body>
- </html>
- <?php
- //RECUPERA INFORMAÇÕES AO ENVIAR OS DADOS.
- if(isset($_POST["botao"])) {
- $username = mysqli_real_escape_string($mysqli, $_POST["login"]);
- $password = mysqli_real_escape_string($mysqli, $_POST["password"]);
- $cpassword = mysqli_real_escape_string($mysqli, $_POST["cpassword"]);
- $email = mysqli_real_escape_string($mysqli, $_POST["email"]);
- $cemail = mysqli_real_escape_string($mysqli, $_POST["cemail"]);
- $picture = mysqli_real_escape_string($mysqli, $_POST["foto"]);
- $valid = mysqli_real_escape_string($mysqli, $_POST["valid"]);
- if($password != $cpassword) {
- echo "<script> alert('As senhas não conferem.'); </script>";
- return true;
- }
- if($username == "") {
- echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
- return true;
- }
- if($email == "") {
- echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
- return true;
- }
- if($cemail == "") {
- echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
- return true;
- }
- if($password == "") {
- echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
- return true;
- }
- if($cpassword == "") {
- echo "<script> alert('Este campo é obrigatório, por favor não altere o código da página.'); </script>";
- return true;
- }
- // FAZ A BUSCA NO BDD PRA VER SE O EMAIL JA EXISTE
- $select = $mysqli->query("SELECT * FROM data WHERE email='$email'");
- if(select) {
- $row = $select->num_rows;
- if ($row > 0) {
- echo "<div id="emailExiste">E-MAIL EM USO!</div>";
- } else {
- // FAZ A BUSCA NO BDD PRA VER SE O USUARIO JA EXISTE
- $select = $mysqli->query("SELECT * FROM data WHERE username='$username'");
- if(select) {
- $row = $select->num_rows;
- if ($row > 0) {
- echo "<div id="usuarioExiste">NOME DE USUÁRIO JÁ EXISTE!</div>";
- } else {
- // Se o CHECKBOX foi marcado ele continua o procedimento:
- if (isset($_POST['checkbox'])) {
- // AQUI COMEÇA A VALIDAÇÃO DO reCAPTCHA
- if (isset($_POST['g-recaptcha-response'])) {
- $captcha_data = $_POST['g-recaptcha-response'];
- }
- // Se nenhum valor foi recebido, o usuário não realizou o captcha
- if (!$captcha_data) {
- echo "<div id="recaptchaUndone">COMPLETE O RECAPTCHA!</div>";
- return true;
- }
- $resposta = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LeSEBwTAAAAAFtLThduvZTdMpE6Bdm19CMrCil_&response=".$captcha_data."&remoteip=".$_SERVER['REMOTE_ADDR']);
- if ($resposta.success) {
- // CASO TUDO ESTIVER OK ELE INSERE AS INFORMAÇÕES NO BDD
- // Recupera os dados dos campos
- $foto = $_FILES["foto"];
- $nopic = $_POST["nofoto"];
- // Se a foto estiver sido selecionada
- if (!empty($foto["name"])) {
- // Largura máxima em pixels
- $largura = 2048;
- // Altura máxima em pixels
- $altura = 2048;
- // Tamanho máximo do arquivo em bytes
- $tamanho = 500000;
- // Verifica se o arquivo é uma imagem
- if(!preg_match("/^image/(pjpeg|jpeg|png|gif|bmp)$/", $foto["type"])){
- $error[1] = "";
- echo "<script> alert('Isso não é uma imagem!');</script>";
- return true;
- }
- // Pega as dimensões da imagem
- $dimensoes = getimagesize($foto["tmp_name"]);
- // Verifica se a largura da imagem é maior que a largura permitida
- if($dimensoes[0] > $largura) {
- $error[2] = "";
- echo "<script> alert('Largura da imagem superior ao permitido.');</script>";
- return true;
- }
- // Verifica se a altura da imagem é maior que a altura permitida
- if($dimensoes[1] > $altura) {
- $error[3] = "";
- echo "<script> alert('Altura da imagem superior ao permitido.');</script>";
- return true;
- }
- // Verifica se o tamanho da imagem é maior que o tamanho permitido
- if($foto["size"] > $tamanho) {
- $error[4] = "";
- echo "<script> alert('Essa imagem é pesada demais para uma imagem de 120x120px, tamanho máx de 500KB');</script>";
- return true;
- }
- // Se não houver nenhum erro
- if (count($error) == 0) {
- // Pega extensão da imagem
- preg_match("/.(gif|bmp|png|jpg|jpeg){1}$/i", $foto["name"], $ext);
- // Gera um nome único para a imagem
- $nome_imagem = md5(uniqid(time())) . "." . $ext[1];
- // Caminho de onde ficará a imagem
- $pathName = "/home/u756477073/public_html/fotos/" . $username;
- if(!file_exists($pathName )){
- mkdir($pathName); //aqui ele irá criar a pasta
- } else {
- $pathName .= time(); //concatena a pasta para gerar com um nome diferente
- mkdir($pathName); //aqui ele irá criar a pasta
- }
- $caminho_imagem = "fotos/$username/" . $nome_imagem;
- // Faz o upload da imagem para seu respectivo caminho
- move_uploaded_file($foto["tmp_name"], $caminho_imagem);}} else {
- // o que acontece se não selecionar uma imagem.
- }
- //acaba envio da foto
- $valid = md5(uniqid(rand(), true));
- $uid = md5(uniqid(time()));
- $ip = $_SERVER["REMOTE_ADDR"];
- $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')");
- // Se os dados forem inseridos com sucesso
- if($insert) {
- //ENVIO DO E-MAIL DE ATIVAÇÃO
- require("includes/activation-email.php");
- //FIM DO ENVIO DO E-MAIL
- } else {
- 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>";
- }
- // CASO CONTRÁRIO:
- } else {
- echo "<script> alert('Possivel BOT detectado. Todos os dados inseridos foram deletados.'); </script>";
- exit;
- }}else {
- echo "<div id="termosUso">LEIA E ACEITE OS TERMOS!</div>";
- }
- }
- }}
- }}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement