Jump to content

Making a blog.help plz.


Davie33

Recommended Posts

Hi am in the middle of making a blog but am having problems with one page am working on if anyone can help me plz.

What is am looking for is to post username and avatar instead of just the username.

I have already paid some guy to work on this but he didnt get back to me and  ihave no more cash to give for the code to be finished so

i would really appreciate if someone could help to finish this off plz thanks.

 

this is the where the username and text shows which i would like avatar to show as well.

<?php
    $query = yasDB_select("SELECT * FROM user WHERE username = '$user'");
$row = $avatarfile;
$query = yasDB_select("SELECT * FROM topic WHERE userid = '$id' ORDER BY id DESC LIMIT 5");
    if($query->num_rows == 0) { ?>
<div id="memberstext">This topic has no comments, be the first to add one!</div>
<?php 
} 
else { 
	while($row = $query->fetch_array(MYSQLI_ASSOC)) {
		$text = $row['comment'];
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/biggrin.gif" title="biggrin" alt="biggrin" />',$text);
		$text = str_replace(':?','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/confused.gif" title="confused" alt="confused" />',$text);
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cool.gif" title="cool" alt="cool" />',$text);
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cry.gif" title="cry" alt="cry" />',$text);
		$text = str_replace(':shock:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/eek.gif" title="eek" alt="eek" />',$text);
		$text = str_replace(':evil:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/evil.gif" title="evil" alt="evil" />',$text);
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/lol.gif" title="lol" alt="lol" />',$text);
		$text = str_replace(':x','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/mad.gif" title="mad" alt="mad" />',$text);
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/stlyes/images/smileys/razz.gif" title="razz" alt="razz" />',$text);
		$text = str_replace(':oops:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/redface.gif" title="redface" alt="redface" />',$text);
		$text = str_replace(':roll:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/rolleyes.gif" title="rolleyes" alt="rolleyes" />',$text);
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/sad.gif" title="sad" alt="sad" />',$text);					
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/smile.gif" title="smile" alt="smile" />',$text);
		$text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/surprised.gif" title="surprised" alt="surprised" />',$text);
		$text = str_replace(':twisted:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/twisted.gif" title="twisted" alt="twisted" />',$text);
		$text = str_replace(':wink:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/wink.gif" title="wink" alt="wink" />',$text);
            if ( $row['useavatar'] == '1' ) {
        $avatarimage = $siteurl . 'avatars/' . $row['avatarfile'];
            }
            else { 
        $avatarimage = $siteurl . 'avatars/useruploads/noavatar.gif';
            } ?>			
		<div id="box">
		<div class="name"><img src="<?php echo $avatarimage;?>" height="40" width="40" align="left"><br /><?php echo $row['name'];?></div>
		<div class="comment_text"><?php echo $text;?></div></div> 

 

This is the form part of it to add the text

<div id="box2">	
<form name="addcomment" method="post" action="">
<strong>Message:</strong><br />
			<textarea name="comment" rows="3" cols="40" id="comment_message"></textarea><br />
			<input name="userid" type="hidden" value="<?php echo $id;?>" />
			<input type="hidden" name="timestamp" id="timestamp" value="<?php echo time(); ?>" />
			</center>
			<!-- start of smiles --> 
			<div id="smiles"><center>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/biggrin.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :? ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/confused.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/cool.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/cry.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :shock: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/eek.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :evil: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/evil.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/lol.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :x ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/mad.gif';?>" border="0"  /></a><br />
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/razz.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :oops: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/redface.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :roll: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/rolleyes.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/sad.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/smile.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie('  ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/surprised.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :twisted: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/twisted.gif';?>" border="0"  /></a>
		<a href="javascript:addsmilie(' :wink: ')"><img src="<?php echo $siteurl.'templates/'.$theme.'/styles/images/smileys/wink.gif';?>" border="0"  /></a>
	</center></div>
<input name="name" type="hidden" value="<?php echo $_SESSION['user'];?>" /><br />
		    <input name="addcomment" type="submit" value="Add Comment" style="border: 1px solid #000; margin-top: 2px;" />
		    </form></div> 

Link to comment
Share on other sites

hi can anyone help please am looking to add the member that made the topic with date and time and for the members avatar to show if anyone can help me with this please.

 

<?php
if(!isset($_SESSION["user"])) { 
    $user=$_SESSION["user"];
  $id=$_SESSION["userid"];?>
<div id="reg">You must Register or log in to view this topic.</div>
<?php 
} else {
if(isset($_POST['addcomment'])) {
	if(empty($_POST['userid'])) { ?>
<div id="invalid">Sorry, the topic you were commenting seems to be invalid.</div>
<?php	
}
	elseif(empty($_POST['comment']) || empty($_POST['name'])) { ?>
<div id="empty">Please go back and try again, it seems the comment or name was left empty.</div>
<?php
	}
	else {
		$userid = yasDB_clean($_POST['userid']);
		$comment = yasDB_clean($_POST['comment'],true);
		$name = yasDB_clean($_POST['name']);
		$ipaddress = $_SERVER['REMOTE_ADDR'];
		yasDB_insert("INSERT INTO `topic` (userid, comment, ipaddress, name) values ('{$userid}', '{$comment}', '{$ipaddress}', '{$name}')",false);
		?>
<div id="comment_added">Comment added!</div>
<?php			
	}
}
$id = yasDB_clean($_GET['id']);
$query = yasDB_select("SELECT * FROM `user` WHERE id = '$id'");
$row = $query->fetch_array(MYSQLI_ASSOC);
$query->close();
$id = yasDB_clean($_GET['id']);
$query = yasDB_select("SELECT * FROM `blog` WHERE id = '$id'",false);
$row = $query->fetch_array(MYSQLI_ASSOC);
$query->close();
$blog = $row['text'];
$blog = $row['topic'];
if ( $row['useavatar'] == '1' ) {
$avatarimage = $siteurl . 'avatars/' . $row['avatarfile'];
}
else { 
$avatarimage = $siteurl . 'avatars/useruploads/noavatar.jpg';
}	
?>
<div id="blog"><?php echo $row['text'];?></div>
<div id="stats">Username:<?php echo $row['username'];?><br>
<img src="<?php echo $avatarimage;?>" height="100" width="100"></div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.