|
Posted by Ewoud Dronkert on 11/10/53 11:16
On 19 May 2005 05:16:22 -0700, Win wrote:
> $yr = "$date_array[year]";
Why im Gotteswillen would you enclose a variable in quotes?! It isn't
going to work this way either: array indexing is not recognized inside
strings with double quotes unless you put the whole thing in curly
braces. Also, the index 'year' really needs quotes, only for legacy
reasons does it still work without (you'll get E_NOTICE errors when
configured). So just use:
$yr = $date_array['year'];
or in a string:
$yr = "The year is {$date_array['year']}.\n";
> $dir = "fullacc"; // full access directory
> $dh = opendir($dir);
opendir() only opens the dir if "fullacc" happens to be a subdir of the
'current directory'. The current directory probably is where your script
lives. (or maybe not if it is included from somewhere else). Better use
full directory names, like: $dir = 'c:/web/html/fullacc' or better yet,
do something like: $dir = $_SERVER['DOCUMENT_ROOT'].'/fullacc';
> while ( gettype($file = readdir($dh)) != "boolean")
I guess it works. However, if readdir() ever returns boolean true,
you're screwed. I don't think it will, though. To be safe, and use
recommended code, say: ($file = readdir($dh)) !== false.
> if ($file == $tfile)
Better use strcmp() when comparing strings, especially when the strings
start with numbers like in your case. See http://php.net/strcmp
> if ($flag == "0")
Again with the quotes. Is flag a text string? No. Just say: $flag == 0.
> touch($tfile);
Here you are attempting to create $tfile in the current dir. You
probably want to prepend the $dir name: touch($dir.'/'.$tfile).
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Navigation:
[Reply to this message]
|