Re: output of fread() is blank - FIXED - updated

From: Date: Tue, 28 Jan 2003 00:45:14 +0000
Subject: Re: output of fread() is blank - FIXED - updated
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133327@lists.php.net to get a copy of this message
In all actuality I will be manipulating the information that is in that file. I'm trying to build a log in script. The id's and passwords are stored in a text file. I'm trying to read that text file so I can compare what the user/viewer had typed in the id and password boxes. I'm so new to PHP I'm taking it in baby steps... Philip Olson wrote: > On Mon, 27 Jan 2003, Guru Geek wrote: > > > Sorry, here is the code now ( I need a nap ) > > > > $filename > > ="/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt"; > > $handle = fopen ($filename, "r"); > > $contents = fread ($handle, filesize ($filename)); > > fclose ($handle); > > echo $contents; > > exit; > > For something like this, just use readfile() and not fread > as it'd be much more efficient if you don't actually manipulate > the string $contents. So: > > readfile($filename); // note: do not use echo > > Also, what is your include_path setting? It's important > you know it and what it means as that'll answer the > question in your last post: > > print ini_get('include_path'); > > http://www.php.net/manual/configuration.directives.php#ini.include-path > > Also, no need for "exit" here as that happens automatically. > > Regards, > Philip

« previous php.general (#133327) next »