i couldnt find out what is wrong with this script ,
can anbody explain
$ip=fopen(ip.txt, 'r+');
$adam=fread($ip,filesize($adam));
fclose($ip);
if(stristr($adam,$_SERVER[REMOTE_ADDR]))
echo an entry submitted from this ip already;
else
{
..
//block 1
..
}
the ip.txt
10.8.0.21 10.8.5.21 10.8.7.21
Your problem is with this line:
$adam=fread($ip,filesize($adam));
Remember that $adam is not a file pointer, but text
read from a file. The file pointer is $ip, so the line
should read:
$adam=fread($ip,filesize($ip));
(and should probably be contained within an if
statement for error
thanks,
it was very silly mistake,
but it doesnt work,
there in nothing wrong with if statement,
moreover,
?php
$ip=fopen(ip.txt, 'r+');
$k=filesize($ip);
$adam=fread($ip);
fclose($ip);
echo $adam;
?
i think there is something wrong with fread, is there another way to reading
a file, and return
sorry the code was
?php
$ip=fopen(ip.txt, 'r+');
$k=filesize($ip);
$adam=fread($ip,$k);
fclose($ip);
echo $adam;
?
that doesnt work.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
but it doesnt work,
You sure? It should be that you were trying to get the
sizeof() $adam, which was thus far 0 bytes. So, of
course, it would return 0 bytes to $adam, and your
strstr() of looking for the IP address wouldn't work,
since $adam would contain nothing. Try print()ing
$adam to see
i solved problem, -not a good solution-
i changed only
$adam=fread($ip,filesize($ip));
to
$adam=fread($ip,1024);
i dont understand what is wrong with filesize($ip) . i got this from php.net
and i thought it was valid.
link:
http://www.php.net/manual/en/function.fread.php
quote:
?php
// get
On Wed, 11 Dec 2002, Mekrand wrote:
i solved problem, -not a good solution-
i changed only
$adam=fread($ip,filesize($ip));
You have:
$string = fread( $fileHandle, filesize( $fileHandle ) );
The example at php.net you looked at has:
$string = fread( $fileHandle, filesize( $fileName ) );
Just
yes you are right, im very pensive today, :)
thanks chris and mako
Chris Wesley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Wed, 11 Dec 2002, Mekrand wrote:
i solved problem, -not a good solution-
i changed only
$adam=fread($ip,filesize($ip));
You
8 matches
Mail list logo