📄 basic05.php

En la versión pública del portfolio los ejercicios PHP se muestran como código y no se ejecutan. ⬅ Volver

<?php
if (isset($_GET["user"]) && isset($_GET["password"])) {
    
$user = strtolower($_GET["user"]);
    
$password = strtolower($_GET["password"]);

    
$isValid = true;
    
$vocales = ["a", "e", "i", "o", "u"];

    foreach (
$vocales as $vocal) {
        if (
strpos($user, $vocal) !== false && strpos($password, $vocal) !== false) {
            
$isValid = false;
            break;
        }
    }

    if (
$isValid) {
        echo 
"<h1>Welcome, " . htmlspecialchars($_GET['user']) . "</h1>";
        echo 
'<p>Click the link below to download your file:</p>';
        echo 
'<a href="img_avatar4.png" download>Download Image</a>';
    } else {
        echo 
"User os pass incorrect...";
    }
} else {
    echo 
"Please provide user and password parameters in the URL.";
}
?>

<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/6/w3.css">

<body>

    <div class="w3-container">
        <h2>W3.CSS Login Modal</h2>

        <button onclick="document.getElementById('id01').style.display='block'" class="w3-button w3-green w3-large">Login</button>

        <div id="id01" class="w3-modal">
            <div class="w3-modal-content w3-card-4 w3-animate-zoom" style="max-width:600px">

                <div class="w3-center"><br>
                    <span onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-xlarge w3-transparent w3-display-topright" title="Close Modal">×</span>
                    <img src="img_avatar4.png" alt="Avatar" style="width:30%" class="w3-circle w3-margin-top">
                </div>

                <form class="w3-container" action="">
                    <div class="w3-section">
                        <label><b>Username</b></label>
                        <input class="w3-input w3-border w3-margin-bottom" type="text" placeholder="Enter Username" name="user" required>
                        <label><b>Password</b></label>
                        <input class="w3-input w3-border" type="text" placeholder="Enter Password" name="password" required>
                        <button class="w3-button w3-block w3-green w3-section w3-padding" type="submit">Login</button>
                        <input class="w3-check w3-margin-top" type="checkbox" checked="checked"> Remember me
                    </div>
                </form>

                <div class="w3-container w3-border-top w3-padding-16 w3-light-grey">
                    <button onclick="document.getElementById('id01').style.display='none'" type="button" class="w3-button w3-red">Cancel</button>
                    <span class="w3-right w3-padding w3-hide-small">Forgot <a href="#">password?</a></span>
                </div>

            </div>
        </div>
    </div>

</body>

</html>