Ver Mensaje Individual
  #9 (permalink)  
Antiguo 24/05/2014, 08:00
OfSerker
 
Fecha de Ingreso: marzo-2014
Mensajes: 168
Antigüedad: 10 años, 1 mes
Puntos: 2
Respuesta: Porque me da error

Ahora, tengo este error con mi nuevo código (mejorado):

Las contraseñas no coinciden
Error, no se han insertado los datos.
Usuario OfSerker creado con éxito. Enviando un mail a [email protected] que luego deberás aceptar


Os paso el código y decidme porque me sale que no se insertarón los datos i pk la pw no coincide.

Código completo:

Código PHP:
<?php
require_once('./config/funciones.php');
conectar('caca''sese''lele''noleas');
 
//Recibir
$user     strip_tags($_POST['usernamesignup']);
$pass     strip_tags(sha1($_POST['passwordsignup']));
$mail     strip_tags($_POST['emailsignup']);
$repw     strip_tags($_POST['passwordsignup_confirm']);
$ip       $_SERVER['REMOTE_ADDR'];
$key      $aleatorio uniqid();
$activado "0";

$query    mysql_query('SELECT * FROM users WHERE user="'.mysql_real_escape_string($user).'"');
$jlquery    mysql_query('SELECT * FROM users WHERE mail="'.mysql_real_escape_string($mail).'"');


if(
$existe mysql_fetch_object($query))
{
    echo 
'El usuario '.$user.' ya existe<br />';
    
header("refresh: 4; url=./register.html");

}else{

}

if(
$existe mysql_fetch_object($jlquery)) {
    echo 
'El mail '.$mail.' ya está registrado<br />';
    
header("refresh: 4; url=./register.html");

}else{
    
}

if(
$user==NULL|$pass==NULL|$repw==NULL|$mail==NULL

        echo 
"Comprueva todos los campos<br />";
        
header("refresh: 4; url=./register.html");
        
}else{
        
if(
$pass!=$repw) {
         
    echo 
"Las contraseñas no coinciden<br />"
header("refresh: 4; url=./register.html");  
    

}else{
    
$meter mysql_query('INSERT INTO users (user, pass, mail, codigo, activado, ip) values 
("'
.mysql_real_escape_string($user).'",
"'
.mysql_real_escape_string($pass).'",
"'
.mysql_real_escape_string($mail).'"
,"'
.mysql_real_escape_string($key).'","'
mysql_real_escape_string($activado).'"
,"'
.$ip.'")'); 

}

if(!
$meter) {

echo 
'Error, no se han insertado los datos.<br />';

}else{

}
$path="www.ofserker.netai.net/"//creamos nuestra direccion, con las carpetas que sean si hay 
         //armamos nuestro link para enviar por mail en la variable $activateLink 
$activateLink=$path."activacion?id=".$row['key']."&activateKey=".$aleatorio.""
                 
// Datos del email 

$nombre_origen    "OfSerker Web"
$email_origen     "[email protected]"
$email_copia      "[email protected]"
$email_ocultos    "[email protected]"
$email_destino    "".$row['mail']."";   



$asunto           "".$row['user']." Datos de registro en Cevit, guarde este email."

$mensaje          '<table width="629" border="0" cellspacing="1" cellpadding="2"> 
  <tr> 
    <td width="623" align="left"></td> 
  </tr> 
  <tr> 
    <td bgcolor="#2EA354"><div style="color:#FFFFFF; font-size:14; font-family: Arial, Helvetica, sans-serif; text-transform: capitalize; font-weight: bold;"><strong>     Estos son sus datos de registro, '
.$row['user'].'</strong></div></td> 
  </tr> 
  <tr> 
    <td height="95" align="left" valign="top"><div style=" color:#000000; font-family:Arial, Helvetica, sans-serif; font-size:12px; margin-bottom:3px;"> USUARIO: '
.$row['usuer'].'</strong><br><br><br> 
          <strong>SU CLAVE : </strong>'
.$row['pass'].'</strong><br><br><br> 
          <strong>SU EMAIL : </strong>'
.$row['mail'].'</strong><br><br><br> 
          <strong>SU LINK DE ACTIVACION:<br><a href="'
.$activateLink.'">'.$activateLink.' </strong></a><br><br><br> 
          <strong>POR FAVOR HAGA CLICK EN LINK DE ARRIBA PARA ACTIVAR SU CUENRA Y ACCEDER A LA PAGINA SIN RESTRICCIONES</strong><br><br><br> 
          <strong>SI EL LINK NO FUNCIONA A LA PRIMERA INTENTELO UNA SEGUNDA, EL SERVIDOR A VECES TARDA EN PROCESAR LA PRIMERA ORDEN</strong><br><br><br> 
           
          <strong>GRACIAS POR REGISTRARSE EN CEVIT.</strong><br><br><br> 
    </div> 
    </td> 
  </tr> 
</table>'




$formato          "html"

//*****************************************************************// 
$headers  "From: $nombre_origen <$email_origen> \r\n"
$headers .= "Return-Path: <$email_origen> \r\n"
$headers .= "Reply-To: $email_origen \r\n"


$headers .= "X-Sender: $email_origen \r\n"

$headers .= "X-Priority: 3 \r\n"
$headers .= "MIME-Version: 1.0 \r\n"
$headers .= "Content-Transfer-Encoding: 7bit \r\n"

//*****************************************************************// 
//www.ofserker.netai.net/activacion.php?id=$aleatorio

if($formato == "html"
 { 
 
$headers .= "Content-Type: text/html; charset=iso-8859-1 \r\n";  } 
else 
    { 
    
$headers .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";  
    } 


$supermail mail($email_destino$asunto$mensaje$headers);


      } 
            
         
if (
$supermail)
{
echo 
"Usuario <strong>$user</strong> creado con &eacutexito. Enviando un mail a <strong>$mail</strong> que luego deber&aacutes aceptar $direccion";
            
header("refresh: 8; url=./index.php");

}else{
            echo 
'Hubo un error en el registro';
            
header("refresh: 4; url=./index.php");
        }
}

?>
Atentamente, OfSerker.