06-30-2008, 07:24 PM
|
#7 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
|
PHP Code:
<style type="text/css">
.style4 {
font-size: xx-large;
color: #FF9900;
}
</style>
<?php
error_reporting(E_ALL & ~E_NOTICE);
include("db_connect.php");
session_start(); // Starts the session.
if ($_SESSION[‘logged’] != 1) { // There was no session found!
header("Location: users.php"); // Goes to login page.
exit(); // Stops the rest of the script.
}
echo "This is the main page!";
$res = "SELECT `id`, `name`, `des`, `rest`, `tim` FROM `news` WHERE `valid` = 1";
$web_result = mysql_query($res);
if(!$web_result) {
echo mysql_error();
}
else {
}
?>
<?php
while($website_row = mysql_fetch_array($web_result))
{
?>
<font size='3' color='CC0000'><strong>
<h1 class="style4">
<?php print $website_row['des'];?></br>
</h1>
</strong></font>
<table border = "0">
<tr>
<th>NEWS:</th>
<td>
<?php print $website_row['rest']; ?>
</div>
</td>
</tr>
</table>
<?php } ?>
<?php
echo "<a href=\"logout.php\">Logout</a>";
?>
<?php
$webq = "select id, name, des from news where valid = 1 ";
if(isset($_GET['cat']))
{
$webq .= sprintf("and cat_id = '%s'", mysql_real_escape_string($_GET['cat']));
}
$web_result = mysql_query($webq);
if(!$cat_result)
{
echo mysql_error();
}
$catq = "select id, name from cat";
$cat_result = mysql_query($catq);
?>
<?php
while($cat_row = mysql_fetch_array($cat_result))
{
?>
<a href="index.php?cat=<?php echo $cat_row['id'];?>"><?php echo $cat_row['name'];?></a>
<?php
}
?>
this is the complete code.
|
|
|
|