Размер файла: 2.21Kb
<?
include("configure.php");
include("user.php");
$table_name = "ns_headlines";
$connection = @mysql_connect("$db_server", "$db_name", "$db_password") or die("Couldn't connect.");
$db = @mysql_select_db($db_database, $connection) or die("Couldn't select database.");
$sql = "SELECT bsize, bcolor, titlebgcolor, titletextcolor, msgbgcolor, msgtextcolor, hldatecolor, titletextsize, msgtextsize, newswidth
FROM $table_name
";
$result = @mysql_query($sql, $connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$bsize = $row['bsize'];
$bcolor = $row['bcolor'];
$titlebgcolor = $row['titlebgcolor'];
$titletextcolor = $row['titletextcolor'];
$msgbgcolor = $row['msgbgcolor'];
$msgtextcolor = $row['msgtextcolor'];
$hldatecolor = $row['hldatecolor'];
$titletextsize = $row['titletextsize'];
$msgtextsize = $row['msgtextsize'];
$newswidth = $row['newswidth'];
}
$table_name = "ns_news";
$connection = @mysql_connect("$db_server", "$db_name", "$db_password") or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database..");
$sql = "SELECT title, postby, hldate, id, timestamp
FROM $table_name
ORDER BY timestamp DESC LIMIT 5
";
$result = @mysql_query($sql, $connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$title = $row['title'];
$postby = $row['postby'];
$hldate = $row['hldate'];
$id = $row['id'];
$timestamp = $row['timestamp'];
$rest = substr ("$title", 0, 20);
$display_normal .= "<a href=\"$site_url#$id\">$rest... [$hldate]</a><br>";
}
$display_all = "
<br><br><br><br>
<table border=\"$bsize\" bordercolor=\"$bcolor\" width=\"$newswidth\" cellpadding=0 cellspacing=0 style=\"border-collapse: collapse\">
<tr bgcolor=\"$titlebgcolor\">
<td >
<font color=\"$titletextcolor\" size=\"$titletextsize\"><b>Latest News</b></font>
</td>
</tr>
<tr bgcolor=\"$msgbgcolor\">
<td>
<font color=\"$msgtextcolor\" size=\"$msgtextsize\">
$display_normal
</font>
</td>
</tr>
<tr height=5 bgcolor=\"$titlebgcolor\">
<td>
</td>
</tr>
</table>
";
echo $display_all;
?>