-1
So I made a php system linked to my mysql where there is a table called authme
and it has the login information, such as password, name and other things more when logging in the system not recognize the encrypted password, so if I get the password already the way it is in the databases it enters the system
Example
registered password 12345
gets encrypted $SHA$50fdc0a77d1689bb$ff363f687bc07e7337bb37dfe994f2f90ac84b185e2b6846b588644325a81884
and only enter with the encrypted password
my code
<?php
include("admin/bd/config.php");
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$get = mysqli_query($con,"SELECT * FROM authme WHERE username = '$username' AND password = '$password'");
$num = mysqli_num_rows($get);
if ($num == 1) {
while ($percorrer = mysqli_fetch_array($get)) {
$adm = $percorrer['adm'];
$username = $percorrer['username'];
session_start();
if ($adm == 1) {
$_SESSION['adm'] = $username;
echo '<script type="text/javascript">window.location = "admin/index.php"</script>';
}else{
$_SESSION['nor'] = $username;
echo '<script type="text/javascript">window.location = "index.php"</script>';
}
}
}else{
echo "O email ou a senha está errado";
}
}
?>
What encryption are you using there ?
– Risk
I switched the system to SHA1, but I think I’m writing wrong in the code
– Wicaro