Innanzitutto grazie mille per la manona ke mi stai dando...mi stava facendo uscire pazzo questo coso!
Allora il file news.php è questo:
Codice:
<body>
<basefont size=2 face=arial>
<b>Aggiungi Articolo</b>
<?
include ("template.inc");
include ("config.php");
$summary_template = "t_summary.xml";
$max_summary = 0;
function summary_page ($subject, $date, $summary, $article_id)
{
global $summary_template;
$t = new Template();
$t->set_file("SummaryPage", $summary_template);
$date = nl2br($date);
$summary = nl2br($summary);
$t->set_var( array(
"subject" => $subject,
"date" => $date,
"summary" => $summary,
));
$t->parse("Summary", "SummaryPage");
return $t->get_var("Summary");
}
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("<rss version='2.0'>", $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<rss version='2.0'>\n$news $old_news");
fclose($fh);
}
?>
<?
if(strcmp($subject, "")){
if(!(strcmp($passwd, $password))){
add_article("article_summary.xml", summary_page($subject, $date, $summary, $article_id));
echo "<p> L'articolo è stato aggiunto con successo. <p>";
}else{
echo "<p><b> La Password è errata! </b>";
}
}
?>
<body>
<script type="text/javascript" src="file.js"></script>
<form name=news action=news.php method=post>
<table border=0>
<tr> <td> Password(obbligatoria): </td><td> <input type=text name=passwd size=30> </td></tr>
<tr> <td> Oggetto: </td><td> <input type=text name=subject size=30> </td></tr>
<tr> <td> ID Articolo: </td><td> <input type=text name=article_id value=<? echo date("Y_m_j_is"); ?> size=30> </td></tr>
<tr> <td> Data e ora: </td><td> <textarea name=date rows=2 cols=30 wrap=soft><? echo date("m-j-Y H:i"); ?></textarea> </td></tr>
<tr> <td> Riassunto: </td><td> <textarea name=summary rows=2 cols=40 wrap=soft></textarea> </td></tr>
<tr><td></td><td><br>
<script type="text/javascript">
<!--
update();
//-->
</script><br><br></td></tr>
<tr><td>
<script type="text/javascript">
<!--
update();
//-->
</script>
</td>
</tr>
</table>
<input type=submit name=submit value="Aggiungi RSS">
</form>
<p>
</body>
Il file latest.php invece è questo:
Codice:
<?
require('config.php');
$filename = "article_summary.xml";
#- open article summaries
if(file_exists($filename)){
$fh = fopen($filename, "r");
$old_news = fread($fh, filesize($filename));
fclose($fh);
}
#- get first five article
$articles = explode("<rss version='2.0'>", $old_news);
$i=0;
foreach ( $articles as $article ){
if(count($articles)>$i){
if($max_latest >= $i++){
print $article;
}
}
}
?>
Ci sono altri file ma mi pare di capire che biosgona agire sul file latest.php
poi se eventualmente hai bisogno degli altri file te li posto pure!
Grazie ancora...6 un grandeeeeee!!!