forum link with author name help to edit!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    forum link with author name help to edit!

    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..
    Code:
    //////////////////////////////////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&amp;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&amp;fid=$fid&amp;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&amp;sid=$sid&amp;fid=$fid\"><img src=\"../images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a>";
        }
        echo "<a href=\"index.php?action=newtopic&amp;sid=$sid&amp;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&amp;sid=$sid&amp;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&amp;sid=$sid&amp;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&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
      }
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=viewfrm&amp;page=$ppage&amp;sid=$sid&amp;fid=$fid&amp;view=$view\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=viewfrm&amp;page=$npage&amp;sid=$sid&amp;fid=$fid&amp;view=$view\">Next&#187;</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&amp;sid=$sid&amp;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&amp;sid=$sid&amp;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&amp;sid=$sid&amp;clid=$cid[0]\">";
        echo "$cname Club</a><br/>";
        }
    echo "<a href=\"index.php?action=forums&amp;sid=$sid&amp;browse?\">";
        echo "Forums</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Main Menu</a>";
    echo "</p>";
    echo "<div class=\"partner\">";
    ads();
    echo"</div>";
        echo "</body>";
    }

    #2
    Try this idea
    Code:
    $authorid = SELECT authorid FROM table_topic WHERE id='topic_id' [br/] $authorname = getnick($authorid[0]);

    Comment


      #3
      ok bro.. i try..

      Comment


        #4
        Originally posted by thanatos View Post
        Try this idea
        Code:
        $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
        Code:
        $authorid = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$topic[0]."'")); 
        $authorname = getnick_uid($authorid[0]);

        Comment

        Working...
        X