So I have simple registration form that write user and password in file.txt. When 1 line in the file has already user and password every next registration is on same line and in the same time put empty next line.
If the file is empty is writing properly, every registration is on new line. Here is the code that i use:
if(!$error) {
$input = $username . '|' . $pass ."\n";
file_put_contents('users/file.txt', $input, FILE_APPEND);
mkdir('users/'. $username);
header('Location: index.php');
exit;
}
p.s. I'm sorry for my English.