Mam problem ze skryptem newsów "PsNews". Otóż instalowałem go na serwerach boo.pl i innych i nie było problemu. Tym razem chce postawić stronę na darmowym serwerze. Wszystko ok, ale mam problem z błędami w kodzie. Może mi ktoś powiedzieć, czy to rzeczywiście błąd w kodzie, czy wina serwera? Serwery, których używam 000webhost.com i lua.pl
Kod
<b>Warning</b>: fopen(news.txt) [<a href="http://nistelrooy.000webhost.com/news/function.fopen">function.fopen</a>]: failed to open stream: Permission denied in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>99</b>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><div align="center"><a href="http://www.000webhost.com/"><font color="#000000" face="Arial" size="1">Free Web Hosting</font></a></div></td></tr></tbody> </table>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><font color="#000000" face="Arial" size="1"><b>PHP Error Message</b></font></td></tr></tbody> </table>
<b>Warning</b>: flock() expects parameter 1 to be resource, boolean given in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>100</b>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><div align="center"><a href="http://www.000webhost.com/"><font color="#000000" face="Arial" size="1">Free Web Hosting</font></a></div></td></tr></tbody> </table>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><font color="#000000" face="Arial" size="1"><b>PHP Error Message</b></font></td></tr></tbody> </table>
<b>Warning</b>: fputs(): supplied argument is not a valid stream resource in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>101</b>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><div align="center"><a href="http://www.000webhost.com/"><font color="#000000" face="Arial" size="1">Free Web Hosting</font></a></div></td></tr></tbody> </table>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><font color="#000000" face="Arial" size="1"><b>PHP Error Message</b></font></td></tr></tbody> </table>
<b>Warning</b>: flock() expects parameter 1 to be resource, boolean given in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>102</b>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><div align="center"><a href="http://www.000webhost.com/"><font color="#000000" face="Arial" size="1">Free Web Hosting</font></a></div></td></tr></tbody> </table>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><font color="#000000" face="Arial" size="1"><b>PHP Error Message</b></font></td></tr></tbody> </table>
<b>Warning</b>: fclose(): supplied argument is not a valid stream resource in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>103</b>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><div align="center"><a href="http://www.000webhost.com/"><font color="#000000" face="Arial" size="1">Free Web Hosting</font></a></div></td></tr></tbody> </table>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><font color="#000000" face="Arial" size="1"><b>PHP Error Message</b></font></td></tr></tbody> </table>
<b>Warning</b>: fopen(komentarze/2) [<a href="http://nistelrooy.000webhost.com/news/function.fopen">function.fopen</a>]: failed to open stream: Permission denied in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>105</b>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td><div align="center"><a href="http://www.000webhost.com/"><font color="#000000" face="Arial" size="1">Free Web Hosting</font></a></div></td></tr></tbody> </table>
<table align="center" bgcolor="#ffffdf" border="1" bordercolor="#e8b900" cellpadding="2"> <tbody><tr><td>
</td></tr></tbody> </table>
<b>Warning</b>: fclose(): supplied argument is not a valid stream resource in <b>/home/a3296681/public_html/news/admin.php</b> on line <b>107</b>
Błąd pojawia się przy próbie dodania newsa.
Kod lini newsa:
100 - 107
Kod
flock($file, 2);
fputs($file, $puts);
flock($file, 3);
fclose($file);
$file = fopen("komentarze/$liczba", "w");
fputs($file, "");
fclose($file);
fputs($file, $puts);
flock($file, 3);
fclose($file);
$file = fopen("komentarze/$liczba", "w");
fputs($file, "");
fclose($file);