Created
June 15, 2012 12:27
-
-
Save antena72/2936222 to your computer and use it in GitHub Desktop.
php login formulario
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| session_start(); | |
| $errorMessage = ''; | |
| if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) { | |
| if ($_POST['txtUserId'] === 'usuario' && $_POST['txtPassword'] === 'clave') { | |
| // the user id and password match, | |
| // set the session | |
| $_SESSION['basic_is_logged_in'] = true; | |
| // after login we move to the main page | |
| header('Location: index.php'); | |
| exit; | |
| } else { | |
| $errorMessage = 'Alguno de los datos es incorrecto, por favor vuelta a intentar'; | |
| } | |
| } | |
| ?> | |
| <html> | |
| <head> | |
| <titleLogin</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
| <style type="text/css"> | |
| <!-- | |
| p { font-size: 11px; text-transform: uppercase; | |
| } | |
| body { | |
| background: url(../imag/pantalla_southern.gif) repeat; | |
| } | |
| #login { | |
| padding: 0px; | |
| margin: 100px auto; | |
| background-color: #666; | |
| } | |
| #login p {padding: 0px; margin: 10px; font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#FFF;} | |
| --> | |
| </style> | |
| <title>Santa Inés - Login</title> | |
| </head> | |
| <body> | |
| <div id="login"> | |
| <?php | |
| if ($errorMessage != '') { | |
| ?> | |
| <p align="center" top=20><strong><font color="#990000"><?php echo $errorMessage; ?></font></strong></p> | |
| <?php | |
| } | |
| ?> | |
| <form action="" method="post" name="frmLogin" id="frmLogin"> | |
| <table border="0" align="center" cellpadding="2" cellspacing="5"> | |
| <tr> | |
| <td><img src="../../imag/escudo.png" width="103" height="90"></td> | |
| <td width="70"><table><tr><td><p align="right" class="blanco">usuario</p></td> | |
| <td width="204"><input name="txtUserId" type="text" id="txtUserId"></td> | |
| </tr> | |
| <tr> | |
| <td width="70"><p align="right">clave</p></td> | |
| <td><input name="txtPassword" type="password" id="txtPassword"></td> | |
| </tr> | |
| <tr> | |
| <td width="70"> </td> | |
| <td><input name="btnLogin" type="submit" id="btnLogin" value="Login"></td> | |
| </tr> | |
| </table></td></tr></table> | |
| </form> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment