Witam, otoz mam taki problem, mam pewien system neewsow, ale cos mi nie dziala dodawanie ich
newscenter.php
<HEAD>
<TITLE>Administr8</TITLE>
</HEAD>
<LINK REL="Stylesheet" HREF="./administr8style.css">
<BODY BGCOLOR=white topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>
<DIV CLASS="Headline">News Center</DIV>
<P>
<DIV CLASS=normal>
<?
$newsdir = "/home/mmospot/domains/mmospot.pl/public_html/projekty/news/"; /* enter the absolute path to your news directory withotu the trailing '/' */
// Set default mode to 'index' if it isn't already set
$mode = 'index';
}
// Confirm that the news file has been edited and write to disk.
switch($mode) {
case 'edit_confirm':
echo "<P> </P>The news article has been edited.<P>"; echo "<P> </P><A HREF=newscenter.php?mode=index>Back</A><P>"; if ($message) {
if ($fp = fopen("$newsfile", 'w')) { }
}
break;
// Choose whether we're editing or deleting news and handle the file accordingly.
case 'edit_or_delete':
if ($todo == "edit") { /* We're editing it now */
$newscontents = join( '', file( $newsdir . '/' . $modify ) ); /* Load the file */ echo "<FORM action=$PHP_SELF?mode=edit_confirm method=post>"; echo "<INPUT TYPE=hidden NAME=newsfile VALUE='$newsdir/$modify'>"; echo "<b>Article Text:</b><BR><TEXTAREA name=message rows=20 cols=80>"; echo $newscontents; /* Display its contents in the form */ echo "<INPUT name=submit type=submit value='Edit News'>"; break;
}
if ($todo == "delete") { /* Delete the file */
$deleting_file = unlink( $newsdir . '/' . $modify ); echo "News Article Deleted<br>"; echo "<P> </P><A HREF=newscenter.php?mode=index>Back</A><P>"; break;
}
case 'index': /* The defailt mode, This is where we will list all current news articles with the option to edit or delete them */
echo "ť <A HREF=$PHP_SELF?mode=add_news>Add News</A><BR><HR NOSHADE>";
if ($file != "." && $file != ".." && $file != "news.php" && $file != "nowosci.php") {
$files[] = $file;
}
}
for (reset ($files); list
($key, $value) = each ($files); ) { echo "<FORM METHOD=POST ACTION=$PHP_SELF?mode=edit_or_delete>"; echo "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=10 WIDTH=100%>"; echo "<TD WIDTH=80 ALIGH=LEFT>"; echo "<INPUT TYPE=hidden NAME=modify VALUE=$value>"; echo "<INPUT TYPE=radio NAME=todo VALUE=edit> Edit<BR>"; echo "<INPUT TYPE=radio NAME=todo VALUE=delete> Delete<P>"; echo "<DIV ALIGN=center><INPUT TYPE=submit NAME=$value VALUE=Next></IMPUT></DIV>"; include($newsdir . '/' . $value);
echo "</TD></TR></TABLE><P>"; }
break;
// Adding a new news article.
case 'add_news':
echo "<div align=LEFT><FORM action=$PHP_SELF?mode=addnews_confirm method=post>"; echo "<b>Your name:</b><BR><INPUT name=author type=text size=40><BR>"; echo "<b>Your e-mail:</b><BR><INPUT name=email type=text size=40><BR>"; echo "<b>Article Title:</b><BR><INPUT name=title type=text size=40><BR>"; echo "<b>Article Text:</b><BR><TEXTAREA name=message rows=10 cols=55 wrap=none>"; echo "<INPUT name=submit type=submit value='Post News'>"; break;
// Confirm that a new news article has been added and write to disk.
case 'addnews_confirm':
echo "<P> </P>Your news article has been posted<P>"; echo "<P> </P><A HREF=newscenter.php?mode=index>Back</A><P>";
// what to do with the form data
if ($message) {
$newsfile = "$newsdir/$name.txt";
$date = date("l, F j Y, H:i "); $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
NOSHADE ALIGN=LEFT><BR>";
if ($fp = fopen("$newsfile", 'w')) { }
}
break;
}
?>
</FORM>
</BODY>
</HTML>
displaynews.php
<?
$newsdir = "/home/mmospot/domains/mmospot.pl/public_html/projekty/news/"; /* enter the absolute path to your news directory withotu the trailing '/' */
// display news articles.
if ($file != "." && $file != ".." && $file != "news.php" && $file != "index.php") {
$files[] = $file;
}
}
for (reset ($files); list
($key, $value) = each ($files); ) { include($newsdir . '/' . $value);
}
?>
Wchodzac na dodawanie neewsow wyskakuje mi cos takiego :
http://www.mmospot.pl/projekty/newscenter.phpnie da sie ani dodac ani nic innego zrobic :/
gdzie popelnilem blad ?
Z gory dzieki za pomoc
Ten post edytował lagotek 28.04.2010, 14:39:26