![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
01/05/2014, 13:32
|
| | Fecha de Ingreso: marzo-2014
Mensajes: 168
Antigüedad: 10 años, 10 meses Puntos: 2 | |
Respuesta: No se envia el mail ¿Tal que que asi el register.php?: (tiene un error) Código PHP:
<?php
require_once('./config/funciones.php');
conectar('mysql13.000webhost.com', 'a6612376_sergiof', 'Sergivilla1', 'a6612376_users');
//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).'"');
if($existe = mysql_fetch_object($query))
{
echo 'El usuario '.$user.' ya existe.';
header("refresh: 4; url=./register.html");
}else{
$sql = "INSERT INTO users (user, pass, mail, codigo, activado, ip)";
$sql .= "VALUES('".mysql_real_escape_string($user)."', ";
$sql .= "'".mysql_real_escape_string($pass)."', ";
$sql .= "'".mysql_real_escape_string($mail)."', ";
$sql .= "'".mysql_real_escape_string($key). "',";
$sql .= "'".mysql_real_escape_string($activado) . "',";
$sql .= "'".$ip ."')";
$meter = mysql_query($sql) or die(mysql_error());
if ($meter) {
if(mysql_num_rows($meter) > 0)
{
$para = $mail; //hace referencia a la variable email...
$titulo = "Activar cuenta";
$mensaje = 'Para activar la cuenta, es necesario entrar en este enlace: http://ofserker.netai.net/verificar.php?codigo=$key' . "\r\n";
$cabeceras = 'MIME-Version: 1.0' . "\r\n";
$cabeceras .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";
$cabeceras .= "From: [email protected]" . "\r\n";
$email = mail('$para', '$titulo', '$mensaje', '$cabeceras');
if ($email) {
echo "Usuario " . $user . " creado con éxito. Enviando un mail a <strong>$mail</strong> que luego deberás aceptar";
header("refresh: 8; url=./index.php");
} else {
echo 'Hubo un error en el registro';
header("refresh: 4; url=./index.php");
}
}
?> Atentamemte, OfSerker |