Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 131
0 Users 11 Guests Online
Forum Index » PHP + MySQL » Member system logging out on v
Posted on Saturday 11th August 2007 at 08:50 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
If you read my last post I am creating a news system. I got pretty much it all working, except for one thing.

When I click read more, the member system logs me out, but why?

Here is my "readmore" case:

Code
case 'readmore':
$id = $_GET[id];
$newsie = mysql_query("SELECT * FROM `news` WHERE `id` = '$id'");
$newsie = mysql_fetch_array($newsie);
echo '<div align="center"><table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="1%" align="left" valign="top"><img src="images/blue_top_left.gif" width="7" height="7" /></td>
<td width="98%" background="images/blue_top.gif"></td>
<td width="1%" align="right" valign="top"><img src="images/blue_top_right.gif" width="7" height="7" /></td>
</tr>
<tr>
<td background="images/test.png" style="background-repeat: repeat-y; background-color: #305F7F"></td>
<td bgcolor="#305F7F" style="padding-bottom: 3px;"><div align="center"><span class="title">';
echo $newsie[subject]; echo '</span></div></td>

<td background="images/blue_right_side.gif" bgcolor="#305F7F" style="background-position: right; background-repeat: repeat-y"></td>
</tr>

</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF" style="padding: 5px;">
<tr>

<td><font size="1"><center>';

if($newsie[img]) {
echo "<img src='$newsie[img]'><BR><BR>$newsie[message] <BR><BR>$newsie[date] | $newsie[by]";
} else {
echo "$newsie[message]<BR><BR>$newsie[date] | $newsie[by] </table></td>
</tr>
</table></td>
</tr>
</table></div>";
}
$comment = mysql_query("SELECT * FROM `comments` WHERE `news_id` = '$id'");
$numa = mysql_num_rows($comment);
if($numa = 1) {
while ($comments = mysql_fetch_array($comment)) {
echo '</table></td>
</tr>
</table></td>
</tr>
</table></div><BR><BR><div align="center">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="1%" align="left" valign="top"><img src="images/blue_top_left.gif" width="7" height="7" /></td>
<td width="98%" background="images/blue_top.gif"></td>
<td width="1%" align="right" valign="top"><img src="images/blue_top_right.gif" width="7" height="7" /></td>
</tr>
<tr>
<td background="images/test.png" style="background-repeat: repeat-y; background-color: #305F7F"></td>
<td bgcolor="#305F7F" style="padding-bottom: 3px;"><div align="center"><span class="title">'; echo $comments[by]; echo ' Commented: </span></div></td>

<td background="images/blue_right_side.gif" bgcolor="#305F7F" style="background-position: right; background-repeat: repeat-y"></td>
</tr>

</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF" style="padding: 5px;">
<tr>

<td>';
echo "<font size=\"1\"><BR>$comments[message]<BR><BR><center>$comments[date]</center>"; echo '</i></center></tr>
</table></td>
</tr>
</table></td>
</tr>
</table></div>';
}
}

echo '</table></td>
</tr>
</table></td>
</tr>
</table></div><BR><BR>
<div align="center">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="1%" align="left" valign="top"><img src="images/blue_top_left.gif" width="7" height="7" /></td>
<td width="98%" background="images/blue_top.gif"></td>
<td width="1%" align="right" valign="top"><img src="images/blue_top_right.gif" width="7" height="7" /></td>
</tr>
<tr>
<td background="images/test.png" style="background-repeat: repeat-y; background-color: #305F7F"></td>
<td bgcolor="#305F7F" style="padding-bottom: 3px;"><div align="center"><span class="title">Add A Comment</span></div></td>

<td background="images/blue_right_side.gif" bgcolor="#305F7F" style="background-position: right; background-repeat: repeat-y"></td>
</tr>

</table></td>
</tr>

<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF" style="padding: 5px;">
<tr>';
echo "<form action=\"?page=postc&id=$id\" method=\"post\">"; echo '
<td><font size="1">Name: <input type="text" name="name" value=';
if($logged[username]) {
echo "\"$logged[username]\">";
} else {
echo "\"\">";
} echo '
<br>
<input type="hidden" name="hidden" value="'; echo "$id"; echo '">
<textarea cols="40" rows="6" id=commentsbox name="comments"></textarea><br />
<input type="submit" name="submit" value="Submit"> </td>
</center></tr>
</table></td>
</tr>
</table></td>
</tr>
</table></div>';
break;



It is quite big. The problem is when I attempt to view the Read more part + comments, I get logged out of the member system, why?

Thanks!
Posted on Sunday 12th August 2007 at 12:29 PM
ilyas-shezad
templates/default/images/noavatar.png's Avatar
Junior Member
Did u start the session? Or at least include the database connection file? or include a file with the session_start(); command in it?