Problem mit Newsscript

lp-chester

Erfahrenes Mitglied
Hallo.
Ich habe ein Problem, beim erstellen eines Newsscriptes.
Wenn ich einen Beitrag verfassen will, und dann auf Abschicken drücke, bekomme ich folgende Fehlermeldung:

******* [FEHLER]
Warning: fopen(article_summary.html): failed to open stream: Permission denied in /home/www/web48/html/test/neues/news.php on line 64

Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/web48/html/test/neues/news.php on line 66

Warning: fclose(): supplied argument is not a valid stream resource in /home/www/web48/html/test/neues/news.php on line 67
Template Error: set_file: For handle ArticlePage filename is empty.
Halted.
******* [/FEHLER]


Hier ist auch nocheinmal der Quelltext für das Newsscript:

PHP:
<?
        include ("template.inc");
        include ("config.php");

	$summary_template = "t_summary.html";
	$max_summary = 5;

	function summary_page ($subject, $date, $summary, $article_id)
	{
		global $summary_template;
        	$t = new Template();
        	$t->set_file("SummaryPage", $summary_template);
		$article_url = "article_".$article_id.".html";
		$date = nl2br($date);
		$summary =  nl2br($summary);	 
		$t->set_var( array(
				"subject" => $subject,
				"date"    => $date,
				"summary" => $summary,
				"article_url" => $article_url
				));
		$t->parse("Summary", "SummaryPage");
		return $t->get_var("Summary");
	}

	function main_page ($subject, $date, $summary, $article_id, $body)
	{
		global $article_template;

                $t = new Template();
                $t->set_file("ArticlePage", $article_template);
                $article_url = "article_".$article_id.".html";
                $date = nl2br($date);
                $summary =  nl2br($summary);
                $body =  nl2br($body);
                $t->set_var( array(
                                "subject" => $subject,
                                "date"    => $date,
                                "summary" => $summary,
                                "body" => $body,
                                "article_url" => $article_url
                                ));
                $t->parse("Article", "ArticlePage");
                return $t->get_var("Article"); 
	}

	function add_article($filename, $news)
	{

		if(file_exists($filename)){
			$fh = fopen($filename, "r");
			$old_news = fread($fh, filesize($filename));
			fclose($fh); 
		}

		/* TODO: Multipage articles
			preg_match_all("<!--ARTICLE PAGE=(\d*)-->", $old_news, $matches;
		
			if( count($matches[0]) >= $max_summary){
				$oldfilename = $filename.($matches[0][0]+1);
			} 
		*/

		$fh = fopen($filename, "w");
		$news = stripslashes($news);
		fwrite($fh, "\n<!--ARTICLE-->\n$news $old_news");
		fclose($fh);
	}

?>

<?
	if(strcmp($subject, "")){	
		if(!(strcmp($passwd, $password))){	
			add_article("article_summary.html", summary_page($subject, $date, $summary, $article_id));
			add_article("article_$article_id.html", main_page($subject, $date, $summary, $article_id, $body));
			echo "<p> Article has been added! <p>";
		}else{
			echo "<p><b> Password is wrong! </b>";
		}
	}
?>


<form action="news.php" method="post">
<table border="0">
<tr> <td> Passwort:<br> <input type="password" name="passwd" size="30"> </td></tr>
<tr> <td> Article ID:&nbsp;<? echo date("Y_m_j_is"); ?><input type="hidden" name=article_id value=<? echo date("Y_m_j_is"); ?> size=30> </td></tr>
<tr> <td> &Uuml;berschrift:<br> <input type="text" name="subject" size="50"> </td></tr>
<tr> <td> Datum/Verfasser/etc:<br> <textarea name="date" class="tworow"><? echo date("M j, Y\n"); ?>Autor: </textarea> </td></tr>
<tr> <td> Einleitung:<br> <textarea name="summary" class="threerow"></textarea> </td></tr>
<tr> <td> Inhalt:<br> <textarea name="body" rows="15" cols="30"></textarea> </td></tr>
</table>
<input type="submit" name="submit" value="Eintragen">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</body>
</html>


mfg LP-Chester
 
chmod ist eine PHP Funktion zum Verändern der Zugriffsrechte und keine Eigenschaft einer Datei.

Dennoch tippe auch ich – wie auch bereits in der Fehlermeldung beschrieben – auf fehlende Zugriffsrechte.
 
Nein, die Einstellung ist 644

mfg LP-Chester


[EDIT]
Muss ich die Datei auf 777 setzen?
[/EDIT]
 
Zuletzt bearbeitet:
Zurück