What's new

Help Password verification no database PHP

Status
Not open for further replies.
paps ano mali dito sa code ko?

Code:
<?php

if (isset($_POST['submit'])) {
    if (!isset($_SESSION['attempts'])) {
        $_SESSION['attempts'] = 0;
    }
    if ($_SESSION['attempts'] == 3) {
        echo "SORRY WRONG Password, GOODBYE!";
    }else{
        $pass = $_POST['pass'];
        if (strtolower($pass) == 'admin') {
            echo "HELLO MY NAME IS KRISTAN MARKO CRISOSTOMO, I'M THE PROGRAMMER";
        }else{
            $_SESSION['attempts']++;
            $reattempt =3 - $_SESSION['attempts'];
            echo "Wrong Password, number of attempts left: ".$reattempt;
        }
    }
    
}

?>
 
<?php
if (isset($_POST['submit'])) {
if (!isset($_SESSION['attempts'])) {
$_SESSION['attempts'] = 3;
}
if ($_SESSION['attempts'] == 0) {
echo "SORRY WRONG Password, GOODBYE!";
}else{
$pass = $_POST['pass'];
if (strtolower($pass) == 'admin') {
echo "HELLO MY NAME IS KRISTAN MARKO CRISOSTOMO, I'M THE PROGRAMMER";
}else{
$_SESSION['attempts'] = $_SESSION['attempts'] - 1;
$reattempt = $_SESSION['attempts'];
echo "Wrong Password, number of attempts left: ".$reattempt;
}
}

}
?>

yan na code
 
[XX='KristanC, c: 424096, m: 543021'][/XX] oo

isa pa nga pala pag gagamit ka ng session dapat start mo muna yun ganito

session_start();

sa 2nd line pagkatapos ng <?php
 
Status
Not open for further replies.

Similar threads

Back
Top