Código PHP:
<?php
if (isset($_POST['clave']))
{$clave = "ok"; }
else {$clave = "no esta ok";};
if ($clave == "ok")
{$_SESSION['privada'] = "Bagus";}
else {
echo "</head><body>";
include ("libreria/login.html");
echo "</body></html>"; die();
};
include ('libreria/resto_del_html.php');
?>
Aqui esta el html completo para autentificacion. El action del formulario apunta a si mismo, y hay algo en todo esto que no funciona, porque no valida algo tan simple como una comprobacion de clave.
Código HTML:
<!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" lang="sp" dir="ltr"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Carga de Fotos</title> <link href="libreria/style.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="galeria_privada"> <form action="/subida_v7/subida.php" method="post"> <h3>Escriba su contraseña</h3> <table> <tr> <td> <label>Usuario: <input name="usuario" type="text" value="invitado" /></label> <label>contraseña: <input name="clave" type="text" id="clave" /></label> </td> </tr> </table> <br/> <button type="button" id="ingresar" title="Para ingresar a la Galeria Privada necesitas una clave.">Ingresar</button> </form> </div> </body> </html>