Page 1 of 1

my session is not working right

Posted: Fri Jun 14, 2002 7:36 pm
by chris12295
i have this login code:

Code: Select all

<?
session_start(); // start session.
mysql_connect("localhost");
mysql_select_db("Ads");
?>
<!-- header tags, edit to match your own, or include template header file. -->
<html>
<head>
<title>Login</title>
<head>
<body>
<?
if(!isset($username) | !isset($password)) &#123;
// escape from php mode.
?>
<form action="<?=$PHP_SELF?><?if($QUERY_STRING)&#123; echo"?". $QUERY_STRING;&#125;?>" method="POST">
<table align='center'>
	   <tr><td><br><img src="images/logo.gif" alt="" border="0" height=60 align="left" hspace=0><br><span style="color:#000000;font-family:arial;font-size:22pt">Boat Salvage</span></tr></td>
</table>
<br>
<br>
<table height=200 cellspacing=0 cellpadding=0 width=300 border=1 bordercolorlight="#ffffff" bordercolordark="#000000" align="center">

	   <tr><td colspan=2 bgcolor='#004080'><center><span style="color:#dbdbdb;font-family:arial;font-size:20pt">Login</span></center></td></tr>
	   
	   <tr><td colspan=2><center>Got a pert to sell? <a href='place_ad.html'>Click here!</a></center></p></tr></td>
	   
	   <tr><td bgcolor="#c4d1e1" align='right'>Username:</td><td bgcolor="#dbdbdb" align='center'><input type="text" name="username"></td></tr>
	   
	   <tr><td bgcolor="#c4d1e1" align='right'>Password:</td><td bgcolor="#dbdbdb" align='center'><input type="password" name="password"></td></tr>
	   
	   <tr><td colspan=2 align=center><input type="submit" value="Login"></td></form></tr>
</table>
<center><i><small>Must buy an ad to become a registered user.</small></i></center>
</body>
</html>
<?
exit();
&#125;

// If all is well so far.

session_register("$username");
session_register("$password"); // register username and password as session variables.

// Here you would check the supplied username and password against your database to see if they exist.
// For example, a MySQL Query, your method may differ.

$sql = mysql_query("select password FROM user_table WHERE username = '$username'");
$fetch_em = mysql_fetch_array($sql);
$numrows = mysql_num_rows($sql);

