Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.64 KB | None | 0 0
  1. <?PHP
  2.     include('config.php');
  3. ?>
  4. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  5.     "http://www.w3.org/TR/html4/loose.dtd">
  6. <html>
  7. <head>
  8.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  9.     <meta charset="utf-8">
  10.     <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
  11.     <meta name="description" content="MMORPG Metin2">
  12.     <meta name="viewport" content="width=device-width">
  13.  
  14.     <title>FondryMT2 - Oriental Action MMORPG</title>
  15.     <link rel="stylesheet" href="style.css">
  16. </head>
  17. <body>
  18. <div id="registerForm">
  19.     <h1>ENTRA NO MUNDO DO METIN2</h1>
  20.     <p>Regista-te já e junta-te ao jogo gratuitamente!</p>
  21.     <form action="index.php" method="post">
  22. <?PHP
  23.     /*PHP BY OWSAP*/
  24.     if(isset($_POST['submit'])) {
  25.         $real_name = $_POST['real_name'];
  26.         $username = $_POST['username'];
  27.         $email = $_POST['email'];
  28.         $password = $_POST['password'];
  29.         $password2 = $_POST['password2'];
  30.         $social_id = $_POST['social_id'];
  31.        
  32.         if(empty($real_name) || empty($username) || empty($email) ||
  33.             empty($password) || empty($password2) || empty($social_id)) {
  34.             echo '<font color="red">Por favor preenche todos os campos corretamente.</font><hr></br>';
  35.         }
  36.         //elseif(!preg_match("/^[a-zA-Z\s,.'-\pL]+$/u", $real_name)) {
  37.         elseif(!preg_match("/^([ \x{00C0}-\x{01FF}a-zA-Z\'\-])+$/u", $real_name)) {
  38.             echo '<font color="red">Por favor insere um nome válido.</font><hr></br>';
  39.         }
  40.         elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  41.             echo '<font color="red">Por favor insere um e-mail válido.</font><hr></br>';
  42.         }
  43.         elseif($password != $password2) {
  44.             echo '<font color="red">A palavra-passe não é igual à que repetiste.</font><hr></br>';
  45.         }
  46.         else {
  47.             $existing_user = "SELECT login FROM account WHERE login = '".$username."'";
  48.             $existing_email = "SELECT email FROM account WHERE email = '".$email."'";
  49.             $check_user = mysqli_query($connection, $existing_user);
  50.             $check_email = mysqli_query($connection, $existing_email);
  51.             if(mysqli_num_rows($check_user) != 0) {
  52.                 echo '<font color="red">Este utilizador já está registado.</font><hr></br>';
  53.             }
  54.             elseif(mysqli_num_rows($check_email) != 0) {
  55.                 echo '<font color="red">Este e-mail já está registado.</font><hr></br>';
  56.             }
  57.             elseif(strlen($real_name) > 30 || strlen($real_name) < 3 ||
  58.                 strlen($username) > 16 || strlen($username) < 5 ||
  59.                 strlen($password) > 16 || strlen($password) < 5 ||
  60.                 strlen($email) > 40 ||
  61.                 strlen($social_id) != 7) {
  62.                 echo '<font color="red">Por favor verifique novamente o requisitos para cada campo.</font><hr></br>';
  63.             }
  64.             else {
  65.                 $connection->query("SET NAMES utf8");
  66.                 //$sql = "INSERT INTO account SET login = '".$username."', password = PASSWORD('".$password."'), social_id = '".$social_id."', real_name = '".$real_name."', email = '".$email."'";
  67.                 $sql = "INSERT INTO account (login, password, social_id, real_name, email) VALUES ('".$username."', PASSWORD('".$password."'), '".$social_id."', '".$real_name."', '".$email."')";
  68.                 $result = mysqli_query($connection, $sql);
  69.                 if($result) {
  70.                     echo '<font color="green">O teu registo foi efectuado com sucesso.</font><hr></br>';
  71.                 }
  72.                 else {
  73.                     echo '<font color="red">Houve um erro ao registar. Por favor tenta mais tarde ou contacte com a administração.</font><hr></br>';
  74.                 }                  
  75.             }
  76.         }
  77.     }
  78. ?>
  79.         <label>Seu nome real:</label>
  80.         <input type="text" name="real_name" placeholder="Nome Real" maxlength="30" />
  81.                
  82.         <label>Nome da conta: </br><small>(Entre 5 e 16 caracteres permitidos)</small></label>
  83.         <input type="text" name="username" placeholder="Nome da conta" maxlength="16" />
  84.        
  85.         <label>E-Mail:</label>
  86.         <input type="text" name="email" placeholder="E-Mail" maxlength="40" />
  87.        
  88.         <label>Palavra-passe: </br><small>(Entre 5 e 16 caracteres permitidos)</small></label>
  89.         <input type="password" name="password" placeholder="Palavra-passe" maxlength="16" />
  90.        
  91.         <label>Repete a palavra-passe:</label>
  92.         <input type="password" name="password2" placeholder="Repete a palavra-passe" maxlength="16" />
  93.        
  94.         <label>Código de apagar personagem: </br><small>(7 caracteres obrigatórios)</small></label>
  95.         <input type="text" name="social_id" placeholder="Código de apagar personagem" maxlength="7" />
  96.        
  97.        
  98.         <div class="submit_btn_wrapper">
  99.             <input type="submit" name="submit" class="btn_submit" value="REGISTAR" />
  100.         </div>
  101.     </form>
  102. </div>
  103. <div class="footer">
  104.     <div id="footerWrapper">
  105.         <div class="logos">
  106.  
  107.             <div class="gameforge_logo"></div>
  108.         </div>
  109.         <p class="legal_line">
  110.             © 2016 FONDRYMT2, INC. Todos os direitos reservados.
  111.         </p>
  112.     </div>
  113. </div>
  114. </body>
  115. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement