PRIMERA PAGINA
Código PHP:
Ver original<?php require_once('../Connections/connts.php'); ?>
<?php require_once('../Connections/connts.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
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_insert"])) && ($_POST["MM_insert"] == "form1")) { $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)", GetSQLValueString($_POST['sap'], "text"),
GetSQLValueString($_POST['mac'], "text"),
GetSQLValueString($_POST['origen'], "text"),
GetSQLValueString($_POST['numentra'], "int"),
GetSQLValueString($_POST['serial'], "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['fabricante'], "text"),
GetSQLValueString($_POST['modelos'], "text"),
GetSQLValueString($_POST['estado'], "text"),
GetSQLValueString($_POST['location'], "text"),
GetSQLValueString($_POST['caja'], "int"),
GetSQLValueString($_POST['canastilla'], "int"),
GetSQLValueString($_POST['user'], "text"),
GetSQLValueString($_POST['marcacion'], "text"),
GetSQLValueString($_POST['operador'], "text"));
$insertGoTo = "recibo2.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
$colname_Recomaestra1 = "-1";
if (isset($_GET['busca'])) { $colname_Recomaestra1 = $_GET['busca'];
}
$maxRows_Recomaestra1 = 10;
$pageNum_Recomaestra1 = 0;
if (isset($_GET['pageNum_Recomaestra1'])) { $pageNum_Recomaestra1 = $_GET['pageNum_Recomaestra1'];
}
$startRow_Recomaestra1 = $pageNum_Recomaestra1 * $maxRows_Recomaestra1;
$colname_Recomaestra1 = "-1";
if (isset($_GET['busca'])) { $colname_Recomaestra1 = $_GET['busca'];
}
$query_Recomaestra1 = sprintf("SELECT * FROM maestra WHERE `user` = %s ORDER BY id DESC", GetSQLValueString
($colname_Recomaestra1, "text")); $query_limit_Recomaestra1 = sprintf("%s LIMIT %d, %d", $query_Recomaestra1, $startRow_Recomaestra1, $maxRows_Recomaestra1);
if (isset($_GET['totalRows_Recomaestra1'])) { $totalRows_Recomaestra1 = $_GET['totalRows_Recomaestra1'];
} else {
}
$totalPages_Recomaestra1 = ceil($totalRows_Recomaestra1/$maxRows_Recomaestra1)-1; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script languaje="javascript">
function validarCampo1(form)
{
if (form.mac.value.length < 12)
{
alert('Debes introducir mínimo 12 caracteres en el mac');
form.mac.focus(); return true;
}
}
</script>
<script language="javascript">
function pasaSiguiente(actual, siguiente, longitud)
{
if((actual.value.length + 1) == longitud)
siguiente.focus();
}
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' NO ESTA.\n'; }
} if (errors) alert('HAY ERRORES EN EL FORMULARIO:\n'+errors);
document.MM_returnValue = (errors == '');
} }
</script>
</head>