Y
Y
yerdnaandrey2020-09-27 13:31:52
PHP
yerdnaandrey, 2020-09-27 13:31:52

How to fix an error in the authorization file?

Where is the mistake? Please explain, I'm dumb.

<?php 



    $host = "localhost";
    $admin = "root";
    $password = "root";
    $database = "bigrtm";

    $login = $_POST['login'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $psw = $_POST['psw'];
    $tpwd = $_POST['tpwd'];
    $info = $_POST['info'];


?>




<?php 

if (strlen($login) > 80){
    die();
} 

if (strlen($login) < 7){
    die();
} 

if (strlen($name) > 50){
    die();
} 

if (strlen($name) < 3){
    die();
} 
if (strlen($email) > 400){

    die();
} 

if (strlen($email) < 5){
    die();
} 

if (strlen($psw) > 32){
    die();
} 

if (strlen($tpwd) > 32){
    die(); 
} 

if (strlen($info) > 1000){
    die();
} 

if ($psw != $tpwd ){
    die();
}
?>

<?php 
    $hash_md = md5($psw);
    $date_r = date("Y года, M d, в H:i");
    $date_int = date("YmdHis");
    $cnnect_database0 = new mysqli($host, $admin, $password, $database);
    $query_database0 = $cnnect_database0->query("INSERT INTO `users` (`login`, `name`, `email`, `password`, `info`, `date`, ) VALUES('$login', '$name', '$email', '$hash_md', '$info') ");
?>


<?php 

mysqli_connect_error();

setcookie('login', $login, time() + 3600 * 24 * 30, "/");
setcookie('name', $name, time() + 3600 * 24 * 30, "/");
setcookie('pass', $psw, time() + 3600 * 24 * 30, "/");
?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2020-09-27
@FanatPHP

type the text of the error in the browser and get about a million responses

K
kosuha, 2020-09-28
@kosuha

Apparently you are trying to set cookie headers at the moment when the server response body has already been formed and, accordingly, the headers have also already been formed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question