fork download
  1. <?php
  2. // Procesamiento del formulario
  3. $mensaje = "";
  4.  
  5. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  6. $usuario = $_POST['username'] ?? '';
  7. $contrasena = $_POST['password'] ?? '';
  8.  
  9. // Ejemplo simple de verificación (reemplaza con lógica real de autenticación)
  10. if ($usuario === "admin" && $contrasena === "1234") {
  11. $mensaje = "✅ Bienvenido, $usuario!";
  12. } else {
  13. $mensaje = "❌ Usuario o contraseña incorrectos.";
  14. }
  15. }
  16. ?>
  17.  
  18. <!DOCTYPE html>
  19. <html lang="es">
  20. <head>
  21. <meta charset="UTF-8">
  22. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  23. <title>Login Redondito con PHP</title>
  24. <style>
  25. body {
  26. background: #f0f0f0;
  27. font-family: Arial, sans-serif;
  28. display: flex;
  29. justify-content: center;
  30. align-items: center;
  31. height: 100vh;
  32. margin: 0;
  33. }
  34.  
  35. .login-container {
  36. background: white;
  37. padding: 40px;
  38. border-radius: 20px;
  39. box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  40. width: 300px;
  41. }
  42.  
  43. .login-container h2 {
  44. text-align: center;
  45. margin-bottom: 30px;
  46. color: #333;
  47. }
  48.  
  49. .login-container input[type="text"],
  50. .login-container input[type="password"] {
  51. width: 100%;
  52. padding: 12px;
  53. margin-bottom: 20px;
  54. border: 1px solid #ccc;
  55. border-radius: 30px;
  56. box-sizing: border-box;
  57. }
  58.  
  59. .login-container input[type="submit"] {
  60. width: 100%;
  61. padding: 12px;
  62. border: none;
  63. border-radius: 30px;
  64. background-color: #4CAF50;
  65. color: white;
  66. font-size: 16px;
  67. cursor: pointer;
  68. transition: background-color 0.3s;
  69. }
  70.  
  71. .login-container input[type="submit"]:hover {
  72. background-color: #45a049;
  73. }
  74.  
  75. .mensaje {
  76. text-align: center;
  77. color: #d8000c;
  78. margin-top: 15px;
  79. font-weight: bold;
  80. }
  81.  
  82. .mensaje.correcto {
  83. color: #4CAF50;
  84. }
  85. </style>
  86. </head>
  87. <body>
  88.  
  89. <div class="login-container">
  90. <h2>Iniciar Sesión</h2>
  91. <form method="post" action="">
  92. <input type="text" name="username" placeholder="Usuario" required>
  93. <input type="password" name="password" placeholder="Contraseña" required>
  94. <input type="submit" value="Entrar">
  95. </form>
  96. <?php if ($mensaje): ?>
  97. <div class="mensaje <?= strpos($mensaje, '✅') !== false ? 'correcto' : '' ?>">
  98. <?= htmlspecialchars($mensaje) ?>
  99. </div>
  100. <?php endif; ?>
  101. </div>
  102.  
  103. </body>
  104. </html>
  105.  
Success #stdin #stdout #stderr 0.03s 25928KB
stdin
Standard input is empty
stdout
<!DOCTYPE html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Login Redondito con PHP</title>
  <style>
    body {
      background: #f0f0f0;
      font-family: Arial, sans-serif;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
    }

    .login-container {
      background: white;
      padding: 40px;
      border-radius: 20px;
      box-shadow: 0 10px 25px rgba(0,0,0,0.1);
      width: 300px;
    }

    .login-container h2 {
      text-align: center;
      margin-bottom: 30px;
      color: #333;
    }

    .login-container input[type="text"],
    .login-container input[type="password"] {
      width: 100%;
      padding: 12px;
      margin-bottom: 20px;
      border: 1px solid #ccc;
      border-radius: 30px;
      box-sizing: border-box;
    }

    .login-container input[type="submit"] {
      width: 100%;
      padding: 12px;
      border: none;
      border-radius: 30px;
      background-color: #4CAF50;
      color: white;
      font-size: 16px;
      cursor: pointer;
      transition: background-color 0.3s;
    }

    .login-container input[type="submit"]:hover {
      background-color: #45a049;
    }

    .mensaje {
      text-align: center;
      color: #d8000c;
      margin-top: 15px;
      font-weight: bold;
    }

    .mensaje.correcto {
      color: #4CAF50;
    }
  </style>
</head>
<body>

  <div class="login-container">
    <h2>Iniciar Sesión</h2>
    <form method="post" action="">
      <input type="text" name="username" placeholder="Usuario" required>
      <input type="password" name="password" placeholder="Contraseña" required>
      <input type="submit" value="Entrar">
    </form>
      </div>

</body>
</html>
stderr
PHP Notice:  Undefined index: REQUEST_METHOD in /home/RccGzN/prog.php on line 5