
04/02/2010, 08:13
|
| | Fecha de Ingreso: febrero-2010
Mensajes: 10
Antigüedad: 15 años Puntos: 0 | |
Respuesta: Problemas con variables $_POST en XAMPP + PHP 5.3.1 Ahí va el código de dos archivos que he probado: PRUEBA ARCHIVO 1:
Código:
<?PHP
// Iniciar sesion
session_start();
// Si se ha enviado el formulario
if ($HTTP_POST_VARS) {
$clave = strip_tags($_POST["Password"]);
$usuario = strip_tags($_POST["User"]);
// Comprobar que el usuario est� autorizado a entrar
require("db_connect.php");
$salt = substr ($usuario, 0, 2);
$clave_crypt = crypt ($clave, $salt);
$instruccion = "select usuario, clave from usuario where usuario = '$usuario'" .
" and clave = '$clave_crypt'";
$consulta = mysql_query ($instruccion, $conexion)
or die ("Fallo en la consulta");
$nfilas = mysql_num_rows ($consulta);
mysql_close ($conexion);
// Los datos introducidos son correctos
if ($nfilas > 0)
{
$usuario_valido = $usuario;
session_register ("usuario_valido");
print ("<script>javascript:window.location='gestion.php'</script>");
}
} else {
?>
<!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" />
<link rel="stylesheet" href="../css/admin_styles.css" type="text/css" />
<title>- [GESTOR DE MANTENIMIENTO] - Producciones Bajo Tierra</title>
</head>
<body>
<div id="login_Form">
<h1>Prod. Bajo<span> Tierra</span></h1>
<div id="tag">Admin-site, desarrollado por <a href="mailto:[email protected]">disenium</a></div>
<table>
<form action="index.php" method="post" name="Login" id="Login">
<tr><td>User: </td><td align="right"><input name="User" type="text" id="User" maxlength="60"></td></tr>
<tr><td>Password: </td><td align="right"><input name="Password" type="password" id="Password" maxlength="60"></td></tr>
</table>
<p><INPUT type="submit" VALUE="Entrar" id="entrar"></p>
</form>
</div>
</body>
</html>
<?php
}
?>
PRUEBA ARCHIVO 2:
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
echo $_POST['entrar'];
if ($_POST['entrar']=="prueba") {
echo "correcto";
}else{
echo "incorrecto";
}
?>
<form id="form1" action="prueba.php" method="post">
<input type="text" id="nombre"></input>
<input type="submit" value="prueba" id="entrar"></input>
</form>
</body>
</html>
|