Click to See Complete Forum and Search --> : i get this....


lukezweb
12-06-2003, 05:22 AM
Warning: fopen(guestbook.txt): failed to open stream: Permission denied in /home/lukezweb/public_html/php/messagebox/index.php on line 18

Warning: flock(): supplied argument is not a valid stream resource in /home/lukezweb/public_html/php/messagebox/index.php on line 19

Warning: fwrite(): supplied argument is not a valid stream resource in /home/lukezweb/public_html/php/messagebox/index.php on line 20

Warning: flock(): supplied argument is not a valid stream resource in /home/lukezweb/public_html/php/messagebox/index.php on line 21

Warning: fclose(): supplied argument is not a valid stream resource in /home/lukezweb/public_html/php/messagebox/index.php on line 22



with this...

<?PHP
$filename = "guestbook.txt";
$text = "";
if (isset($_POST["submit"])) {
$name = htmlspecialchars(stripslashes($_POST["name"]));
$message = htmlspecialchars(stripslashes($_POST["message"]));
if (!empty($name) && !empty($message)) {
$message = explode(" ", $message);
$splitmessage = "";
foreach ($message as $word) {
$splitmessage .= wordwrap($word, 50, " ", 1)." ";
}
$message = $splitmessage;
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$value = $message."<br>\n<span style=\"font-family: verdana, arial, sans-serif; font-size: 70%; font-weight: bold;\">Posted by $name at $time on $date.</span>\n<break>\n";
$fp = fopen ($filename, "a");
flock ($fp, LOCK_EX);
fwrite ($fp, $value);
flock ($fp, LOCK_UN);
fclose ($fp);
}
else {
$error = "Please enter your name and a message.";
}
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Guestbook</title>
</head>

<body>
<?PHP
if (isset($error)) {
echo "<p style=\"color: #f00; background: transparent;\">$error</p>";
}
?>
<form action="<?PHP echo $_SERVER["PHP_SELF"]; ?>" method="post">
<p>Your Message:<br>
<textarea name="message" rows="7" cols="50"><?PHP if (isset($message)) { echo $message; } ?></text><br>
Your Name: <input type="text" name="name" <?PHP if (isset($name)) { echo "value=\"$name\""; } ?>>
<input type="submit" name="submit" value="submit"></p>
</form>

<?PHP

$contents = @file($filename) or die("No files in guestbook.");

foreach ($contents as $line) {
$text .= $line;
}

$text = split("<break>", $text);
$text = array_reverse($text);
for ($i=0; $i<count($text)-1; $i++) {
echo "<div style=\"border: gray 1px solid; padding: 5px; font-family: arial, sans-serif; background-color: #eeeeee;\">";
echo $text[$i];
echo "</div>";
}

?>
</body>
</html>

DanUK
12-06-2003, 06:24 AM
Try chmod'ing the file.
If you're on a unix-based server, type "man chmod".

lukezweb
12-06-2003, 06:48 AM
Originally posted by skydan
Try chmod'ing the file.
If you're on a unix-based server, type "man chmod".


its a Linux Cpanel??

pyro
12-06-2003, 09:19 AM
Do you have a FTP program? If so, that's probably the easiest way to CHMOD a file/dir.

lukezweb
12-06-2003, 09:28 AM
Originally posted by pyro
Do you have a FTP program? If so, that's probably the easiest way to CHMOD a file/dir.


yes :) how do i do that?

pyro
12-06-2003, 09:57 AM
Depends what FTP program you have. I have WS_FTP Pro 7, and in that, you right click on the file -> Operations -> FTP Commands -> CHMOD. CHMOD it to 666.

lukezweb
12-06-2003, 09:58 AM
Originally posted by pyro
Depends what FTP program you have. I have WS_FTP Pro 7, and in that, you right click on the file -> Operations -> FTP Commands -> CHMOD. CHMOD it to 666.

ok will try later :)