Advertisement
Guest User

login.php

a guest
Aug 14th, 2013
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <head>
  4.     <meta charset="utf-8">
  5.     <title>Contacto</title>
  6.     <style>
  7.         .error{
  8.             color:red;
  9.             font-weight: bold;
  10.         }
  11.         .ok{
  12.             color:green;
  13.             font-weight: bold;
  14.         }
  15.     </style>
  16. </head>
  17. <?php
  18.     if(isset($_POST['submit'])){
  19.         if(!empty($_POST['name']) && !empty($_POST['pass'])){
  20.             $nombre=$_POST['name'];
  21.             $password=$_POST['pass'];
  22.             if($nombre=="arthusu" && $password=="12345"){
  23.             echo '<h1>Bienvenido al sistema de logs</h1>';
  24.             $file = fopen("logs.txt", "r") or exit("no se pudo abrir el archivo!");
  25.             while(!feof($file))
  26.             {
  27.             echo fgets($file). "<br />";
  28.             }
  29.             fclose($file);
  30.             }else{
  31.                 echo '<p class="error">El usuario o contraseña no son correctos.</p>';
  32.             }
  33.         }else{
  34.             echo '<p class="error">No ha llenado los campos correctamente.</p>';
  35.         }
  36.     }else{
  37. ?>
  38. <body>
  39.     <center>
  40.     <h1>Sistema de registros - Iniciar sesion</h1>
  41.     <form action="login.php" method="post">
  42.         <p>nombre: <input type="text" name="name" size="15" maxlength="40"></p>
  43.         <p>contraseña: <input type="password" name="pass" size="15" maxlength="80"></p>
  44.         <p><input type="submit" value="Enviar" name="submit"></p>
  45.     </form>
  46.     </center>
  47. </body>
  48. </html>
  49. <?php
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement