In short, I did one thing and decided that I did not want to use the database, but try to do everything through files. So here. I did the registration to the file, checking everything that is necessary, everything is as it should be. But the problem with the entrance. The structure of the file with user data is as follows:
|-ник-пароль
So here. Trying to parse through a bunch of explod and foreach, here’s what comes out:
<?php session_start(); $_SESSION['lcnick']=stripslashes($_POST['nick']); $r=file_get_contents('users.dat'); $rr=explode('|',$r); foreach ($rr as $v1) { $rrr=explode('-',$v1); if ($rrr['0']==$_SESSION['lcnick'] && $rrr['1']==$_POST['pass']) { $_SESSION['cnick']=$_SESSION['lcnick']; header('index.php'); } } ?>
cnick is the user's primary nickname, lcnick is a temporary nickname variable. In short, after a painful debug, I found out that password parsing from a file by the second attribute does not work ("|" is the first sign - this is how the account itself (-nik-password) is parsed, then the second sign goes - "-", this is the zero index ( Nick) and the first (Password). So the password does not want to fall into the array. If someone understands, can you help?