Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/10/2011, 18:41
flabio5
 
Fecha de Ingreso: abril-2011
Mensajes: 15
Antigüedad: 13 años
Puntos: 0
Respuesta: enviar correo tras una variable

pfff se me olvidaba el codigo:

aqui el PHP:
Código PHP:
Ver original
  1. <?php require_once('../Connections/telefams.php'); ?>
  2. <?php
  3. if (!isset($_SESSION)) {
  4. }
  5. $MM_authorizedUsers = "admin,dataentry";
  6. $MM_donotCheckaccess = "false";
  7.  
  8. // *** Restrict Access To Page: Grant or deny access to this page
  9. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  10.   // For security, start by assuming the visitor is NOT authorized.
  11.   $isValid = False;
  12.  
  13.   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  14.   // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  15.   if (!empty($UserName)) {
  16.     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  17.     // Parse the strings into arrays.
  18.     $arrUsers = Explode(",", $strUsers);
  19.     $arrGroups = Explode(",", $strGroups);
  20.     if (in_array($UserName, $arrUsers)) {
  21.       $isValid = true;
  22.     }
  23.     // Or, you may restrict access to only certain users based on their username.
  24.     if (in_array($UserGroup, $arrGroups)) {
  25.       $isValid = true;
  26.     }
  27.     if (($strUsers == "") && false) {
  28.       $isValid = true;
  29.     }
  30.   }
  31.   return $isValid;
  32. }
  33.  
  34. $MM_restrictGoTo = "login.php";
  35. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  36.   $MM_qsChar = "?";
  37.   $MM_referrer = $_SERVER['PHP_SELF'];
  38.   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  39.   if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
  40.   $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  41.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  42.   header("Location: ". $MM_restrictGoTo);
  43.   exit;
  44. }
  45. ?>
  46. <?php
  47. if (!function_exists("GetSQLValueString")) {
  48. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  49. {
  50.   if (PHP_VERSION < 6) {
  51.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  52.   }
  53.  
  54.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  55.  
  56.   switch ($theType) {
  57.     case "text":
  58.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  59.       break;    
  60.     case "long":
  61.     case "int":
  62.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  63.       break;
  64.     case "double":
  65.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  66.       break;
  67.     case "date":
  68.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  69.       break;
  70.     case "defined":
  71.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  72.       break;
  73.   }
  74.   return $theValue;
  75. }
  76. }
  77.  
  78. $editFormAction = $_SERVER['PHP_SELF'];
  79. if (isset($_SERVER['QUERY_STRING'])) {
  80.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  81. }
  82.  
  83. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
  84.   $updateSQL = sprintf("UPDATE reparaciones SET fechaRE=%s, trabajo_realizado=%s, reparado_por=%s, monto_reparacion=%s, estatus=%s WHERE ordenID=%s",
  85.                        GetSQLValueString($_POST['fechaRE'], "text"),
  86.                        GetSQLValueString($_POST['trabajo_realizado'], "text"),
  87.                        GetSQLValueString($_POST['reparado_por'], "text"),
  88.                        GetSQLValueString($_POST['monto_reparacion'], "text"),
  89.                        GetSQLValueString($_POST['estatus'], "text"),
  90.                        GetSQLValueString($_POST['ordenID'], "int"));
  91.  
  92.   mysql_select_db($database_telefams, $telefams);
  93.   $Result1 = mysql_query($updateSQL, $telefams) or die(mysql_error());
  94.  
  95.   $updateGoTo = "indexl.php";
  96.   if (isset($_SERVER['QUERY_STRING'])) {
  97.     $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
  98.     $updateGoTo .= $_SERVER['QUERY_STRING'];
  99.   }
  100.   header(sprintf("Location: %s", $updateGoTo));
  101. }
  102.  
  103. $colname_rsUsuarios = "-1";
  104. if (isset($_SESSION['MM_Username'])) {
  105.   $colname_rsUsuarios = $_SESSION['MM_Username'];
  106. }
  107. mysql_select_db($database_telefams, $telefams);
  108. $query_rsUsuarios = sprintf("SELECT * FROM usuarios WHERE usuario = %s", GetSQLValueString($colname_rsUsuarios, "text"));
  109. $rsUsuarios = mysql_query($query_rsUsuarios, $telefams) or die(mysql_error());
  110. $row_rsUsuarios = mysql_fetch_assoc($rsUsuarios);
  111. $totalRows_rsUsuarios = mysql_num_rows($rsUsuarios);
  112.  
  113. $colname_rsReparaciones = "-1";
  114. if (isset($_GET['ordenID'])) {
  115.   $colname_rsReparaciones = $_GET['ordenID'];
  116. }
  117. mysql_select_db($database_telefams, $telefams);
  118. $query_rsReparaciones = sprintf("SELECT * FROM reparaciones WHERE ordenID = %s", GetSQLValueString($colname_rsReparaciones, "int"));
  119. $rsReparaciones = mysql_query($query_rsReparaciones, $telefams) or die(mysql_error());
  120. $row_rsReparaciones = mysql_fetch_assoc($rsReparaciones);
  121. $totalRows_rsReparaciones = mysql_num_rows($rsReparaciones);
  122. ?>