Witam, otoz mam taki problem, mam pewien system neewsow, ale cos mi nie dziala dodawanie ich

newscenter.php

  1. <HEAD>
  2. <TITLE>Administr8</TITLE>
  3. </HEAD>
  4. <LINK REL="Stylesheet" HREF="./administr8style.css">
  5. <BODY BGCOLOR=white topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>
  6. <DIV CLASS="Headline">News Center</DIV>
  7. <P>
  8. <DIV CLASS=normal>
  9.  
  10.  
  11.  
  12. <?
  13.  
  14. $newsdir = "/home/mmospot/domains/mmospot.pl/public_html/projekty/news/"; /* enter the absolute path to your news directory withotu the trailing '/' */
  15.  
  16. // Set default mode to 'index' if it isn't already set
  17. if (!isset($mode)) {
  18. $mode = 'index';
  19. }
  20.  
  21. // Confirm that the news file has been edited and write to disk.
  22. switch($mode) {
  23. case 'edit_confirm':
  24. echo "<P>&nbsp;</P>The news article has been edited.<P>";
  25. echo "<P>&nbsp;</P><A HREF=newscenter.php?mode=index>Back</A><P>";
  26. if ($message) {
  27. $message = ereg_replace("\r\n\r\n", "\n<P>", $message);
  28. if ($fp = fopen("$newsfile", 'w')) {
  29. fwrite ($fp, $message);
  30. }
  31. }
  32. break;
  33.  
  34. // Choose whether we're editing or deleting news and handle the file accordingly.
  35. case 'edit_or_delete':
  36. if ($todo == "edit") { /* We're editing it now */
  37. $newscontents = join( '', file( $newsdir . '/' . $modify ) ); /* Load the file */
  38. echo "<FORM action=$PHP_SELF?mode=edit_confirm method=post>";
  39. echo "<INPUT TYPE=hidden NAME=newsfile VALUE='$newsdir/$modify'>";
  40. echo "<b>Article Text:</b><BR><TEXTAREA name=message rows=20 cols=80>";
  41. echo $newscontents; /* Display its contents in the form */
  42. echo "</TEXTAREA><p>";
  43. echo "<INPUT name=submit type=submit value='Edit News'>";
  44. echo "</FORM>";
  45. break;
  46. }
  47. if ($todo == "delete") { /* Delete the file */
  48. $deleting_file = unlink( $newsdir . '/' . $modify );
  49. echo "News Article Deleted<br>";
  50. echo "<P>&nbsp;</P><A HREF=newscenter.php?mode=index>Back</A><P>";
  51. break;
  52. }
  53.  
  54.  
  55. case 'index': /* The defailt mode, This is where we will list all current news articles with the option to edit or delete them */
  56. echo "ť <A HREF=$PHP_SELF?mode=add_news>Add News</A><BR><HR NOSHADE>";
  57.  
  58. $news=opendir($newsdir);
  59. $files = array();
  60. while ($file = readdir($news)) {
  61. if ($file != "." && $file != ".." && $file != "news.php" && $file != "nowosci.php") {
  62. $files[] = $file;
  63. }
  64. rsort($files);
  65. }
  66. for (reset ($files); list ($key, $value) = each ($files); ) {
  67. echo "<FORM METHOD=POST ACTION=$PHP_SELF?mode=edit_or_delete>";
  68. echo "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=10 WIDTH=100%>";
  69. echo "<TR>";
  70. echo "<TD WIDTH=80 ALIGH=LEFT>";
  71. echo "<INPUT TYPE=hidden NAME=modify VALUE=$value>";
  72. echo "<INPUT TYPE=radio NAME=todo VALUE=edit> Edit<BR>";
  73. echo "<INPUT TYPE=radio NAME=todo VALUE=delete> Delete<P>";
  74. echo "<DIV ALIGN=center><INPUT TYPE=submit NAME=$value VALUE=Next></IMPUT></DIV>";
  75. echo "</FORM></TD>";
  76. echo "<TD>";
  77. include($newsdir . '/' . $value);
  78. echo "</TD></TR></TABLE><P>";
  79. }
  80. closedir($news);
  81. break;
  82.  
  83. // Adding a new news article.
  84. case 'add_news':
  85. echo "<div align=LEFT><FORM action=$PHP_SELF?mode=addnews_confirm method=post>";
  86. echo "<b>Your name:</b><BR><INPUT name=author type=text size=40><BR>";
  87. echo "<b>Your e-mail:</b><BR><INPUT name=email type=text size=40><BR>";
  88. echo "<b>Article Title:</b><BR><INPUT name=title type=text size=40><BR>";
  89. echo "<b>Article Text:</b><BR><TEXTAREA name=message rows=10 cols=55 wrap=none>";
  90. echo "</TEXTAREA><p>";
  91. echo "<INPUT name=submit type=submit value='Post News'>";
  92. echo "</FORM></DIV>";
  93. break;
  94.  
  95. // Confirm that a new news article has been added and write to disk.
  96. case 'addnews_confirm':
  97. echo "<P>&nbsp;</P>Your news article has been posted<P>";
  98. echo "<P>&nbsp;</P><A HREF=newscenter.php?mode=index>Back</A><P>";
  99.  
  100. // what to do with the form data
  101. if ($message) {
  102. $name = date("dmy_His");
  103. $newsfile = "$newsdir/$name.txt";
  104. $message = ereg_replace("\r\n", "\n<BR>", $message);
  105. $date = date("l, F j Y, H:i ");
  106. $message = "<DIV CLASS=Headline>$title</DIV>\n<DIV CLASS=NewsDetail><i>$date -- <A HREF=mailto:$email>$author</i></A></DIV>\n<DIV CLASS=normal>$message</DIV>\n<HR
  107.  
  108. NOSHADE ALIGN=LEFT><BR>";
  109. if ($fp = fopen("$newsfile", 'w')) {
  110. fwrite ($fp, $message);
  111. }
  112. }
  113. break;
  114.  
  115. }
  116.  
  117. ?>
  118. </FORM>
  119. </BODY>
  120. </HTML>



displaynews.php

  1. <?
  2.  
  3. $newsdir = "/home/mmospot/domains/mmospot.pl/public_html/projekty/news/"; /* enter the absolute path to your news directory withotu the trailing '/' */
  4.  
  5. // display news articles.
  6. $news=opendir($newsdir);
  7. $files = array();
  8. while ($file = readdir($news)) {
  9. if ($file != "." && $file != ".." && $file != "news.php" && $file != "index.php") {
  10. $files[] = $file;
  11. }
  12. rsort($files);
  13. }
  14. for (reset ($files); list ($key, $value) = each ($files); ) {
  15. include($newsdir . '/' . $value);
  16. }
  17. closedir($news);
  18. ?>


Wchodzac na dodawanie neewsow wyskakuje mi cos takiego :

http://www.mmospot.pl/projekty/newscenter.php

nie da sie ani dodac ani nic innego zrobic :/

gdzie popelnilem blad ?

Z gory dzieki za pomoc