if($numrows != "0" & $password == $fetch_em&#1111;"password"]) &#123;
$valid_user = 1;
&#125;
else &#123;
$valid_user = 0;
&#125;

// If the username exists and pass is correct, don't pop up the login code again.
// If info can't be found or verified....

if (!($valid_user))
&#123;
session_unset();   // Unset session variables.
session_destroy(); // End Session we created earlier.
// escape from php mode.
?>
<form action="<?=$PHP_SELF?><?if($QUERY_STRING)&#123; echo"?". $QUERY_STRING;&#125;?>" method="POST">
<table align='center'>
	   <tr><td><br><img src="images/logo.gif" alt="" border="0" height=60 align="left" hspace=0><br><span style="color:#000000;font-family:arial;font-size:22pt">Boat Salvage</span></tr></td>
</table> 
<br>
<br>
<table height=200 cellspacing=0 cellpadding=0 width=300 border=1 bordercolorlight="#ffffff" bordercolordark="#000000" align="center">

	   <tr><td colspan=2 bgcolor='#004080'><center><span style="color:#dbdbdb;font-family:arial;font-size:20pt">Login</span></center></td></tr>
	   
	   <tr><td colspan=2><center>Got a pert to sell? <a href='place_ad.html'>Click here!</a><br><span style="color:'red'">Incorrect login information. Please try again.</span></center></p></tr></td>
	   
	   <tr><td bgcolor="#c4d1e1" align='right'>Username:</td><td bgcolor="#dbdbdb" align='center'><input type="text" name="username"></td></tr>
	   
	   <tr><td bgcolor="#c4d1e1" align='right'>Password:</td><td bgcolor="#dbdbdb" align='center'><input type="password" name="password"></td></tr>
	   
	   <tr><td colspan=2 align=center><input type="submit" value="Login"></td></form></tr>
</table>
<center><i><small>Must buy an ad to become a registered user.</small></i></center>
</body>
</html>
<?
exit();
&#125;
?>
but if there is an incorrect login, it says: Warning: Session object destruction failed in login.php on line 66.

whats wrong with my code?

Posted: Fri Jun 14, 2002 9:26 pm
by gotDNS
well, urs is a lot of code to read if it's not my problem, but i get help, so i give it:

here are the 3 scripts i use to login, a normal page, and a logout:

Login...

Code: Select all

<?php
session_start();

mysql_connect("localhost:3306", "techy") && mysql_select_db("forum")
or $failed = "Could not connect to database.";

$result = mysql_query("select * from usrinfo where username="$username"");

$loginform = "<form method="post" action="login.php">
<img src="forumtop.gif" /><br />&nbsp;<b><u>Login</u></b><br />
&nbsp;Username: <input type="text" size="16" maxlength="16" name="username" />
 Password: <input type="password" size="16" maxlength="16" name="password" />
<input type="hidden" name="login" value="true" />
<input type="submit" value="submit" />
</form>";

$loginform2 = "<form method="post" action="login.php">
<img src="forumtop.gif" /><br />&nbsp;<b>ERROR: Username or password incorrect.</b><br /><br />&nbsp;<b><u>Login</u></b><br />
&nbsp;Username: <input type="text" size="16" maxlength="16" name="username" />
 Password: <input type="password" size="16" maxlength="16" name="password" />
<input type="hidden" name="login" value="true" />
<input type="submit" value="submit" />
</form>";

echo "<html><head>
<title>Techy Board</title>
<link rel="stylesheet" type="text/css" href="forum.css" />
</head>
<body marginheight="0" marginwith="0" topmargin="0" leftmargin="0">";

$row = mysql_fetch_assoc($result);

if($row&#1111;"password"]==md5($password))
&#123;
        $loggedin=$username;
        session_register("loggedin");
        if($params&#1111;"prevurl"])
                header("Location: $prevurl");
        else
                echo "<img src="forumtop.gif" /><br />&nbsp;<b>You are logged in as $loggedin</b> : <a href="logout.php" class="NLINK">Logout</a><br /><br />";
&#125;
else
&#123;
        echo $loginform2;
&#125;
?>
<br />
<table cellpadding="0" cellspacing="0" width="92%" border="0" align="center">
<tr>
<td colspan="2"><a href="index.php" class="NLINK">Techy Home</a></td>
</tr>
<tr>
<td width="20"></td>
<td>
<?php
if(session_is_registered("loggedin"))
&#123;
	echo "<a href="editup.php" class="NLINK">Edit User Profile</a><br />";
&#125;
?>
<br /><b>NOTE: Remember, keep the language clean. Please no spamming. The cleaner the forum, the less the restrictions. Thanks. -Admin</b>
</td>
</tr>
</table>
<br /><br />
<table cellpadding="0" cellspacing="0" align="center" width="85%" class="TBL">
<tr>
<td bgcolor="#000000" height="12" align="center" colspan="3"><strong class="HEADER">Forums</strong></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="general"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="genforum.php" class="NLINK">General Conversation</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="computers"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="compforum.php" class="NLINK">Computers</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="games"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="gameforum.php" class="NLINK">Computer Games</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="web"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="webforum.php" class="NLINK">Web Design</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="ut"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="utforum.php" class="NLINK">Unreal Tournament</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="prog"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="progforum.php" class="NLINK">Programming</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="music"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="musicforum.php" class="NLINK">Music</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="weird"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="weirdforum.php" class="NLINK">Weird Stuff</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="soft"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="softforum.php" class="NLINK">Computer Software</a></td>
</tr>
</table>
</body>
</html>
Page you login from...

Code: Select all

<?php
session_start();

mysql_connect("localhost:3306", "techy") && mysql_select_db("forum")
or $failed = "Could not connect to database.";

$loginform = "<form method="post" action="login.php">
<img src="forumtop.gif" /><br />&nbsp;<b><u>Login</u></b><br />
&nbsp;Username: <input type="text" size="16" maxlength="16" name="username" />
 Password: <input type="password" size="16" maxlength="16" name="password" />
<input type="hidden" name="login" value="true" />
<input type="submit" value="Login" />
</form>";

echo "<html><head>
<title>Techy Board</title>
<link rel="stylesheet" type="text/css" href="forum.css" />
</head>
<body marginheight="0" marginwith="0" topmargin="0" leftmargin="0">";

if(session_is_registered("loggedin"))
&#123;
        echo "<img src="forumtop.gif" /><br />&nbsp;<b>You are logged in as $loggedin</b> : <a href="logout.php" class="NLINK">Logout</a><br /><br />";
&#125;
else
&#123;
        echo $loginform;
&#125;
?>

<br />
<table cellpadding="0" cellspacing="0" width="92%" border="0" align="center">
<tr>
<td colspan="2"><a href="index.php" class="NLINK">Techy Home</a></td>
</tr>
<tr>
<td width="20"></td>
<td>
<?php
if(session_is_registered("loggedin"))
&#123;
	echo "<a href="editup.php" class="NLINK">Edit User Profile</a><br />";
&#125;
else
&#123;
	echo "<a href="signup.php" class="NLINK">Sign-Up to post</a> (free)<br />";
&#125;
?>
<br /><b>NOTE: Remember, keep the language clean. Please no spamming. The cleaner the forum, the less the restrictions. Thanks. -Admin</b>
</td>
</tr>
</table>
<br /><br />
<table cellpadding="0" cellspacing="0" align="center" width="85%" class="TBL">
<tr>
<td bgcolor="#000000" height="12" align="center" colspan="3"><strong class="HEADER">Forums</strong></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="general"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="genforum.php" class="NLINK">General Conversation</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="computers"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="compforum.php" class="NLINK">Computers</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="games"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="gameforum.php" class="NLINK">Computer Games</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="web"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="webforum.php" class="NLINK">Web Design</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="ut"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="utforum.php" class="NLINK">Unreal Tournament</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="prog"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="progforum.php" class="NLINK">Programming</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="music"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="musicforum.php" class="NLINK">Music</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="weird"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="weirdforum.php" class="NLINK">Weird Stuff</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="soft"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="softforum.php" class="NLINK">Computer Software</a></td>
</tr>
</table>
</body>
</html>
Logout script...

Code: Select all

<?php
session_start();

mysql_connect("localhost:3306", "techy") && mysql_select_db("forum")
or $failed = "Could not connect to database.";

$loginform = "<form method="post" action="login.php">
<img src="forumtop.gif" /><br />&nbsp;<b><u>Login</u></b><br />
&nbsp;Username: <input type="text" size="16" maxlength="16" name="username" />
 Password: <input type="password" size="16" maxlength="16" name="password" />
<input type="hidden" name="login" value="true" />
<input type="submit" value="Login" />
</form>";

$loginform2 = "<form method="post" action="login.php">
<img src="forumtop.gif" /><br />&nbsp;<b class="RED"><i>X</i></b> <b>You have been logged out.</b><br /><br />&nbsp;<b><u>Login</u></b><br />
&nbsp;Username: <input type="text" size="16" maxlength="16" name="username" />
 Password: <input type="password" size="16" maxlength="16" name="password" />
<input type="hidden" name="login" value="true" />
<input type="submit" value="Login" />
</form>";

$loginform3 = "<form method="post" action="login.php">
<img src="forumtop.gif" /><br />&nbsp;<b>ERROR: You can not logout unless you are logged in.<img src="smile.gif" /></b><br /><br />&nbsp;<b><u>Login</u></b><br />
&nbsp;Username: <input type="text" size="16" maxlength="16" name="username" />
 Password: <input type="password" size="16" maxlength="16" name="password" />
<input type="hidden" name="login" value="true" />
<input type="submit" value="Login" />
</form>";

echo "<html><head>
<title>Techy Board</title>
<link rel="stylesheet" type="text/css" href="forum.css" />
</head>
<body marginheight="0" marginwith="0" topmargin="0" leftmargin="0">";

if(session_is_registered("loggedin"))
&#123;
        session_unregister("loggedin");
        echo $loginform2;
&#125;
else
&#123;
	echo $loginform3;
&#125;
?>

<br />
<table cellpadding="0" cellspacing="0" width="92%" border="0" align="center">
<tr>
<td colspan="2"><a href="index.php" class="NLINK">Techy Home</a></td>
</tr>
<tr>
<td width="20"></td>
<td><br /><b>NOTE: Remember, keep the language clean. Please no spamming. The cleaner the forum, the less the restrictions. Thanks. -Admin</b>
</td>
</tr>
</table>
<br /><br />
<table cellpadding="0" cellspacing="0" align="center" width="85%" class="TBL">
<tr>
<td bgcolor="#000000" height="12" align="center" colspan="3"><strong class="HEADER">Forums</strong></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="general"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="genforum.php" class="NLINK">General Conversation</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="computers"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="compforum.php" class="NLINK">Computers</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="games"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="gameforum.php" class="NLINK">Computer Games</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="web"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="webforum.php" class="NLINK">Web Design</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="ut"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="utforum.php" class="NLINK">Unreal Tournament</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="prog"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="progforum.php" class="NLINK">Programming</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="music"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="musicforum.php" class="NLINK">Music</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="weird"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="weirdforum.php" class="NLINK">Weird Stuff</a></td>
</tr>
<tr>
<td width="65" height="30" class="NAME2" align="center">
<?php $listquery = "select count(1) from forum where forumname="soft"";
$listresult = mysql_query($listquery);
while ($row = mysql_fetch_assoc($listresult)) &#123;
	echo $row&#1111;"count(1)"];
&#125; if($row&#1111;"count(1)"] == "1") &#123; echo " post"; &#125; else &#123; echo " posts"; &#125; ?></td>
<td width="8" height="30" bgcolor="#DDDDDD" class="FORLIST">&nbsp;</td>
<td width="*" height="30" bgcolor="#DDDDDD" class="FORLIST"><a href="softforum.php" class="NLINK">Computer Software</a></td>
</tr>
</table>
</body>
</html>
hope i helped 8O :wink: