I am trying to learn password encryption in PHP
but not quite getting it.
So I am trying to use/implement sha1
encryption in my login form.
As you can see in this code, I used sha1
right next to my if/else condition and just getting an error.
<?php
$accountName = "accountuser";
$accountPass = "accountpass";
session_start();
if(isset($_SESSION['accountName'])) {
echo "<h1>Welcome " .$_SESSION['accountName']."</h1>";
header("Refresh: 3; url=index.php");
include 'login.html';
echo 'Logged in successfuly! <br> Logging in...';
}
else {
if($_POST['username']==$accountName && sha1$_POST['password']==$accountPass){
$_SESSION['$accountName']=$accountName;
header("Refresh: 3; url=index.php");
echo 'Logged in successfuly! <br> Logging in...';
}
else {
include 'login.html';
echo "Wrong username!";
}
}
?>