File "/lega_classe2005/INDEX.PHP"
Codice PHP:
<?php
include "../_private/_config/site.inc.php3";
if (isset($_GET['page'])) {
$page=$_GET['page'];
$page=strtolower($page);
if ((in_array($page,$sections))==false) {
$page='error 404';
}
} else {
$page = 'home';
}
include "../_private/_templates/header.phtml";
include "../_private/_templates/nav.phtml";
$page=trim($page);
include "{$page}.php";
include "../_private/_templates/footer.phtml";
?>
File "/lega_classe2005/HOME.PHP"
Codice HTML:
<!-- SECTION BEGIN -->
[...]
<tr>
<td width="100%">
<span class="title"><span style="color:#FF6400">»</span>News</span></td>
</tr>
<tr>
<td width="100%">
Tutte le novità circa la lega...</td>
</tr>
<tr>
<td width="100%">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="734" id="LeagueNewsWrapper">
<!-- League News Begin-->
<?php include "../_public/news.php?fid=14"; ?>
<!-- League News End -->
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="100%">...e circa il sito.</td>
</tr>
<tr>
<td width="100%">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="734" id="SiteNewsWrapper">
<!-- Site News Begin-->
<?php include "../_public/news.php?fid=2"; ?>
<!-- Site News End -->
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
[...]
</table>
</center>
</div>
</td>
<!-- SECTION END -->
File "/_public/NEWS.PHP"
Codice PHP:
<?php
// ACQUISIZIONE PARAMETRI
include("../_private/_config/db.inc.php3");
$pref="forum_";
$fid=$_GET['fid'];
// SCRIPT
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri");
if ($fid==2) {
$tname = $pref."topics";
$query1 = "SELECT tid,title,description,start_date,forum_id FROM $tname WHERE forum_id LIKE $fid ORDER BY start_date DESC LIMIT 0,10";
$result1 = mysql_query($query1, $db);
while ($row1 = mysql_fetch_array($result1)) {
echo " <tr>\n";
echo " <td width=\"100%\">\n";
echo " <span class=\"news_summary\"><span style=\"color:#0064C8;\">::</span><a target=\"_blank\" href=\"../_public/forum/index.php?showtopic={$row1['tid']}\" class=\"news\">[\n";
if ((date("j",$row1['start_date'])==1)or(date("j",$row1['start_date'])==21)or(date("j",$row1['start_date'])==31)) {
echo (date("D j",$row1['start_date'])."<sup>st</sup> ".date("M Y @ H:i:s",$row1['start_date']));
} elseif ((date("j",$row1['start_date'])==2)or(date("j",$row1['start_date'])==22)) {
echo (date("D j",$row1['start_date'])."<sup>nd</sup> ".date("M Y @ H:i:s",$row1['start_date']));
} elseif ((date("j",$row1['start_date'])==3)or(date("j",$row1['start_date'])==23)) {
echo (date("D j",$row1['start_date'])."<sup>rd</sup> ".date("M Y @ H:i:s",$row1['start_date']));
} else {
echo (date("D j",$row1['start_date'])."<sup>th</sup> ".date("M Y @ H:i:s",$row1['start_date']));
}
echo "] {$row1['title']} - {$row1['description']}</a></span></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width=\"100%\"> </td>\n";
echo " </tr>\n";
}
} else {
$tname = $pref."topics";
$query1 = "SELECT tid,title,start_date,forum_id FROM $tname WHERE forum_id LIKE $fid ORDER BY start_date DESC LIMIT 0,10";
$result1 = mysql_query($query1, $db);
while ($row1 = mysql_fetch_array($result1)) {
$tname = $pref."posts";
$tid = $row1['tid'];
$quary2 = "SELECT author_name,post,post_date,topic_id FROM $tname WHERE topic_id LIKE $tid ORDER BY post_date ASC LIMIT 0,1";
$result2 = mysql_query($quary2, $db);
while ($row2 = mysql_fetch_array($result2)) {
echo " <tr>\n";
echo " <td width=\"100%\">\n";
echo " <span class=\"news_title\"><span style=\"color:#0064C8;\">::</span>{$row1['title']}</span></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width=\"100%\">\n";
echo " <div align=\"center\">\n";
echo " <center>\n";
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"730\" id=\"NewsBody{$row2['post_date']}\">\n";
echo " <tr>\n";
echo " <td width=\"100%\">\n";
echo " <span class=\"info\">Posted on ";
if ((date("j",$row1['start_date'])==1)or(date("j",$row1['start_date'])==21)or(date("j",$row1['start_date'])==31)) {
echo (date("D j",$row1['start_date'])."<sup>st</sup> ".date("M Y @ H:i:s",$row1['start_date']));
} elseif ((date("j",$row1['start_date'])==2)or(date("j",$row1['start_date'])==22)) {
echo (date("D j",$row1['start_date'])."<sup>nd</sup> ".date("M Y @ H:i:s",$row1['start_date']));
} elseif ((date("j",$row1['start_date'])==3)or(date("j",$row1['start_date'])==23)) {
echo (date("D j",$row1['start_date'])."<sup>rd</sup> ".date("M Y @ H:i:s",$row1['start_date']));
} else {
echo (date("D j",$row1['start_date'])."<sup>th</sup> ".date("M Y @ H:i:s",$row1['start_date']));
}
echo " by {$row2['author_name']}</span></td>";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width=\"100%\"><span style=\"font-size:9pt;\">{$row2['post']}</span></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width=\"100%\">\n";
echo " <p align=\"right\"><a target=\"_blank\" href=\"../_public/forum/index.php?showtopic={$row1['tid']}\" class=\"news\"><span class=\"info\">Comment this news</span></a></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </center>\n";
echo " </div>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width=\"100%\"> </td>\n";
echo " </tr>\n";
}
}
}
mysql_close($db);
?>