Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/07/2014, 04:20
mortisdj
 
Fecha de Ingreso: mayo-2014
Ubicación: Valencia
Mensajes: 63
Antigüedad: 10 años
Puntos: 0
Alta manual y envío de email con contraseña.

Buenas, en mi página damos de alta a los clientes de forma manual, lo que quiero es que al poner una contraseña se le envíe un mail al cliente informándole de la misma.

He probado de mil formas, pero no hay forma, no manda el mail con la contraseña.

Os dejo el código que tengo, el formulario funciona perfectamente, mi problema es el envío de la contraseña al cliente por mail para que sepa que ha sido dado de alta.

Después, tengo otro problema, la pass me la encripta en md5, mi problema es que al editar el cliente y darle a guardar sin modificar la contraseña, me cambia la pass, vamos, me coge el resultado en md5 que aparece y lo encripta de nuevo, cargandose por completo la password original, :S

Os dejo el código y a ver si alguien me puede ayudar.

Gracias.

Código PHP:
<?php require_once('Connections/conexion.php'); ?>
<?php 
require_once('includes/funciones.php'); ?>
<?php 
if(isset( $_SESSION['MM_UserGroup']) &&  $_SESSION['MM_UserGroup']==1){?>
<?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;
}
}

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

if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  
$updateSQL sprintf("UPDATE tblusuarios SET strNombre=%s, strApellidos=%s, strEspecialidad=%s, intAltaProfeRegist=%s, intCentro=%s, intTelefono=%s, strMensaje=%s, intActivo=%s, strPassword=%s WHERE intId=%s",
                       
GetSQLValueString($_POST['strNombre'], "text"),
                       
GetSQLValueString($_POST['strApellidos'], "text"),
                       
GetSQLValueString($_POST['strEspecialidad'], "text"),
                        
GetSQLValueString(isset($_POST['intAltaProfeRegist']) ? "true" """defined","1","0"),            
                       
GetSQLValueString($_POST['intCentro'], "int"),                  
                       
GetSQLValueString($_POST['intTelefono'], "int"),
                       
GetSQLValueString($_POST['strMensaje'], "text"),
                       
GetSQLValueString($_POST['intActivo'], "int"),
                       
GetSQLValueString(md5($_POST['strPassword']), "text"),                       
                       
GetSQLValueString($_POST['intId'], "int"));

  
mysql_select_db($database_conexion$conexion);
  
$Result1 mysql_query($updateSQL$conexion) or die(mysql_error());

  
$updateGoTo "profesores-contra-list.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}


$UsuarioId_ModificarDatos "0";
if (isset(
$_GET['recordId'])) {
  
$UsuarioId_ModificarDatos $_GET['recordId'];
}
mysql_select_db($database_conexion$conexion);
$query_ModificarDatos sprintf("SELECT * FROM tblusuarios WHERE tblusuarios.intId= %s"GetSQLValueString($UsuarioId_ModificarDatos"int"));
$ModificarDatos mysql_query($query_ModificarDatos$conexion) or die(mysql_error());
$row_ModificarDatos mysql_fetch_assoc($ModificarDatos);
$totalRows_ModificarDatos mysql_num_rows($ModificarDatos);

mysql_select_db($database_conexion$conexion);
$query_DatosCentros "SELECT tblcentro.*,tblprovincias.provincia, tblprovincias.id FROM
tblcentro
Inner Join tblprovincias ON tblcentro.refProvincia = tblprovincias.id ORDER BY tblprovincias.provincia ASC, tblcentro.strLocalidad ASC, tblcentro.strNombre ASC"
;
$DatosCentros mysql_query($query_DatosCentros$conexion) or die(mysql_error());
$row_DatosCentros mysql_fetch_assoc($DatosCentros);
$totalRows_DatosCentros mysql_num_rows($DatosCentros);

?>
<!DOCTYPE html>
<html lang="es"><!-- InstanceBegin template="/Templates/Principal.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Web.es</title>
<meta name="description" content="">
<meta name="robots" content="index, follow">
<!-- InstanceEndEditable -->
<meta charset="utf-8">
<?php include("includes/precabecera.php"); ?>

<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<!-- InstanceBeginEditable name="EditRegion3" -->
<?php $menuseleccionado 6;?>
<section class="bg1">
  <!--==============================header=================================-->
  <header id="header">
    <div class="container_12">
      <?php include("includes/cabecera.php"); ?>
      <?php //include("includes/slider.php"); ?>
      <?php include("includes/menu.php"); ?>
    </div>
  </header>
  <!--===================content====================-->
  <div id="content">
    <div class="container_12">
        <div class="row">
 
            <div class="prefix_4 grid_6">
            <?php if (  isset($_GET['recordtext']) && $_GET['recordtext']=='1'){ ?>
            <br><br><div  class="mensajeenviado">Mensaje Guardado Correctamente</div>
            <?php }?>
              <h3 class="mrg22 pad3">Editar datos de: <?php echo $_GET['recordNameUser']; ?></h3>