Y
Y
yerdnaandrey2020-05-01 21:15:14
PHP
yerdnaandrey, 2020-05-01 21:15:14

How to fix authorization error in php?

I decided to try writing user registration code. My test project consists of 2 files. One is index.html, the other is server1.php.
The essence of the problem is that I send data, but I don’t see it in the database. Help.
index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>test</title>
</head>
<body>
<h1>    Зарегистрируйтесь</h1>
    <form action="server1.php" method="POST">
        <input type="name" name="name" placeholder="name"> <br>
        <input type="text" name="discrition" placeholder="discription"><br>
        <input type="login" name="login" placeholder="login"><br>
        <input type="password" name="pass" placeholder="pass"><br>
        <input type="password" name="pass2"  placeholder="pass2"><br>
        <input type="email" name="email" placeholder="email"><br>
        <input type="submit">
    </form>
</body>
</html>

server1.php:
<?php
$name = $_POST['name'];
$discr = $_POST['discription'];
$login = $_POST['login'];
$email = $_POST['email'];
$pass = $_POST['pass'];

if (iconv_strlen($name) > 30 || iconv_strlen($name) < 1){
    echo "Ваше имя  содержит недопустимое количество символов";
    exit();
} 

if (iconv_strlen($pass) < 7 || iconv_strlen($pass)  > 32){
    echo "Ваш пароль содержит недопустимое количество символов";
    exit();
}

if (iconv_strlen($login) < 7 || iconv_strlen($login)  > 32){
    echo "Ваш пароль содержит недопустимое количество символов";
    exit();
}

$pass = md5($pass.'H7tksUy33sgRod');

$connect_database_1 = new mysqli('localhost', 'root', 'root', 'test1');
$connect_database_1->query("INSERT INTO `users-info` (`login`, `pass`, `discription`, `email`, `name`) VALUES('$login', '$pass', '$discr', $email', '$name')");
$connect_database_1->close();
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-05-01
@yerdnaandrey

error_reporting(E_ALL) and look at the logs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question