<html>
<body bgcolor=lightyellow>

<H1 Align=center>Encrypting a Password</h1>

<?php
        error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);            //turn off notices and warnings
        
        $password = "apple";                    //client enters a password. We'll assume 'apple'
        print "The Password is: $password <br>";
        
        $pswdEncrypted = crypt($password);      //entrypt the password
        print "Encrypted is......: $pswdEncrypted <br><br>";
        


        $password = "orange";                   //client enters the password. Perhaps 'orange'
        print "$password <br>";
        
        if (crypt($password, $pswdEncrypted) == $pswdEncrypted)
            print "Password verified! <br><br>";
        else 
            print "Invalid password! <br><br>";



        $password = "apple";                    //client tries again. Now enters 'apple'
        print "$password <br>";
        
        if (crypt($password, $pswdEncrypted) == $pswdEncrypted)
            print "Password verified! <br><br>";
        else 
            print "Invalid password! <br><br>";

?>

<?php include "../include.php"; ?>              <!-- hyperlink to see the code -->
</body>
</html>