Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/10/2011, 17:11
flabio5
 
Fecha de Ingreso: abril-2011
Mensajes: 15
Antigüedad: 12 años, 11 meses
Puntos: 0
Pregunta enviar correo tras una variable

Hola hace tiempo hice un pregunta en el foro y solo uno me respondio, solo que no me ayudo, creo que fue que formule mal la pregunta! pues bien aqui la formulo de una manera diferente, a ver si me pueden ayudar, tengo un formulario que he llamado desde otra pagina, este me trae todos los datos por medio de la ID, en este formulario hago un cambio de estatus ( estoy haciendo un update de la base de datos ), pues bien, en los datos que llame hay una direccion de correo electronico, lo que quiero es que cuando hago el update de los datos, usando esa direccion email que fue llamada por una variable, se envie un correo a la misma cuando le de al boton de actualizar. espero me puedan ayudar!

aqui dejo el codigo php ( estoy nuevo en php, a lo mejor el codigo se ve muy profesional, pero es que estoy usando las herramientas del dreamweaver, no lo estoy escribiendo yo)

Código PHP:
<?php require_once('../Connections/telefams.php'); ?>
<?php
if (!isset($_SESSION)) {
  
session_start();
}
$MM_authorizedUsers "admin,dataentry";
$MM_donotCheckaccess "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
  
// For security, start by assuming the visitor is NOT authorized. 
  
$isValid False

  
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  
if (!empty($UserName)) { 
    
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    
// Or, you may restrict access to only certain users based on their username. 
    
if (in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && false) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}

$MM_restrictGoTo "login.php";
if (!((isset(
$_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers$_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  
$MM_qsChar "?";
  
$MM_referrer $_SERVER['PHP_SELF'];
  if (
strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
  if (isset(
$_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0
  
$MM_referrer .= "?" $_SERVER['QUERY_STRING'];
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
?>
<?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"] == "form")) {
  
$updateSQL sprintf("UPDATE reparaciones SET fechaRE=%s, trabajo_realizado=%s, reparado_por=%s, monto_reparacion=%s, estatus=%s WHERE ordenID=%s",
                       
GetSQLValueString($_POST['fechaRE'], "text"),
                       
GetSQLValueString($_POST['trabajo_realizado'], "text"),
                       
GetSQLValueString($_POST['reparado_por'], "text"),
                       
GetSQLValueString($_POST['monto_reparacion'], "text"),
                       
GetSQLValueString($_POST['estatus'], "text"),
                       
GetSQLValueString($_POST['ordenID'], "int"));

  
mysql_select_db($database_telefams$telefams);
  
$Result1 mysql_query($updateSQL$telefams) or die(mysql_error());


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

$colname_rsUsuarios "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_rsUsuarios $_SESSION['MM_Username'];
}
mysql_select_db($database_telefams$telefams);
$query_rsUsuarios sprintf("SELECT * FROM usuarios WHERE usuario = %s"GetSQLValueString($colname_rsUsuarios"text"));
$rsUsuarios mysql_query($query_rsUsuarios$telefams) or die(mysql_error());
$row_rsUsuarios mysql_fetch_assoc($rsUsuarios);
$totalRows_rsUsuarios mysql_num_rows($rsUsuarios);

$colname_rsReparaciones "-1";
if (isset(
$_GET['ordenID'])) {
  
$colname_rsReparaciones $_GET['ordenID'];
}
mysql_select_db($database_telefams$telefams);
$query_rsReparaciones sprintf("SELECT * FROM reparaciones WHERE ordenID = %s"GetSQLValueString($colname_rsReparaciones"int"));
$rsReparaciones mysql_query($query_rsReparaciones$telefams) or die(mysql_error());
$row_rsReparaciones mysql_fetch_assoc($rsReparaciones);
$totalRows_rsReparaciones mysql_num_rows($rsReparaciones);
?>
Gracias!