Jump to content

Recommended Posts

I have a forum but id like avaters at the side of the replys i have coded it to the best of my abilty can any one help i`ll show you my current code.

 

<?php 



//session_start();



include_once "includes/db_connect.php";



include_once "includes/functions.php";



include "includes/smile.php";



logincheck();



$username=$_SESSION['username'];



echo "<link href=includes/in.css rel=stylesheet type=text/css> ";







$mysql=mysql_query("SELECT * FROM users WHERE username='$username'");



$fetch=mysql_fetch_object($mysql);

$forum=$_GET['forum'];
$username=$_SESSION['username'];
$viewtopic = $_GET['viewtopic'];
$forum_look=$_GET['forum_look'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

mysql_query("UPDATE users SET viewingtopic='$viewtopic' WHERE username='$username'");

if($_GET[clean]) {
$clean=$_GET[clean];
if($fetch->userlevel == "0") { die('You cannot delete this post!'); }
mysql_query("DELETE FROM replys WHERE id='$clean' AND forum='$forum'") or die ("Cannot delete reply");
echo "Reply Deleted!";
echo "<meta http-equiv='refresh' content='1;url=right.php?forum=$forum&viewtopic=$viewtopic'>";
}



if (!$viewtopic){
die ("Please select a topic to post in.");
}

if ($forum == "Crew" && $fetch->crew != "0"){
$crew="1";

}
$owner=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$username' OR rhm='$username'"));


$userlevel=$fetch->userlevel;

if ($fetch->fban != "1"){



$ggee = mysql_query("SELECT locked, sticky, lastreply FROM topics WHERE id='$viewtopic' AND forum='$forum'");
while($dsdsd = mysql_fetch_row($ggee)){
$lockedornot = $dsdsd[0];
$stikornot = $dsdsd[1];
$lastreplyit = $dsdsd[2];
}

if ($crew == "1"){
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum' AND crew='$fetch->crew'");
}else{
$gg = mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum'");
}
while($success = mysql_fetch_row($gg)){
$username1 = $success[1];
$topictext = $success[3];
$made = $success[8];

}




?>
<table width=100% border=1 align=center cellpadding=1 cellspacing=0 bordercolor=black class=thinline>
  <tr>
    <td background=includes/grad.jpg height=20 align=left>Topic Made By - <? echo "<a href='profile.php?viewuser=$username1' target=middle>$username1</a>"; ?> On - <?php echo " <a target=middle>$made</a>"; ?></td>
  </tr>
  <tr>
    <td height=20><? echo replace($topictext);
if ($topictext == ""){ $topictext = "Main Forum";}?></td>
  </tr>
</table><br>
<p>



<?php

$forum_count = 10;

function index_navigation($index, $count, $num) {
$forum = $_GET['forum'];
$viewtopic = $_GET['viewtopic'];
if ($index != 0) {
print "<a href=\"right.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index - $count) . "\">Previous</a> ";
}
if ($num == $count) {
print " <a href=\"right.php?forum=$forum&viewtopic=$viewtopic&forum_look=" . ($index + $count) . "\">Next</a>";
}


}
if (! isset($forum_look) ) {
$forum_look = 0;
}
if ($crew == "1"){
$query="SELECT * FROM replys WHERE idto = '$viewtopic' AND forum='$forum' AND crew='$fetch->crew' ORDER by `id` DESC LIMIT $forum_look, $forum_count";
}else{
$query="SELECT * FROM replys WHERE idto = '$viewtopic' AND forum='$forum' ORDER by `id` DESC LIMIT $forum_look, $forum_count";
}


$query=mysql_query("$query");
$num=mysql_num_rows($query);
while($right=mysql_fetch_object($query)){



if ($fetch->userlevel > "0"){

$forumquote = mysql_query("SELECT * FROM users WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);
$mysql2=mysql_query("SELECT * FROM users WHERE username='$get->from'");



$get2=mysql_fetch_object($mysql2);







$t++;



$n++;


echo "
<table width='100%' border='1' cellpadding='1' cellspacing='0' bordercolor='#000000' class='thinline'>
  <tr>
    <td height='20' colspan='2' align='left' background='includes/grad.jpg' scope='col'>Reply Made By - <a href='profile.php?viewuser=$right->username' target=middle>$right->username</a> <u><font color=white>On</u> - $right->made <a href='?viewtopic={$viewtopic}&forum={$forum}&q={$right->id}'>[Quote]</a>  | [<a href='right.php?clean=$right->id&forum=$forum&viewtopic=$viewtopic'>DEL</a>]</font></td>
  </tr>
  <tr>
    <td width='10%' height='80' align='center' valign='middle'><img width=70 height=70 border=1 src='$get2->image'></td>
    <td width='90%' valign='top'>";
echo replace(stripslashes($right->text));


if($fq->forumquote == "") {
echo "</td></tr></table><br><p>";
}
else {
echo "</td></tr></table><br>
<p>"; }
}elseif ($userlevel == 0){




$forumquote = mysql_query("SELECT * FROM users WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);


echo "
<table width='100%' border='1' cellpadding='1' cellspacing='0' bordercolor='#000000' class='thinline'>
  <tr>
    <td height='20' colspan='2' align='left' background='includes/grad.jpg' scope='col'>Reply Made By - <a href='profile.php?viewuser=$right->username' target=middle>$right->username</a> <u><font color=white>On</u> - $right->made<a href='?viewtopic={$viewtopic}&forum={$forum}&q={$right->id}'></a></td>
  </tr>
  <tr>
    <td width='10%' height='80' align='center' valign='middle'><img width=70 height=70 border=1 src='$get2->image'></td>
    <td width='90%' valign='top'>";
echo replace(stripslashes($right->text));


if($fq->forumquote == "") {
echo "</td></tr></table><br><p>";
}
else {
echo "</td></tr></table><br>
<p>"; }
}



}
?>

<?php
index_navigation($forum_look, $forum_count, $num);
?>
<br>

<br>

<?

if (!$viewtopic){
die ("Please select a topic to post in.");
}

if(strip_tags($_POST['Submit']) && strip_tags($_POST['reply_text']) && $forum && $viewtopic){

$reply_text = addslashes(strip_tags($_POST['reply_text']));

$topic_info=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE id='$viewtopic' AND forum='$forum'"));


if ($topic_info->sticky == "1"){
$lastreplytime = $topic_info->lastreply;
}elseif ($stikornot == "0"){
$lastreplytime = time();
}



$date = gmdate('Y-m-d h:i:s');





if ($crew == "1" && $fetch->crew != "0"){
mysql_query("INSERT INTO `replys` (`id`, `username`, `text`, `forum`, `idto`,`made`,`crew`) VALUES ('', '$username', '$reply_text', '$forum', '$viewtopic','$date','$fetch->crew');") or die (mysql_error());
}else{
mysql_query("INSERT INTO `replys` (`id`, `username`, `text`, `forum`, `idto`,`made`) VALUES ('', '$username', '$reply_text', '$forum', '$viewtopic','$date');") or die (mysql_error());

}
mysql_query("UPDATE `user_info` SET `posts` = `posts`+1 WHERE username='$username'");

mysql_query("UPDATE topics SET lastreply='$lastreplytime' WHERE id='$viewtopic'");
echo "

<SCRIPT LANGUAGE='JavaScript'>
window.location='right.php?forum=$forum&viewtopic=$viewtopic';
</script>";

}
?>


<script language=JavaScript>
function so(dis)
{
for (i=0;i<dis.elements.length;i++){
if (dis.elements[i].type=='submit')
dis.elements[i].style.visibility='hidden';
}
if(fs==false){
fs=true;
return true;
}else
return false;
}
function goaway()
{
for(i=0;i<document.forms.length;i++)
document.forms[i].onsubmit = function() {return so(this);};
}
</script>
<link href="includes/in.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
color: #000000;
}
-->
</style>
<link href="includes/in.css" rel="stylesheet" type="text/css">
<body onload=goaway();>

<?
if ($_GET['q']){

$q = $_GET['q'];

$q = mysql_query("SELECT * FROM `replys` WHERE `id` = '{$q}' LIMIT 1")or die(mysql_error());
$a = mysql_fetch_array($q);

$user = $a['username'];
$txt = $a['text'];
$date = $a['made'];

$lol = ("

[quote]
[b]On:[/b] $date [b]$user wrote:[/b]


$txt
[/quote]");

}
}

?>
<?
if($info->forumbanned=='1'){
die("<font color=orange><center><br><br><b>Your forum banned</b></center>");
}
?>
<?
if ($topic_info->locked == "1"){
die("<font color=orange><center><br><br><b>Your forum banned</b></center>");
}
?>
<form action='' method=post>
  <p>
  <input name="forumto" type="hidden" value="<?php echo "$forum"; ?>">
  <input name="this" type="hidden" id="this" value="<?php echo "$viewtopic"; ?>">
</p>
  <center><div id="pnlreply" style="background-color:#737373;border-color:black;border-width:1px;border-style:Solid;width:50%;text-align:left;">
    <textarea name="reply_text" rows="2" cols="16" id="reply_text" value='?viewtopic={$viewtopic}&forum={$forum}&q={$right->id}' class="text_box" style="width: 100%;
            height: 135px"></textarea>
    <center><input type="submit" name="Submit" value="Reply" id="Submit" class="abutton"/></center>
  </div></center>
  <p> </p>
  <p> </p>
<p> </p>
</form>
<? if ($fetch->userlevel != "0"){?>
<center>


<td></td><td></td><td></td><td></td><td></td>


</tr>
</center>
</table>
<p>
  <? } ?>
</p>
<p> </p>

 

Also My quote button does not work ive tried looking through tutorials but the forum i want is simple but effective.

any questions id be happy to help

Link to comment
https://forums.phpfreaks.com/topic/163495-forum-reply-picture-problem/
Share on other sites

That's a lot of code... Perhaps asking a bit much of peoples good will there. Where abouts in the code do you want the avatar? Where does the avatar come from? Where abouts in the code is the functionality for your quote button, where is the quote button? What doesn't work with it?

yeah sorry about that ive underlined where id like the image

echo "
<table width='100%' border='1' cellpadding='1' cellspacing='0' bordercolor='#000000' class='thinline'>
  <tr>
    <td height='20' colspan='2' align='left' background='includes/grad.jpg' scope='col'>Reply Made By - <a href='profile.php?viewuser=$right->username' target=middle>$right->username</a> <u><font color=white>On</u> - $right->made <a href='?viewtopic={$viewtopic}&forum={$forum}&q={$right->id}'>[Quote]</a>  | [<a href='right.php?clean=$right->id&forum=$forum&viewtopic=$viewtopic'>DEL</a>]</font></td>
  </tr>
  <tr>
    <td width='10%' height='80' align='center' valign='middle'[u]><img width=70 height=70 border=1 src='$get2->image'></[/u]td>
    <td width='90%' valign='top'>";
echo replace(stripslashes($right->text));


if($fq->forumquote == "") {
echo "</td></tr></table><br><p>";
}
else {
echo "</td></tr></table><br>
<p>"; }
}elseif ($userlevel == 0){




$forumquote = mysql_query("SELECT * FROM users WHERE username = '$right->username'");
$fq = mysql_fetch_object($forumquote);


echo "
<table width='100%' border='1' cellpadding='1' cellspacing='0' bordercolor='#000000' class='thinline'>
  <tr>
    <td height='20' colspan='2' align='left' background='includes/grad.jpg' scope='col'>Reply Made By - <a href='profile.php?viewuser=$right->username' target=middle>$right->username</a> <u><font color=white>On</u> - $right->made<a href='?viewtopic={$viewtopic}&forum={$forum}&q={$right->id}'></a></td>
  </tr>
  <tr>
    <td width='10%' height='80' align='center' valign='middle'>[u]<img width=70 height=70 border=1 src='$get2->image'>[/u]</td>
    <td width='90%' valign='top'>";
echo replace(stripslashes($right->text));


if($fq->forumquote == "") {
echo "</td></tr></table><br><p>";
}
else {
echo "</td></tr></table><br>
<p>"; }
}



}
?>

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.