Hello, on an occasion I came here for help on my shoutbox. Now I have an error submitting the data.

<?php
    ini_set('display_errors', 0);
    function InStr($String,$Find,$CaseSensitive = false) {
        $i=0;
        while (strlen($String)>=$i) {
            unset($substring);
            if ($CaseSensitive) {
                $Find=strtolower($Find);
                $String=strtolower($String);
            }
            $substring=substr($String,$i,strlen($Find));
            if ($substring==$Find) return true;
            $i++;
        }
        return false;
    }

if (InStr($_POST["namesh"], 'critique')) {
 echo('<meta http-equiv="refresh" content="0;URL=************************/spammer.html" 

/>');
    } else {
if (isset($_POST["namesh"], $_POST["text"])) {
    $contents = strip_tags($_POST["namesh"]) . ' : '
        . strip_tags($_POST["text"]) . "<br>";
    if (file_put_contents("comments.txt", $contents, FILE_APPEND) === false) {
        die("Robbit Shout is down, try again later.");
    }
}
}

echo file_get_contents("comments.txt");
?>

When I type some message and submit it, the code displays the die message. Help?

    its failing updating comments.txt

    permissions? diskspace? is the file missing?

      turning display errors on would help you debug it.

        I get the following errors:

        Warning: file_put_contents(comments.txt) [function.file-put-contents]: failed to open stream: Permission denied in /***********/htdocs/index.php on line 76
        
        Notice: Undefined index: namesh in /www/sitegoz.com/p/a/r/partypad/htdocs/index.php on line 69

        Help?

          does php have read-write access to the file?

            dagon;10918497 wrote:

            does php have read-write access to the file?

            Not that I know of, the webhost I use is sitegoz.com.

              define_php;10918556 wrote:

              Not that I know of, the webhost I use is sitegoz.com.

              well in order for PHP to put the chat contents into the file, it will need write access

                Write a Reply...