Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.17 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include ("conexio.php");
  4.             conect();  
  5.            
  6.             $usuari = stripslashes($_POST['usuari']);
  7.             $usuari = strip_tags($usuari);
  8.             $pass = stripslashes($_POST['pass']);
  9.             $pass = strip_tags($pass);
  10.             $pass1 = stripslashes($_POST['passconfirm']);
  11.             $pass1 = strip_tags($pass1);
  12.             $mail = stripslashes($_POST['email']);
  13.             $mail1 = strip_tags($_POST['emailconfirm']);
  14.             $valid = $_POST['code'];
  15.             if ((empty($usuari)) or (empty($pass)) or (empty($pass1)) or (empty($mail)) or (empty($mail1))){
  16.                 unset($_POST['enviar_reg']);
  17.                 $_SESSION['agree'] = 1;
  18.                 $_SESSION['buits'] = 1;
  19.                 echo "<script type='text/javascript'>  
  20.  window.location='registre.php'
  21. </script>";
  22.             }elseif ((($pass == $pass1) and ($pass  != NULL)) and (($mail == $mail1) and ($mail  != NULL))){
  23.                 $num_llet_pass = strlen($pass);
  24.                 if ($num_llet_pass >= 6) {
  25.                     if ($valid == NULL){
  26.                         unset($_POST['enviar_reg']);
  27.                         session_destroy();
  28.                         $_SESSION['agree'] = 1;
  29.                         $_SESSION['img_buida'] = 1;
  30.                         echo "<script type='text/javascript'>  
  31.  window.location='registre.php'
  32. </script>";
  33.                     }else{
  34.                         if($valid == true) {
  35.                             $consulta_user = mysql_query("select count(*) from usuaris where usuari = '$usuari'");
  36.                             if($consulta_user != 0) {
  37.                                 unset($_POST['enviar_reg']);
  38.                                 session_destroy();
  39.                                 $_SESSION['agree'] = 1;
  40.                                 $_SESSION['existeix'] = 1;
  41.                                 echo "<script type='text/javascript'>  
  42.  window.location='registre.php'
  43. </script>";
  44.                             } else {
  45.                                 $_consulta_mail = mysql_query("select count(*) from usuaris where mail = '$mail'");
  46.                                 if ($consulta_mail != 1) {
  47.                                 unset($_POST['enviar_reg']);
  48.                                 session_destroy();
  49.                                 $_SESSION['agree'] = 1;
  50.                                 $_SESSION['existeix_mail'] = 1;
  51.                                 echo "<script type='text/javascript'>  
  52.  window.location='registre.php'
  53. </script>";
  54.                                 } else {
  55.                                 unset($_POST['enviar_reg']);
  56.                                 mysql_query("INSERT INTO usuaris (usuari,pass,mail) values ('$usuari','$pass','$mail')");
  57.                                 echo "<div align=\"center\"  class=\"success\">El registre s'ha completat amb exit, d'ara en endavant ja podràs<br>publicar les teves pròpies noticies i comentar les existents. <br><br>Per tornar a la portada fes clic al logotip d'Enva.</div>";
  58.                                 session_destroy();
  59.                                 }
  60.                             }
  61.                         } else {
  62.                             unset($_POST['enviar_reg']);
  63.                             session_destroy();
  64.                             $_SESSION['agree'] = 1;
  65.                             $_SESSION['verific'] = 1;echo "<form method=\"POST\" action=\"registre.php\"><input type=\"hidden\" name=\"agree\"><input type=\"hidden\" name=\"verific\"></form>";
  66.                             echo "<script type='text/javascript'>  
  67.  window.location='registre.php'
  68. </script>";
  69.                     }
  70.                     }
  71.                 } else {
  72.                     unset($_POST['enviar_reg']);
  73.                     session_destroy();
  74.                     $_SESSION['agree'] = 1;
  75.                     $_SESSION['6caract'] = 1;
  76.                     echo "<script type='text/javascript'>  
  77.  window.location='registre.php'
  78. </script>";
  79.                 }
  80.             }else{
  81.                 unset($_POST['enviar_reg']);
  82.                 session_destroy();
  83.                 $_SESSION['agree'] = 1;
  84.                 $_SESSION['no_iguals'] = 1;
  85.                 echo "<script type='text/javascript'>  
  86.  window.location='registre.php'
  87. </script>";
  88.             }
  89. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement