Answer the question
In order to leave comments, you need to log in
Why is the password not stored in the database?
Only the password is not entered into the mysql database, everything else is entered normally
$username = trim(filter_var($_POST['username'], FILTER_SANITIZE_STRING));
$email = trim(filter_var($_POST['email'], FILTER_SANITIZE_EMAIL));
$login = trim(filter_var($_POST['login'], FILTER_SANITIZE_STRING));
$password = trim(filter_var($_POST['password'], FILTER_SANITIZE_STRING));
$error = '';
if(strlen($username) <= 3){
$error = 'Введите имя';
}else if(strlen($email) <= 3){
$error = 'Введите емейл';
}else if(strlen($login) <= 5){
$error = 'Введите логин';
}else if(strlen($password) < 8){
$error = 'Введите пароль';
}
if ($error != '') {
echo $error;
exit;
}
$hash = "3h#%89*H#($h%!~fh";
$password = md5($password);
require "../sqlconnect.php"; #Подключение к бд через pdo
$sql = 'INSERT INTO `userinfo` (`name`, `email`, `login`, `password`) VALUES(?,?,?,?)';
$query = $pdo->prepare($sql);
$query->execute([$username, $email, $login, $password]);
echo 'Готово';
Answer the question
In order to leave comments, you need to log in
require "../sqlconnect.php"; #Подключение к бд через pdo
$username = trim(filter_var($_POST['username'], FILTER_SANITIZE_STRING));
$email = trim(filter_var($_POST['email'], FILTER_SANITIZE_EMAIL));
$login = trim(filter_var($_POST['login'], FILTER_SANITIZE_STRING));
$password = trim(filter_var($_POST['password'], FILTER_SANITIZE_STRING));
$error = '';
if(strlen($username) <= 3){
$error = 'Введите имя';
}else if(strlen($email) <= 3){
$error = 'Введите емейл';
}else if(strlen($login) <= 5){
$error = 'Введите логин';
}else if(strlen($password) < 8){
$error = 'Введите пароль';
}
if ($error != '') {
echo $error;
exit;
}
$hash = "3h#%89*H#($h%!~fh";
$password = md5($password);
$sql = 'INSERT INTO `userinfo` (`name`, `email`, `login`, `password`) VALUES(?,?,?,?)';
$query = $pdo->prepare($sql);
$query->execute([$username, $email, $login, $password]);
echo 'Готово';
require "../sqlconnect.php";
$password = '';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question