clonetrooper9494 Posted November 23, 2007 Share Posted November 23, 2007 I am reading the tutorial at Tizag ( http://www.tizag.com/phpT/fileread.php ) but when it reads it can olny red from the top of the page. I am trying to have it get all of the data on one line, but it doesn't say anything about that. There would be a file named 'someusername_accountinfo.txt' and on that page would be there email on the first line, there would be their address on the second, and their password on the third. but in order to get the password to check it when they login, it would have a bunch of junk before it. Is there any way to trim that stuff off, while its in the variable, or some how jump lines using fread() function? I could make a file called 'someusername_accountinfo_password.txt' and 'someusername_accountinfo_email.txt' and have apage for each chunk of data I need to store, but would that take up more space?Basiclly, two questions... how to make fread jump lines, then read. and also does making multiple files take up more space other than the name? Link to comment Share on other sites More sharing options...
Ingolme Posted November 23, 2007 Share Posted November 23, 2007 Rather than fread() I like the file() function.it will return an array, each line in one of the array values:file.txt:This is some textwith a line breakSome PHP:$f = file("file.txt");echo $f[0]; // Outputs "This is some text"echo $f[1]; // Outputs "with a line break" Link to comment Share on other sites More sharing options...
clonetrooper9494 Posted November 23, 2007 Author Share Posted November 23, 2007 Thanks Ingolme, all of this info will be usefull later on, along with saving me a huge confusing mess of files!And do I need to open the file first using fopen()? Link to comment Share on other sites More sharing options...
Ingolme Posted November 23, 2007 Share Posted November 23, 2007 No, I'm pretty sure you don't need fopen(), but I don't remember perfectly. Link to comment Share on other sites More sharing options...
Synook Posted November 24, 2007 Share Posted November 24, 2007 You don't. file(), file_get_contents() and file_put_contents() are all functions that automate the streaming process. Link to comment Share on other sites More sharing options...
clonetrooper9494 Posted November 27, 2007 Author Share Posted November 27, 2007 I found a good source for most of my problems...http://www.w3schools.com/php/php_ref_filesystem.aspAlthough it does not sovle this one problem...I need a page to be deleted after a certain amount of time with out any page being visited... I am making a new topic becuase this problem will be a long post and I don't want this topic to go off topic. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.