Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/03/2014, 22:59
Avatar de geovannimendoza
geovannimendoza
 
Fecha de Ingreso: noviembre-2013
Mensajes: 15
Antigüedad: 10 años, 5 meses
Puntos: 0
Pregunta Activar cuenta enviando un mail

Hola comunidad, saludos desde Bogotá - Colombia, mi consulta es la siguiente:

Tengo dos archivos, uno de registro y el otro de registro ok; todo lo he realizado en DreamWeaver, solicito su ayuda ya que no sé como enviar el correo de validación, esto es lo que tengo.

archivo registro y formulario.


Código PHP:
<?php require_once('Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}
/*****************************************************************

            Verificiar email si existe      

/******************************************************************/

// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset(
$_POST[$MM_flag])) {
  
$MM_dupKeyRedirect='email_repetido.php?recordSEG='.$_GET["recordSEG"].'';
  
$loginUsername $_POST['strEmail'];
  
$LoginRS__query sprintf("SELECT strEmail FROM tblusuario WHERE strEmail=%s"GetSQLValueString($loginUsername"text"));
  
mysql_select_db($database_conexion$conexion);
  
$LoginRS=mysql_query($LoginRS__query$conexion) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);

  
//if there is a row in the database, the username was found - can not add the requested username
  
if($loginFoundUser){
    
$MM_qsChar "?";
    
//append the username to the redirect page
    
if (substr_count($MM_dupKeyRedirect,"?") >=1$MM_qsChar "&";
    
$MM_dupKeyRedirect $MM_dupKeyRedirect $MM_qsChar ."requsername=".$loginUsername;
    
header ("Location: $MM_dupKeyRedirect");
    exit;
  }
}
  

       
$activar genera_random(20);


$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

  

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO tblusuario (strNombre, strApellido1, strApellido2, intTipoDocumento, strDocumento, strPassword, intSexo, strOcupacion, strDireccion, intDepartamento, intCiudad, strTelFijo, strCel, strEmail, intDia, intMes, strAno, intEstado, strActivar) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['strNombre'], "text"),
                       
GetSQLValueString($_POST['strApellido1'], "text"),
                       
GetSQLValueString($_POST['strApellido2'], "text"),
                       
GetSQLValueString($_POST['intTipoDocumento'], "int"),
                       
GetSQLValueString($_POST['strDocumento'], "text"),
                       
GetSQLValueString(md5($_POST['strPassword']), "text"),
                       
GetSQLValueString($_POST['intSexo'], "int"),
                       
GetSQLValueString($_POST['strOcupacion'], "text"),
                       
GetSQLValueString($_POST['strDireccion'], "text"),
                       
GetSQLValueString($_POST['intDepartamento'], "int"),
                       
GetSQLValueString($_POST['intCiudad'], "int"),
                       
GetSQLValueString($_POST['strTelFijo'], "text"),
                       
GetSQLValueString($_POST['strCel'], "text"),
                       
GetSQLValueString($_POST['strEmail'], "text"),
                       
GetSQLValueString($_POST['intDia'], "int"),
                       
GetSQLValueString($_POST['intMes'], "int"),
                       
GetSQLValueString($_POST['strAno'], "int"),
                       
GetSQLValueString($_POST['intEstado'], "int"),
                       
GetSQLValueString($_POST['strActivar'], "text"));

  
mysql_select_db($database_conexion$conexion);
  
$Result1 mysql_query($insertSQL$conexion) or die(mysql_error());
  
  
$insertGoTo "registro_ok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

mysql_select_db($database_conexion$conexion);
$query_Usuario "SELECT * FROM tblusuario";
$Usuario mysql_query($query_Usuario$conexion) or die(mysql_error());
$row_Usuario mysql_fetch_assoc($Usuario);
$totalRows_Usuario mysql_num_rows($Usuario);

mysql_select_db($database_conexion$conexion);
$query_Departamento "SELECT * FROM tbldepartamento ORDER BY tbldepartamento.strNombre ASC";
$Departamento mysql_query($query_Departamento$conexion) or die(mysql_error());
$row_Departamento mysql_fetch_assoc($Departamento);
$totalRows_Departamento mysql_num_rows($Departamento);

mysql_select_db($database_conexion$conexion);
$query_Ciudad "SELECT * FROM tblciudad ORDER BY tblciudad.strNombre ASC";
$Ciudad mysql_query($query_Ciudad$conexion) or die(mysql_error());
$row_Ciudad mysql_fetch_assoc($Ciudad);
$totalRows_Ciudad mysql_num_rows($Ciudad);

mysql_select_db($database_conexion$conexion);
$query_Dia "SELECT * FROM tbldia";
$Dia mysql_query($query_Dia$conexion) or die(mysql_error());
$row_Dia mysql_fetch_assoc($Dia);
$totalRows_Dia mysql_num_rows($Dia);

mysql_select_db($database_conexion$conexion);
$query_Mes "SELECT * FROM tblmes";
$Mes mysql_query($query_Mes$conexion) or die(mysql_error());
$row_Mes mysql_fetch_assoc($Mes);
$totalRows_Mes mysql_num_rows($Mes);
?>

archivo registro_ok.php que me da Dreamweaver



<?php require_once('Connections/conexion.php'); ?>

Código PHP:
    <!--    Envio correo de confirnación    -->
     <?php
     
    $email 
$_POST["strEmail"];
    
$nombre $_POST["strNombre"];
    
$apellido1 $_POST["strApellido1"];
    
$activar $_POST["strActivar"];

 
       
$path "http://localhost/xxxx/";
       
$activarLink $path."activar_registro.php?id=".$nombre['idUsuario']."&activarKey=".$activar.""
       
       
       
$contenido '<p>Hola<br>'.$nombre.'&nbsp;'$apellido1.'<br>'.$razonsocial.'<br>
          </p>
      <p>Estás a solo un paso de completar el registro en nuestra tienda virtual, solo debes dar click en el enlace para activar tu cuenta. Con esta validación y activación, confirmamos si el correo que registrado en válido para enviar futura información.<br><br>
      <a HREF ="'
.$activarLink.'">'.$activarLink.'</a> 
      
      </p>
      
      
      
      <p>Gracias por el tiempo y querer ser cliente de xxx</p></td>'
;
      
      
$asunto 'Activar cuenta de usuario - Tienda Virtual';
    
EnvioCorreoHTML($destinatario$contenido$asunto);
    

    
    
?>
Los datos de Nombre, email, apellido, etc.. no me los trae, no sé que estaré haciendo mal.
El error de SMTP es normal que lo bote porque no estoy en un servidor con esta opción activada; ¿Será que por lo mismo no me trae los datos?.

He mirado y realizado los pasos que he encontrado es el foro pero la verdad no logro entender, ya que como les comenté anteriormente, todo lo hago por Dreamweaver, entonces quedó perdido.

Gracias por su ayuda.

Quedo atento.