-
This is a sloppy work around but... put the text file in another directory by itself then link the directory addressed in this with that directory then load this page once and it should set it.
PHP Code:
<?php
$dir = '/change me change me change me/';
$d = dir($dir);
while(FALSE !== ($entry = $d->read()))
{
if($entry != '.' && $entry != '..')
{
// get the file permissions
$perms = substr(sprintf('%o', fileperms($dir.$entry)), -4);
if($perms !== '0777')
{
if(chmod($dir.$entry, 0777)===TRUE)
{
//WORKED DID CHANGE
echo "Your textfile should be writeable now YAY!";
}
else
{
//ERROR DIDN'T CHANGE
echo "Chris messed up.";
}
}
}
}
?>
-
Make sure the directory you have guestbook.php also 777.
-
Ok So I made file permission.php with the code you gave me. I link the dir with txt/guestbook.txt
When I go to the permission.php file I get these errors
Warning: dir(txt/guestbook.txt) [function.dir]: failed to open dir: No error in D:\Hosting\3030954\html\HeadFirstGraphics\ourwedding\Chrisguestbook\permission.php on line 6
Fatal error: Call to a member function read() on a non-object in D:\Hosting\3030954\html\HeadFirstGraphics\ourwedding\Chrisguestbook\permission.php on line 7
The directory has all permissions.
also i put this code that you gave me at the beginning in guests.php
PHP Code:
<div style="width:650px; height:425px; overflow:auto; border:1px solid #000000;">
<?php
$myFile = "txt/guestbook.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 20000000);
fclose($fh);
$notesout = str_replace("\r", "<br/>", $theData); echo $notesout;
?>
</div>
But it no file references guests.php...I assume some file is made to open this code...could this be a problem?
Thanks
Will
-
wanna send me your ftp info on facebook and I'll see if I can get it working i'm kinda confused with everything you just sent. or aim/ichat me I'm at zzzzwannnnn