NYCPHP Meetup

NYPHP.org

[nycphp-talk] FILE()

Daniel Convissor danielc at analysisandsolutions.com
Tue Oct 24 20:53:43 EDT 2006


Hi Nestor:

On Mon, Oct 23, 2006 at 04:58:59PM -0700, N?stor wrote:
>  $from = $_SERVER['HTTP_REFERER'];
>  print "refer=|" . $_SERVER['HTTP_REFERER'] . "|<br>\n";
>  print "from=|" . $from . "|<br>\n";
> ---
>  refer=|http://maggie.sdcwa.org/eng/project/view_project.phtml|
>  form=|http://maggie.sdcwa.org/eng/project/view_project.phtml|
> 
> The problem is that if I use the code below to read the file then
> $lines is empty.
>  $lines = file("$from");

First, let me say this is a VERY VERY VERY bad idea for security 
reasons.  Never use user input for stuff like that.

Second, from the typos you have above, it is clear your example shown 
here is produced by typing rather than not copying and pasting.  So we 
can't diagnose what's really happening.

Third, putting the quotes around $from in that last line is not 
necessary.

Fourth, it seems like it's actually working because the call to file() 
is not throwing an error, right?  [Or are you going to pull one of 
those "Oh, yeah, I forgot to say, the Check Engine light is on" 
situations that happened on "Car Talk" a few weeks ago?]  Thus if 
$lines is empty, the file is empty.

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list