This is how i would code the registration or login from a websites system.
This is a really good encryption, and i personally use it for every project i do. Though, i recommend you to add some characters in if you want to use it for another project than World of Warcraft.
Line: 11
Encryption starts there, it allows people to use the same password to login to WoW.
Back in the day i always used MD5 to encrypt passwords. I figured it's really insecure unless you're like MyBB and "salt" the encryption.
(And yes, you guessed right! This is from my CMS.) :)
This is a really good encryption, and i personally use it for every project i do. Though, i recommend you to add some characters in if you want to use it for another project than World of Warcraft.
Code:
if($_POST['password'] == $_POST['password2']) {
$exp="2";
$adminlevel="0";
$email=$_POST['email'];
$password=strtoupper($_POST['password']);
$username=strtoupper($_POST['username']);
$email=strtoupper($_POST['email']);
$username=$conn->real_escape_string($username);
$password=$conn->real_escape_string($password);
$email=$conn->real_escape_string($email);
$password2=sha1($username . ":" . $password);
$stmt = $conn->prepare("INSERT INTO account (username, sha_pass_hash, email, web_admin, expansion) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("ssssi", $username, $password2, $email, $adminlevel, $exp);
if($stmt->execute()) {
header("Location: ../");
}else{
echo "Failed to create account<br>" . $stmt->error;
}
}
Line: 11
Encryption starts there, it allows people to use the same password to login to WoW.
Code:
$password2=sha1($username . ":" . $password);
Back in the day i always used MD5 to encrypt passwords. I figured it's really insecure unless you're like MyBB and "salt" the encryption.
(And yes, you guessed right! This is from my CMS.) :)