I need some help with my commenting system. at the moment the code is like this:
<div id="pagepannel">
<div id="ptop_small">Comments</div>
<div id="pbottom_small">
<p>
<?php
//
if ($allow_comments == "no") {
?>
</p>
<p>No Posting comments here!!!</p>
<p> </p>
<p> </p>
<p>
<?php } else ?>
</p>
<p>
<?php
$sql = "SELECT comment_id, blog_id, posted_by, comment, stamp, email, type FROM jscrgaming_newscomments WHERE blog_id='$blog_id' ORDER BY comment_id DESC";
$result = mysql_query($sql) or die('Error : ' . mysql_error());
while(list($comment_id, $blog_id_co, $username, $comment, $stamp, $email, $type) = mysql_fetch_array($result, MYSQL_NUM))
{
if ($type == 'user'){
?>
</p>
<table width="95%" border="0" cellpadding="0" cellspacing="0" class="full_border">
<tr>
<td width="75" id="avatar"></td>
<td><span class="capitalize"><a href="userinfo.php?user=<? echo $username ?>"><strong><? echo $username ?></strong></a></span><strong> posted</strong>: <? echo stripslashes($comment) ?></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CAE4FF" class="date"><? echo $stamp ?> </td>
</tr>
</table>
<p> </p>
<p>
<? }
else{
?>
</p>
<table width="95%" border="0" cellpadding="0" cellspacing="0" class="full_border">
<tr>
<td><strong> <? echo $username ?>posted</strong>: <? echo stripslashes($comment) ?></td>
</tr>
<tr>
<td bgcolor="#CAE4FF" class="smalltext"><? echo $stamp ?>:: User Was Guest</td>
</tr>
</table>
<p> </p>
<p>
<? } }?>
</p>
<p>
<?php
//
if ($allow_comments == "restricted") {
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){?>
</p>
<form id="form3" name="form3" method="post" action="user/admin/blog/comment_system/user.php">
<p> </p>
<table width="95%" border="0" align="center" cellspacing="2" class="full_border">
<tr>
<td colspan="2">You are commenting as <?php echo $session->username;?></td>
</tr>
<tr>
<td width="75">Message</td>
<td><textarea name="co_comment" cols="30" id="textfield10"></textarea></td>
</tr>
<tr>
<td width="75"><span class="header">
<input name="co_username" type="hidden" id="co_username" value="<?php echo $session->username;?>" />
<input name="co_blog_id" type="hidden" id="co_blog_id" value="<?php echo $blog_id ?>" />
</span></td>
<td><label>
<input type="submit" class="blog_button" value=" Post " />
</label></td>
</tr>
<tr>
<td> </td>
<td class="smalltext">only 200 charaters can be used</td>
</tr>
</table>
</form>
<p> </p>
<p>
<? } else {?>
</p>
<p> </p>
<table width="95%" border="0" align="center" cellspacing="2" class="full_border">
<tr>
<td width="75"><span class="capitalize">Name</span></td>
<td><label>
<input name="textfield5" type="text" disabled="disabled" id="textfield5" size="35" />
</label></td>
</tr>
<tr>
<td width="75">Email</td>
<td><input name="textfield5" type="text" disabled="disabled" id="textfield6" size="35" /></td>
</tr>
<tr>
<td width="75">Message</td>
<td><textarea name="textfield5" cols="30" disabled="disabled" id="textfield7">You need to be logged in to comment.</textarea></td>
</tr>
<tr>
<td width="75"> </td>
<td><label>
<input type="button" class="blog_button" value=" Post " />
</label></td>
</tr>
</table>
<p> </p>
<p>
<?php } } else {
if($session->logged_in){?>
</p>
<form id="form2" name="form2" method="post" action="user/admin/blog/comment_system/user.php">
<p> </p>
<table width="95%" border="0" align="center" cellspacing="2" class="full_border">
<tr>
<td colspan="2">You are commenting as <?php echo $session->username;?></td>
</tr>
<tr>
<td width="75">Message</td>
<td><textarea name="co_comment" cols="30" id="textfield8"></textarea></td>
</tr>
<tr>
<td width="75"><input name="co_username" type="hidden" id="co_username" value="<?php echo $session->username;?>" />
<input name="co_blog_id" type="hidden" id="co_blog_id" value="<?php echo $blog_id ?>" /></td>
<td><label>
<input type="submit" class="blog_button" value=" Post " />
</label></td>
</tr>
<tr>
<td> </td>
<td><span class="smalltext">only 200 charaters can be used</span></td>
</tr>
</table>
</form>
<p> </p>
<p>
<? } else { ?>
</p>
<form id="form1" name="form1" method="post" action="user/admin/blog/comment_system/guest.php">
<p> </p>
<table width="95%" border="0" align="center" cellspacing="2" class="full_border">
<tr>
<td width="75"><span class="capitalize">Name</span></td>
<td><label>
<input name="co_username" type="text" id="co_username" size="35" />
</label></td>
</tr>
<tr>
<td width="75">Email</td>
<td><input name="guest_email" type="text" id="guest_email" size="35" /></td>
</tr>
<tr>
<td width="75">Message</td>
<td><textarea name="co_comment" cols="30" id="co_comment"></textarea></td>
</tr>
<tr>
<td width="75">Spam</td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"><? require_once('user/captcha/recaptchalib.php');
$publickey = "6Ld_W7sSAAAAAPNTLWrUJLEClFpSSPu1d1Ry5zNR"; // you got this from the signup page
echo recaptcha_get_html($publickey); ?></td>
</tr>
<tr>
<td colspan="2" align="right"><span class="smalltext">only 200 charaters can be used</span>
<input name="co_blog_id" type="hidden" id="co_blog_id" value="<?php echo $blog_id ?>" />
<input type="submit" class="blog_button" value=" Post " /></td>
</tr>
</table>
</form>
<p> </p>
<p>
<? } } ?>
</p>
<p> </p>
<div></div>
</div>
</div>
I, know its a bit messy but lets me see it and design it in Dreamweaver
Any way, for the comment system for users, I want it to show their avatar as well, which is stored in the users table. How would one do this.
I did think of it submitting the avatar along with the post but then it wouldnt update if the user would to change their avatars :\
Any helps???