I was messing around with a forum code earlier since I just added a user system to it but when I try to post something it doesn't include the username under the part where it says "Username:" :|
Does anyone know what is wrong with
Code:<html><body background="images/blue-bg.png"><title>Forums</title> <? ob_start(); session_start( ); require_once($_SERVER['DOCUMENT_ROOT'].'/indev/connect.php'); //check cookie if ($_SESSION['logged_in'] != 1 && isset($_COOKIE['login_cookie'])) { list($user, $pass) = explode('[]', $_COOKIE['login_cookie']); $qu = mysql_query("SELECT `user_password` FROM `members` WHERE `username` = '".addslashes($user)."'"); if (mysql_num_rows($qu) == 1) { $passw = mysql_fetch_object($qu); if ($passw->user_password == $pass) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user; $_SESSION['password'] = $pass; } } } if(!isset($_SESSION['username']) && !isset($_SESSION['password'])) { $_SESSION['logged_in'] = 0; $user = "Guest"; } $id=$_GET['id']; print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<A href='index.php'>Back</a>-<A href='post.php'><img border='0' src='images/newthread.gif'</a>-<A href='reply.php?id=$id'><img border='0' src='images/reply.gif'<br>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=20%>User</td><td width=80%>Post</td></tr>"; $gettopic="SELECT * from forumtutorial_posts where postid='$id'"; //$userid="SELECT * from members where user_id='$uID'"; $gettopic2=mysql_query($gettopic) or die("Could not get topic"); //$userid2=mysql_query($userid) or die("Could not find poster"); $gettopic3=mysql_fetch_array($gettopic2); //$userid3=mysql_fetch_array($userid2); print "<tr class='mainrow'><td valign='top'>$_SESSION[username]</td><td vakign='top'>Last replied to at $gettopic3[showtime]<br><hr>"; $message=strip_tags($gettopic3['post']); $message=nl2br($message); print "$message<hr><br>"; print "</td></tr>"; $getreplies="Select * from forumtutorial_posts where parentid='$id' order by postid desc"; //getting replies //$userid="Select * from members where username='$user'"; $getreplies2=mysql_query($getreplies) or die("Could not get replies"); //$userid2=mysql_query($userid) or die("Could not recieve username"); while($getreplies3=mysql_fetch_array($getreplies2)) //while($userid3=mysql_fetch_array($userid2)) { print "<tr class='mainrow'><td valign='top'>$_SESSION[username]</td><td vakign='top'>Last replied to at $getreplies3[showtime]<br><hr>"; $message=strip_tags($getreplies3['post']); $message=nl2br($message); print "$message<hr><br>"; print "</td></tr>"; } print "</table>"; ?>