panel.php:
Código PHP:
<link href="estilos.css" rel="stylesheet" type="text/css"> <body bgcolor="#000000">
<table width="20%" border="0">
<tr>
<td height="23" background="fondo_for11.png">
<div align="center"><font color="#FFCC00"><strong>Q
quieres hacer?¿?</strong></font></div></td>
</tr>
<tr>
<td height="5" class="boton23">
<? echo "<form method='get' action='$PHP_SELF' class='formu' ?> "; ?><select name="panel" class="boton2">
<option value="-" selected>-</option>
<option value="nuevo">Nuevo Usuario</option>
<option value="mismopueblo">Mismo pueblo</option>
<option value="login">Login</option>
<option value="edad">Misma edad</option>
</select>
<input name="submit" type="submit" class="boton" value="ELEGIR">
</td> </tr>
</table></form>
<?
$ir=$panel;
if ($panel=="-"){
?><script language="JavaScript">
function cambia(){
window.location.href = 'panel.php';
}
setTimeout("cambia()",500);</script>
<? }else{
switch($ir){
case nuevo: include("nuevo.php"); break;
case mismopueblo: include("buscar_mismopueblo.php"); break;
case login : include("login.php"); break;
case edad : include("buscar_mismaedad.php"); break;
}}
?>
y por ej: buscar_mismopueblo.php
Código PHP:
<link href="estilos.css" rel="stylesheet" type="text/css">
<? echo "<form method='post' action='$PHP_SELF?mismopueblo=mirar&' class='formu' ?> "; ?>
PUEBLO:<input type="text" name="pueblo" class="boton2">
<input type="submit" class="boton" value="Rastrear"></form>
<?
switch($mismopueblo){
case mirar:
$pueblo=$_POST['pueblo'];
if(empty($pueblo)){
echo "<p align='center'><font color='#FFCC00'><strong>Ponga un pueblo</strong></font></p>";
}else{
$host="localhost";
$user="prueba";
$data="pruebas";
$pass="mat";
include ("conexiones/conex1.php");
$link=Conectarse($host,$user,$pass,$data);
$sql = "select * from usuarios_pro1";
$result = mysql_query($sql,$link) or die("Error de la consulta $sql .<br>MySQL dice : ".mysql_error());
while($row = mysql_fetch_array($result)){
if ($row['localidad']==$pueblo){
echo "<p align='center'><font color='#FFCC00'><strong>". $row['nick']."</strong></font></p>";
}else{
echo "<p align='center'><font color='#FFCC00'><strong>No hay nadie con esa localidad</strong></font></p>";}
}
mysql_free_result($result);
mysql_close($link);
}
}
?>