Answer the question
In order to leave comments, you need to log in
What type of authorization is more secure?
Task: creating a secure authorization for just one user.
1. Create a table in the database with a username and password
2. Create a check like 'if (text== "text")' with the specified password and username in the check file itself
So which is better to choose?
Answer the question
In order to leave comments, you need to log in
1. If there is only one user and no one can access the php code, you can do so.
2. But in other cases, I would suggest the second option.
In general, it is better not to place any critical information in php files.
If you create to a file, then try the following code:
<form method="post" action="check.php">
Ваш логин: <input type="text" name="user">
Ваш пароль: <input type="password" name="pass">
Ваш соль: <input type="text" name="salt">
<input type="submit">
</form>
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
$salt = $_POST['salt'];
$hash = file_get_contents('ZmlsZQ==.dat');
if(md5($user).md5(md5($pass)).md5(sha1(base64_encode($salt))) == $hash){
....
}else{
die('Hacking Attempt');
usleep(2);
header("Location: http://tebe.dostupa.net");
}
?>
'if (text=== "text")
is enough in php. just hash with good algorithms (not md5)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question