forum link with author name help to edit!

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

3 replies · 1,995 views · started 16 years ago · 3 min read

2 participants
arg0s12 Developer · 144 posts #1

how to put the name of the author in topic link like "New MMs Trick (0) (arg0s12) i try to edit but user id appear in topic link..heres the ode..

//////////////////////////////////View Forum

else if($action=="viewfrm")
{
  
    $fid = $_GET["fid"];
   $view = $_GET["view"];
    if(!canaccess(getuid_sid($sid), $fid))
    {
      addonline(getuid_sid($sid),"im viewing admin forum naughty me","");
      echo "<p align=\"left\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    addonline(getuid_sid($sid),"Viewing Forum","");
    addplace(getuid_sid($sid),"index.php?action=$action&fid=$fid&page=$page","");
  $finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));
    $fnm = htmlspecialchars($finfo[0]);
    echo "<p align=\"center\">";
    $norf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'"));
    if($norf[0]>0)
    {
        echo "<a href=\"rwrss.php?action=showfrss&sid=$sid&fid=$fid\"><img src=\"../images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a>";
    }
    echo "<a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>";
echo "<form action=\"index.php\" method=\"get\">";

   echo "View: <select name=\"view\">";
  echo "<option value=\"all\">All</option>";
  echo "<option value=\"new\">Since Last Visit</option>";
  echo "<option value=\"myps\">I posted In</option>";
  echo "</select>";
echo "<input type=\"submit\" value=\"Go\"/>";
  echo "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        echo "<input type=\"hidden\" name=\"sid\"  value=\"$sid\"/>";
echo "</form>";
      echo "<div class=\"partner\">";
ads();
echo"</div>";
  echo "<br/>";
   if($view=="new")
   {
      echo "Viewing topics that has no new posts since your last visit";
   }else if($view=="myps")
   {
      echo "Viewing topics contain posts by you";
   }else {
   echo "Viewing All topics";
   }
    echo "</p>";
    echo "<p>";
     if($page=="" || $page<=0)$page=1;
    if($page==1)
    {
      ///////////pinned topics
      $topics = mysql_query("SELECT id, name, closed, views, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='1' ORDER BY lastpost DESC, name, id LIMIT 0,5");
      while($topic = mysql_fetch_array($topics))
    {
      $iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
      $iml = "*";
      $atxt ="";
      if($topic[2]=='1')
      {
        //closed
        $atxt = "(X)";
      }
      if($topic[4]>0)
      {
        $pltx = "(P)";
      }else{
        $pltx = "";
      }
      $tnm = htmlspecialchars($topic[1]);
      $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
      echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$pltx$tnm$uid($nop[0])$atxt</a><br/>";

    }
    echo "<br/>";
  }
  $uid = getuid_sid($sid);
  if($view=="new")
  {
  
  $ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."'"));
  }
  else if($view=="myps")
  {
   $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.id) FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."'"));
  }
  else{
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0'"));
  }
    $num_items = $noi[0]; //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
    if($limit_start<0)$limit_start=0;
   if($view=="new")
   {
   $ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
    $topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
   }
   else if($view=="myps"){
   $topics = mysql_query("SELECT a.id, a.name, a.closed, a.views, a.moved, a.pollid FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."' GROUP BY a.id ORDER BY a.lastpost DESC, a.name, a.id  LIMIT $limit_start, $items_per_page");
   }
   else{
   $topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
   }
    
    while($topic = mysql_fetch_array($topics))
    {
      
      $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
      $iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
      if($nop[0]>24)
      {
        $iml = "<img src=\"../images/hot.gif\" alt=\"*\"/>";
      }
      if($topic[4]=='1')
      {
        $iml = "<img src=\"../images/moved.gif\" alt=\"*\"/>";
      }
      if($topic[2]=='1')
      {
        $iml = "<img src=\"../images/closed.gif\" alt=\"*\"/>";
      }
      if($topic[5]>0)
      {
        $iml = "<img src=\"../images/poll.gif\" alt=\"*\"/>";
      }
      $atxt ="";
      if($topic[2]=='1')
      {
        //closed
        $atxt = "(X)";
      }
      $tnm = htmlspecialchars($topic[1]);
      echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$tnm($nop[0])$unick$atxt</a><br/>";

    }

    echo "</p>";
    echo "<p align=\"center\">";
$tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  if($umsg>0)
  {
  echo "<a href=\"inbox.php?action=main&sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
  }
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=viewfrm&page=$ppage&sid=$sid&fid=$fid&view=$view\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=viewfrm&page=$npage&sid=$sid&fid=$fid&view=$view\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]<br/>";
        $rets .= "<go href=\"index.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"fid\" value=\"$fid\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
      $rets .= "<postfield name=\"view\" value=\"$view\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }

    echo "<a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>";
    $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
    if($cid[0]>0)
    {
    $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
    $cname = htmlspecialchars($cinfo[0]);
    echo "<a href=\"index.php?action=viewcat&sid=$sid&cid=$cid[0]\">";
    echo "$cname</a><br/>";
    }else{
        $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
        $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
        $cname = htmlspecialchars($cinfo[0]);
    echo "<a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">";
    echo "$cname Club</a><br/>";
    }
echo "<a href=\"index.php?action=forums&sid=$sid&browse?\">";
    echo "Forums</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Main Menu</a>";
echo "</p>";
echo "<div class=\"partner\">";
ads();
echo"</div>";
    echo "</body>";
}
thanatos Senior · 261 posts #2

Try this idea

$authorid = SELECT authorid FROM table_topic WHERE id='topic_id' [br/] $authorname = getnick($authorid[0]);
arg0s12 Developer · 144 posts #4

thanatos wrote: Try this idea

$authorid = SELECT authorid FROM table_topic WHERE id='topic_id' [br/] $authorname = getnick($authorid[0]);

thnkx bro.. its working... i try to edit and its o.k.. heres my edit code came from you

$authorid = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$topic[0]."'")); 
$authorname = getnick_uid($authorid[0]);

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close