// categoria.php: muestra la informacion de cada categoria
include("/home/triditec/domains/triditec.com.mx/includes/usr/usr_conf.php");
include("/home/triditec/domains/triditec.com.mx/includes/common/funcs.php");
include("/home/triditec/domains/triditec.com.mx/includes/common/estilos.php");
$pid = $_GET["pid"];
$eid = $_GET["eid"];
$mid = $_GET["mid"];
$cid = $_GET["cid"];
$did = $_GET["did"];
// nivel 0: seleccionar pais
if ($pid==0 && $eid==0 && $mid=="" && $cid==0 && $did==0) {
$query = "select * from paises where autoriza='1' order by nombre";
$result = query($query,"paises");
if (mysql_numrows($result)>1) {
// hay paises
while ($row=mysql_fetch_array($result)) {
$c=($i%2)?"a":"b"; $i++;
$mostrar .= "
\n";
$mostrar .= " | ";
$mostrar .= "";
$mostrar .= htmlentities($row[nombre]);
$mostrar .= " | \n";
$mostrar .= "
\n";
$camino = "Pais
\n";
$nombre = "Paises";
}
} elseif (mysql_numrows($result)==1) {
$pid = mysql_result($result,0,"id");
header ("location: ".$_SERVER["PHP_SELF"]."?pid=$pid");
exit;
} else {
$mostrar = " \n";
$mostrar .= " | No hay paises. | \n";
$mostrar .= "
\n";
}
// nivel 1: estados
} elseif ($pid>0 && $eid==0 && $mid=="" && $cid==0 && $did==0) {
$query = "select * from estados where pais='$pid' and autoriza='1' order by nombre";
$result = query($query,"estados");
if (mysql_numrows($result)>0) {
// hay estados
while ($row=mysql_fetch_array($result)) {
$c=($i%2)?"a":"b"; $i++;
$mostrar .= " \n";
$mostrar .= " | ";
$mostrar .= "";
$mostrar .= htmlentities($row[nombre]);
$mostrar .= " | \n";
$mostrar .= "
\n";
$camino = "Pais : Estados
\n";
$nombre = lee_nombre("paises",$pid);
}
} else {
$camino = "Pais : Estados
\n";
$mostrar = " \n";
$mostrar .= " | No hay estados. | \n";
$mostrar .= "
\n";
}
// nivel 2: municipios/delegaciones
} elseif ($pid>0 && $eid>0 && $mid=="" && $cid==0 && $did==0) {
$query = "select distinct (delegacion) from distribuidores where pais='$pid' and estado='$eid' and autoriza='1' order by delegacion";
$result = query($query,"municipios/del");
if (mysql_numrows($result)>0) {
// hay municipios/delegaciones
while ($row=mysql_fetch_array($result)) {
$c=($i%2)?"a":"b"; $i++;
$mostrar .= " \n";
$mostrar .= " | ";
$mostrar .= "";
$mostrar .= htmlentities($row[delegacion]);
$mostrar .= " | \n";
$mostrar .= "
\n";
$camino = "Pais : Estados : Municipios
\n";
$nombre = lee_nombre("estados",$eid);
}
} else {
$camino = "Pais : Estados : Municipios
\n";
$mostrar = " \n";
$mostrar .= " | No hay municipios/delegaciones. | \n";
$mostrar .= "
\n";
}
// nivel 3: distribuidores
} elseif ($pid>0 && $eid>0 && $mid!="" && $cid==0 && $did==0) {
$query = "select id,nombre,colonia from distribuidores where pais='$pid' and estado='$eid' and delegacion like '%$mid%' and autoriza='1' order by nombre";
$result = query($query,"distribuidores");
if (mysql_numrows($result)>0) {
// hay distribuidores
while ($row=mysql_fetch_array($result)) {
$c=($i%2)?"a":"b"; $i++;
$mostrar .= " \n";
$mostrar .= " | ";
$mostrar .= "";
$mostrar .= htmlentities($row[nombre]);
$mostrar .= " | \n";
$mostrar .= "".htmlentities($row[colonia])." | \n";
$mostrar .= "
\n";
$camino = "Pais : Estados : Municipios : Distribuidores
\n";
$nombre = lee_nombre("estados",$eid);
}
} else {
$camino = "Pais : Estados : Municipios : Distribuidores
\n";
$mostrar = " \n";
$mostrar .= " | No hay distribuidores. | \n";
$mostrar .= "
\n";
}
// nivel 4: distribuidores
} elseif ($did>0) {
$query = "select * from distribuidores where id='$did' and autoriza='1'";
$result = query($query,"distribuidor");
if (mysql_numrows($result)==1) {
$mostrar .= " \n";
$mostrar .= " | Nombre/Razón Social: | \n";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | ".htmlentities(mysql_result($result,0,"nombre"))." | \n";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | Dirección: | \n";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " ".htmlentities(mysql_result($result,0,"calle"))." ";
$mostrar .= htmlentities(mysql_result($result,0,"colonia"))." ";
$mostrar .= htmlentities(mysql_result($result,0,"delegacion")).", ".htmlentities(lee_nombre("estados",mysql_result($result,0,"estado")))." ";
if (mysql_result($result,0,"cp")!="") {
$mostrar .= "C. P. ".mysql_result($result,0,"cp").", ";
}
$mostrar .= htmlentities(lee_nombre("paises",mysql_result($result,0,"pais")));
$mostrar .= " | \n";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | Telélfono(s): | ";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | ".mysql_result($result,0,"tel1");
if (mysql_result($result,0,"tel2")!="") {
$mostrar .= ", ".mysql_result($result,0,"tel2");
}
$mostrar .= " |
\n";
if (mysql_result($result,0,"fax")!="") {
$mostrar .= " \n";
$mostrar .= " | Fax: | ";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | ".mysql_result($result,0,"fax")." | ";
$mostrar .= "
\n";
}
if (mysql_result($result,0,"email")!="") {
$mostrar .= " \n";
$mostrar .= " | E-mail: | ";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | Enviar ahora | ";
$mostrar .= "
\n";
}
if (mysql_result($result,0,"web")!="") {
$mostrar .= " \n";
$mostrar .= " | Web: | ";
$mostrar .= "
\n";
$mostrar .= " \n";
$mostrar .= " | ".mysql_result($result,0,"web")." | ";
$mostrar .= "
\n";
}
$camino = "Pais : Estados : Municipios : Distribuidores : Distribuidor
\n";
$nombre = mysql_result($result,0,"nombre");
} else {
$mostrar = " \n";
$mostrar .= " | Numero de distribuidor inválido. | \n";
$mostrar .= "
\n";
}
}
?>
PANEL TRIDITEC(mr), Distrubuidores
echo $p_style ?>
 |
| include ($include_path."encabezado2.html") ?> |
DISTRIBUIDORES
echo $camino ?>
|
|
|
include ($include_path."encabezado3.html") ?>
|
|
include ($include_path."certificacion.html") ?>
|
|
|
include ($include_path."encabezado1.html") ?>
include ($include_path."menu.html"); ?>
|
| include ($include_path."footer.html") ?> |