The Frederick Posted October 25, 2007 Share Posted October 25, 2007 I'm making a basic login system, where you register and it writes your username and password to a .dat text file. For the love of me, I can't make it write the info and then move to the next line for the next registration. Here's my code: <?php $file1 = fopen("users.dat", "r+"); if ($file1) { $found = 0; $id = 1; while (!feof($file1)){ $row = fgets ($file1, 1024); $parts = preg_split ("/::/", $row); if ($parts[0] == $_POST){ $found = 1; } } //end for if ($found == 1){ echo "Email address already registed. Please try another another email address"; } else{ $file2 = fopen("userid.dat", "r"); $id = fgets ($file2, 1024); $id += 11; fclose ($file2); $file2 = fopen("userid.dat", "w"); fwrite($file2, $id); fclose ($file2); echo "New account created."; $newaccount = $_POST."::".$id."::".$_POST[newpassword]."\n"; fwrite($file1, $newaccount); } fclose ($file1); } // end of if statement ?> That "\n" seems to be completely useless. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/74701-basic-php-login-system-help/ Share on other sites More sharing options...
LemonInflux Posted October 25, 2007 Share Posted October 25, 2007 try \r\n Quote Link to comment https://forums.phpfreaks.com/topic/74701-basic-php-login-system-help/#findComment-377653 Share on other sites More sharing options...
The Frederick Posted October 25, 2007 Author Share Posted October 25, 2007 Didn't work. Quote Link to comment https://forums.phpfreaks.com/topic/74701-basic-php-login-system-help/#findComment-377764 Share on other sites More sharing options...
The Frederick Posted October 26, 2007 Author Share Posted October 26, 2007 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/74701-basic-php-login-system-help/#findComment-378305 Share on other sites More sharing options...
greatstar00 Posted October 26, 2007 Share Posted October 26, 2007 that \n does not work when u open with notepad when i open with dreamweaver, it works then i save again with dreamweaver Quote Link to comment https://forums.phpfreaks.com/topic/74701-basic-php-login-system-help/#findComment-378307 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.