[solved] Question about chmod
Posted: Fri Mar 10, 2006 2:53 pm
Okay I want to make a log file as everyone logs on, the problem is that I ahven't dealt with chmod much. I am planning on hiding access to the file using .htlogfile.txt here
The problem is that it gives me errors of
Warning: fopen(.htmytextfile.txt): failed to open stream: Permission denied in /Users/bsucs/Sites/login.php on line 29
Warning: flock(): supplied argument is not a valid stream resource in /Users/bsucs/Sites/login.php on line 31
Can't Logon' !
Warning: fclose(): supplied argument is not a valid stream resource in /Users/bsucs/Sites/login.php on line 39
Warning: Cannot modify header information - headers already sent by (output started at /Users/bsucs/Sites/login.php:29) in /Users/bsucs/Sites/login.php on line 50
I am pretty sure these are caused by chmod. How can I change hte chmod to what I want it to be through the php? I went here http://us3.php.net/chmodbut I am not sure what to do cause I do not ever use this chmod stuff.
I got some help, thanks
Code: Select all
//Logfile
$file = fopen(".htmytextfile.txt","a");
if (flock($file, LOCK_EX)){ // do an exclusive lock
fwrite($file, "Write something here\n");
flock($file, LOCK_UN); // release the lock
} else {
echo "Can't Logon' !";
}
fclose($file);
//Logfile is basically what I want to do.Warning: fopen(.htmytextfile.txt): failed to open stream: Permission denied in /Users/bsucs/Sites/login.php on line 29
Warning: flock(): supplied argument is not a valid stream resource in /Users/bsucs/Sites/login.php on line 31
Can't Logon' !
Warning: fclose(): supplied argument is not a valid stream resource in /Users/bsucs/Sites/login.php on line 39
Warning: Cannot modify header information - headers already sent by (output started at /Users/bsucs/Sites/login.php:29) in /Users/bsucs/Sites/login.php on line 50
I am pretty sure these are caused by chmod. How can I change hte chmod to what I want it to be through the php? I went here http://us3.php.net/chmodbut I am not sure what to do cause I do not ever use this chmod stuff.
I got some help, thanks