Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include ("conexio.php");
- conect();
- $usuari = stripslashes($_POST['usuari']);
- $usuari = strip_tags($usuari);
- $pass = stripslashes($_POST['pass']);
- $pass = strip_tags($pass);
- $pass1 = stripslashes($_POST['passconfirm']);
- $pass1 = strip_tags($pass1);
- $mail = stripslashes($_POST['email']);
- $mail1 = strip_tags($_POST['emailconfirm']);
- $valid = $_POST['code'];
- if ((empty($usuari)) or (empty($pass)) or (empty($pass1)) or (empty($mail)) or (empty($mail1))){
- unset($_POST['enviar_reg']);
- $_SESSION['agree'] = 1;
- $_SESSION['buits'] = 1;
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- }elseif ((($pass == $pass1) and ($pass != NULL)) and (($mail == $mail1) and ($mail != NULL))){
- $num_llet_pass = strlen($pass);
- if ($num_llet_pass >= 6) {
- if ($valid == NULL){
- unset($_POST['enviar_reg']);
- session_destroy();
- $_SESSION['agree'] = 1;
- $_SESSION['img_buida'] = 1;
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- }else{
- if($valid == true) {
- $consulta_user = mysql_query("select count(*) from usuaris where usuari = '$usuari'");
- if($consulta_user != 0) {
- unset($_POST['enviar_reg']);
- session_destroy();
- $_SESSION['agree'] = 1;
- $_SESSION['existeix'] = 1;
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- } else {
- $_consulta_mail = mysql_query("select count(*) from usuaris where mail = '$mail'");
- if ($consulta_mail != 1) {
- unset($_POST['enviar_reg']);
- session_destroy();
- $_SESSION['agree'] = 1;
- $_SESSION['existeix_mail'] = 1;
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- } else {
- unset($_POST['enviar_reg']);
- mysql_query("INSERT INTO usuaris (usuari,pass,mail) values ('$usuari','$pass','$mail')");
- 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>";
- session_destroy();
- }
- }
- } else {
- unset($_POST['enviar_reg']);
- session_destroy();
- $_SESSION['agree'] = 1;
- $_SESSION['verific'] = 1;echo "<form method=\"POST\" action=\"registre.php\"><input type=\"hidden\" name=\"agree\"><input type=\"hidden\" name=\"verific\"></form>";
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- }
- }
- } else {
- unset($_POST['enviar_reg']);
- session_destroy();
- $_SESSION['agree'] = 1;
- $_SESSION['6caract'] = 1;
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- }
- }else{
- unset($_POST['enviar_reg']);
- session_destroy();
- $_SESSION['agree'] = 1;
- $_SESSION['no_iguals'] = 1;
- echo "<script type='text/javascript'>
- window.location='registre.php'
- </script>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement