Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('config.php');
- require('functions.php');
- if(IsLogged()){
- header('location: /');
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <!-- Tell the browser to be responsive to screen width -->
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="">
- <meta name="author" content="">
- <!-- Favicon icon -->
- <link rel="icon" type="image/png" sizes="16x16" href="favicon.png">
- <title>Registro - Babilonia Roleplay</title>
- <!-- Bootstrap Core CSS -->
- <link href="css/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
- <!-- Custom CSS -->
- <link href="css/helper.css" rel="stylesheet">
- <link href="css/style.css" rel="stylesheet">
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:** -->
- <!--[if lt IE 9]>
- <script src="https:**oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
- <script src="https:**oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <script src='https://www.google.com/recaptcha/api.js'></script>
- <body class="fix-header fix-sidebar">
- <!-- Preloader - style you can find in spinners.css -->
- <div class="preloader">
- <svg class="circular" viewBox="25 25 50 50">
- <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
- </div>
- <!-- Main wrapper -->
- <div id="main-wrapper">
- <div class="unix-login">
- <div class="container-fluid">
- <div class="row justify-content-center">
- <div class="col-lg-4">
- <div class="login-content card">
- <div class="login-form">
- <h4>Registra tu cuenta</h4>
- <?php
- if(isset($_POST['commit'])){
- $name = mysqli_real_escape_string($con, $_POST['name']);
- $surname = mysqli_real_escape_string($con, $_POST['surname']);
- $username = $name.'_'.$surname;
- $password = mysqli_real_escape_string($con, md5($_POST['password']));
- $password2 = mysqli_real_escape_string($con, md5($_POST['password2']));
- $email = mysqli_real_escape_string($con, $_POST['email']);
- $date = mysqli_real_escape_string($con, $_POST['birthdate']);
- $sex = mysqli_real_escape_string($con, $_POST['sex']);
- $age = age_calculator($date);
- $ip = $_SERVER['REMOTE_ADDR'];
- ///////////////////
- $log1n = "SELECT * FROM usuarios WHERE nombre='$username'";
- $eeee = $con->query($log1n);
- $row_cnt = mysqli_num_rows($eeee);
- ///////////////////
- $ipipipip = "SELECT * FROM usuarios WHERE ip='$ip'";
- $ipipip = $con->query($ipipipip);
- $ipip = mysqli_num_rows($ipipip);
- ///////////////////
- if (!check_date($date)) {
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Fecha invalida.","error");}, 1); </script>';
- $error = 1;
- }
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Email invalido.","error");}, 1); </script>';
- $error = 1;
- }
- if(strlen($_POST['password']) < 8){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "La contraseña debe tener 8 o más caracteres.","error");}, 1); </script>';
- $error = 1;
- }
- if(strlen($username) > 30){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "El nombre de usuario debe tener maximo 30 caracteres.","error");}, 1); </script>';
- $error = 1;
- }
- if(strlen($username) < 10){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "El nombre de usuario debe tener minimo 10 caracteres.","error");}, 1); </script>';
- $error = 1;
- }
- if($ipip >= 1){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Ya existe una cuenta vinculada con tu dirección IP.","error");}, 1); </script>';
- $error = 1;
- }
- if($row_cnt >= 1){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Ya existe una cuenta con ese nombre.","error");}, 1); </script>';
- $error = 1;
- }
- if (!preg_match("/^[a-zA-Z]+$/", $name) OR !preg_match("/^[a-zA-Z]+$/", $surname))
- {
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "El nombre y/o apellido solo pueden contener caracteres validos.","error");}, 1); </script>';
- $error = 1;
- }
- if($password != $password2){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Las contraseñas no coinciden.","error");}, 1); </script>';
- $error = 1;
- }
- if(empty($name) OR empty($surname) OR empty($password) OR empty($password2) OR empty($email)){
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Faltan datos","error");}, 1); </script>';
- $error = 1;
- }
- $recaptcha = $_POST["g-recaptcha-response"];
- $url = 'https://www.google.com/recaptcha/api/siteverify';
- $data = array(
- 'secret' => '6LfTHUQUAAAAABVRPx9FpEsAlyJQDUWVELncjq-7',
- 'response' => $recaptcha
- );
- $options = array(
- 'http' => array (
- 'method' => 'POST',
- 'content' => http_build_query($data)
- )
- );
- $context = stream_context_create($options);
- $verify = file_get_contents($url, false, $context);
- $captcha_success = json_decode($verify);
- if(!$captcha_success->success) {
- $html = '<script type="text/javascript">setTimeout(function () {swal("Oops...", "Demuestra que no eres un robot completando el captcha.","error");}, 1); </script>';
- $error = 1;
- }
- if($error == 1){
- echo $html; // <a onclick="history.back()"><b>Volver atrás</b></a><hr></center>';
- }else{
- if ($con->query("INSERT INTO usuarios (nombre, apodo, clave, ip, email, edad, avatar, sexo) VALUES ('$username', '$username', '$password', '$ip', '$email', '$age', '../images/default-avatar.png', '$sex')") === TRUE) {
- $ch3ck = "SELECT * FROM usuarios WHERE nombre='$username'";
- $checkk = $con->query($ch3ck);
- $check = $checkk->fetch_row();
- $newID = $check[0];
- setcookie('id', $newID, time() + (86400 * 30), "/");
- header("Location: /");
- }
- }
- }
- ?>
- <form method="post">
- <div class="form-group" style="display: inline;">
- <label>Nombre del personaje</label><br>
- <input type="text" name="name" class="form-control" value="" placeholder="Nombre" style="width: 150px; display: inline;"> <input type="text" name="surname" class="form-control" style="width: 153px; display: inline;" value="" placeholder="Apellido">
- </div>
- <div class="form-group" style="margin-top: 10px;">
- <label>Sexo</label> <select name="sex" class="form-control" style="width: 264px; display: inline;">
- <option value="1">Masculino</option>
- <option value="2">Femenino</option>
- </select>
- </div>
- <div class="form-group" style="margin-top: -10px;">
- <label>Dirección de correo electrónico</label>
- <input type="email" name="email" class="form-control" placeholder="correo@dominio.com">
- </div>
- <div class="form-group" style="margin-top: -10px;">
- <label>Contraseña</label><br>
- <input type="password" name="password" class="form-control" value="" placeholder="Clave" style="width: 150px; display: inline;"> <input type="password" name="password2" class="form-control" style="width: 153px; display: inline;" value="" placeholder="Confirmar clave">
- </div>
- <div class="form-group" style="margin-top: -10px;">
- <label>Fecha de nacimiento</label>
- <input type="date" class="form-control" name="birthdate" value="<?php echo date("Y-m-d");?>">
- </div>
- <div class="g-recaptcha" data-sitekey="6LfTHUQUAAAAANpZiHraiGzvKlJKf7CYtK1U0bqB"></div>
- <input type="submit" class="btn btn-primary btn-flat m-b-30 m-t-30" value="Registrarse" name="commit">
- </form>
- <hr style="margin-top: -7px">
- <a href="/login">
- <button class="btn btn-success">
- ¿Ya tienes cuenta? Inicia sesión
- </button>
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- End Wrapper -->
- <!-- All Jquery -->
- <script src="js/lib/jquery/jquery.min.js"></script>
- <!-- Bootstrap tether Core JavaScript -->
- <script src="js/lib/bootstrap/js/popper.min.js"></script>
- <script src="js/lib/bootstrap/js/bootstrap.min.js"></script>
- <!-- slimscrollbar scrollbar JavaScript -->
- <script src="js/jquery.slimscroll.js"></script>
- <!--Menu sidebar -->
- <script src="js/sidebarmenu.js"></script>
- <!--stickey kit -->
- <script src="js/lib/sticky-kit-master/dist/sticky-kit.min.js"></script>
- <!--Custom JavaScript -->
- <script src="js/custom.min.js"></script>
- <link href="/css/lib/sweetalert/sweetalert.css" rel="stylesheet">
- <script src="js/lib/sweetalert/sweetalert.min.js"></script>
- <!-- scripit init -->
- <script src="js/lib/sweetalert/sweetalert.init.js"></script>
- <style>
- body{
- background-image: url("images/background/bg_pcu.jpg");
- background-repeat: no-repeat;
- background-size: 100% 100%;
- }
- </style>
- </body>
- </html>
Add Comment
Please, Sign In to add comment