Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/01/2012, 01:33
Avatar de interjsr
interjsr
 
Fecha de Ingreso: octubre-2011
Ubicación: Madrid
Mensajes: 81
Antigüedad: 13 años, 4 meses
Puntos: 2
Formulario y PHP

Buenas. Tengo un Autorizacion.php con un Formulario(Action: "Valida.php", Methopd:"Post" y OnSubmit:"Función de este fichero"): Usuario, Contraseña y Boton Submit.

En Valida.php el codigo que valida contra mysql si existe o no.
Si existe:
header ("Location: aplicacion.php"); En este se escribe Correcto
Si usuario no es válido:
header ("Location: aplicacion2.php"); En este se escribe ¡No Correcto!.

El problema es que cuando pulso el boton no hace nada de nada. En el browser pone que Valida.php en vez de Autorización.php pero no hace nada. La conexión es correcta, las contraseñas también, la BBDD existe y la Tabla con datos. Lo hago con Vertigro y está arrancado. Alguien puede echarme una mano???????
---------------------------
Autorizacion.php
<html>
<head>
<title> jaksjajs</title>
</head>
<body>
<div>
Esta página requiere que sea miembro de la Escuela Infantil Duendes. Si lo es introduzca el Usuario y Contraseña que se le han dado para
este fin.
</div>
<form method="post" action="Valida.php" enctype="multipart/form-data" onsubmit="Validacion();">
<Table>
<Tr>
<td>
Usuario:
</td>
<td>
<INPUT TYPE = "TEXT" NAME = "Usuario" SIZE ="12">
</td>
</Tr>
<Tr>
<td>
Contraseña:
</td>
<td>
<INPUT TYPE = "PASSWORD" NAME = "Clave" SIZE ="12">
</td>
</Tr>
<tr>
<td>
<BUTTON NAME = "ENVIAR" TYPE = "SUBMIT">
<B> <FONT SIZE = "2"> Validar </FONT> </B>
</BUTTON>
</td>
</tr>
</Table>
</form>
</body>
</html>
----------------------------------------------------------
Valida.php

<?php

function Validacion()
{
echo "PINTO ALGO";
$conn = mysql_connect("localhost","root","vertrigo");
//selecciono la BBDD
mysql_select_db("BBDDInventada",$conn);

$Usuario = $_POST['Usuario'];
$Clave = $_POST['Clave'];
$ssql = "SELECT * FROM Usuarios WHERE Usuario='$Usuario' and Clave='$Clave'";

$rs = mysql_query($ssql,$conn);

if (mysql_num_rows($rs)!=0){

session_start();
session_register("autentificado");
$autentificado = "SI";

header ("Location: aplicacion.php");
}else {
header("Location: aplicacion2.php");
}
mysql_free_result($rs);
mysql_close($conn);
}

?>
---------------------------------------
aplicacion.php

<html>
<head>
<title>
titulo
</title>
</head>
<body>
correcto
</body>
</html>


--------------------------
aplicaion2.php
<html>
<head>
<title>
titulo
</title>
</head>
<body>
No es correcto
</body>
</html>