Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/02/2011, 12:26
Avatar de oscarios
oscarios
 
Fecha de Ingreso: septiembre-2004
Mensajes: 186
Antigüedad: 19 años, 7 meses
Puntos: 2
Respuesta: variables trocadas

PRIMERA PAGINA

Código PHP:
Ver original
  1. <?php require_once('../Connections/connts.php'); ?>
  2. <?php require_once('../Connections/connts.php'); ?>
  3. <?php
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  
  35. $editFormAction = $_SERVER['PHP_SELF'];
  36. if (isset($_SERVER['QUERY_STRING'])) {
  37.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  38. }
  39.  
  40. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  41.   $insertSQL = sprintf("INSERT INTO maestra (sap, mac, origen, numentra, serial, categoria, fabricante, modelo, estado, location, caja, canastilla, `user`, marcacion, Operador) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
  42.                        GetSQLValueString($_POST['sap'], "text"),
  43.                        GetSQLValueString($_POST['mac'], "text"),
  44.                        GetSQLValueString($_POST['origen'], "text"),
  45.                        GetSQLValueString($_POST['numentra'], "int"),
  46.                        GetSQLValueString($_POST['serial'], "text"),
  47.                        GetSQLValueString($_POST['categoria'], "text"),
  48.                        GetSQLValueString($_POST['fabricante'], "text"),
  49.                        GetSQLValueString($_POST['modelos'], "text"),
  50.                        GetSQLValueString($_POST['estado'], "text"),
  51.                        GetSQLValueString($_POST['location'], "text"),
  52.                        GetSQLValueString($_POST['caja'], "int"),
  53.                        GetSQLValueString($_POST['canastilla'], "int"),
  54.                        GetSQLValueString($_POST['user'], "text"),
  55.                        GetSQLValueString($_POST['marcacion'], "text"),
  56.                        GetSQLValueString($_POST['operador'], "text"));
  57.  
  58.   mysql_select_db($database_connts, $connts);
  59.   $Result1 = mysql_query($insertSQL, $connts) or die(mysql_error());
  60.  
  61.   $insertGoTo = "recibo2.php";
  62.   if (isset($_SERVER['QUERY_STRING'])) {
  63.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  64.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  65.   }
  66.   header(sprintf("Location: %s", $insertGoTo));
  67. }
  68.  
  69. $colname_Recomaestra1 = "-1";
  70. if (isset($_GET['busca'])) {
  71.   $colname_Recomaestra1 = $_GET['busca'];
  72. }
  73.  
  74. $maxRows_Recomaestra1 = 10;
  75. $pageNum_Recomaestra1 = 0;
  76. if (isset($_GET['pageNum_Recomaestra1'])) {
  77.   $pageNum_Recomaestra1 = $_GET['pageNum_Recomaestra1'];
  78. }
  79. $startRow_Recomaestra1 = $pageNum_Recomaestra1 * $maxRows_Recomaestra1;
  80.  
  81. $colname_Recomaestra1 = "-1";
  82. if (isset($_GET['busca'])) {
  83.   $colname_Recomaestra1 = $_GET['busca'];
  84. }
  85. mysql_select_db($database_connts, $connts);
  86. $query_Recomaestra1 = sprintf("SELECT * FROM maestra WHERE `user` = %s ORDER BY id DESC", GetSQLValueString($colname_Recomaestra1, "text"));
  87. $query_limit_Recomaestra1 = sprintf("%s LIMIT %d, %d", $query_Recomaestra1, $startRow_Recomaestra1, $maxRows_Recomaestra1);
  88. $Recomaestra1 = mysql_query($query_limit_Recomaestra1, $connts) or die(mysql_error());
  89. $row_Recomaestra1 = mysql_fetch_assoc($Recomaestra1);
  90.  
  91. if (isset($_GET['totalRows_Recomaestra1'])) {
  92.   $totalRows_Recomaestra1 = $_GET['totalRows_Recomaestra1'];
  93. } else {
  94.   $all_Recomaestra1 = mysql_query($query_Recomaestra1);
  95.   $totalRows_Recomaestra1 = mysql_num_rows($all_Recomaestra1);
  96. }
  97. $totalPages_Recomaestra1 = ceil($totalRows_Recomaestra1/$maxRows_Recomaestra1)-1;
  98. ?>
  99. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  100. <html xmlns="http://www.w3.org/1999/xhtml">
  101. <head>
  102. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  103. <title>Documento sin título</title>
  104. <script languaje="javascript">
  105.  
  106. function validarCampo1(form)
  107.  
  108. {
  109.  
  110.     if (form.mac.value.length < 12)
  111.  
  112.     {
  113.  
  114.     alert('Debes introducir mínimo 12 caracteres en el mac');  
  115.  
  116.     form.mac.focus(); return true;
  117.  
  118.     }
  119.  
  120. }
  121.  
  122. </script>
  123.  
  124. <script language="javascript">
  125. function pasaSiguiente(actual, siguiente, longitud)
  126.   {
  127.          if((actual.value.length + 1) == longitud)
  128.                 siguiente.focus();
  129.   }
  130. function MM_validateForm() { //v4.0
  131.   if (document.getElementById){
  132.     var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  133.     for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
  134.       if (val) { nm=val.name; if ((val=val.value)!="") {
  135.         if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
  136.           if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
  137.         } else if (test!='R') { num = parseFloat(val);
  138.           if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
  139.           if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
  140.             min=test.substring(8,p); max=test.substring(p+1);
  141.             if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
  142.       } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' NO ESTA.\n'; }
  143.     } if (errors) alert('HAY ERRORES EN EL FORMULARIO:\n'+errors);
  144.     document.MM_returnValue = (errors == '');
  145. } }
  146. </script>
  147. </head>
__________________
oscariosdw