Buddylist Display

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

    Buddylist Display

    how do u let a buddylist display eg.

    buddylist(1/0)

    #2
    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$mybuds = getnbuds($uid);
    $onbuds = getonbuds($uid);
    echo "Buddies($onbuds/$mybuds)";</div>

    WapCHAT Forum Currenltly changing over to xhtml

    My Dowloads Site

    Comment


      #3
      <div class='quotetop'>QUOTE (lamar-wap @ Jul 3 2006, 11:14 PM) <{POST_SNAPBACK}></div>
      how do u let a buddylist display eg.

      buddylist(1/0)[/b]
      <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
      /////////////////////////////in core
      //////////////////////////////////function get n. of buds

      function getnbuds($uid)
      {
      $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM libwf_buddies WHERE (uid=&#39;".$uid."&#39; OR tid=&#39;".$uid."&#39;) AND agreed=&#39;1&#39;"));
      return $notb[0];
      }

      /////////////////////////////get no. of requists

      function getnreqs($uid)
      {
      $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE tid=&#39;".$uid."&#39; AND agreed=&#39;0&#39;"));
      return $notb[0];
      }
      function getonbuds($uid)
      {
      $counter =0;
      $buds = mysql_query("SELECT uid, tid FROM ibwf_buddies WHERE (uid=&#39;".$uid."&#39; OR tid=&#39;".$uid."&#39;) AND agreed=&#39;1&#39;");
      while($bud=mysql_fetch_array($buds))
      {
      if($bud[0]==$uid)
      {
      $tid = $bud[1];
      }else{
      $tid = $bud[0];
      }
      if(isonline($tid))
      {
      $counter++;
      }
      }
      return $counter;
      }
      //////////////in index
      $uid = getuid_sid($sid);
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
      echo "<img src=\"images/bil.gif\" alt=\".\"/><a href=\"lists.php?action=buds&amp;sid=$sid\">buddie s</a>($onbuds/$mybuds)
      ";</div>

      Comment


        #4
        <div class='quotetop'>QUOTE (valentin2br @ Feb 22 2009, 07:38 AM) <{POST_SNAPBACK}></div>
        <div class='codetop'>CODE
        <div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
        /////////////////////////////in core
        //////////////////////////////////function get n. of buds

        function getnbuds($uid)
        {
        $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM libwf_buddies WHERE (uid=&#39;".$uid."&#39; OR tid=&#39;".$uid."&#39;) AND agreed=&#39;1&#39;"));
        return $notb[0];
        }

        /////////////////////////////get no. of requists

        function getnreqs($uid)
        {
        $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE tid=&#39;".$uid."&#39; AND agreed=&#39;0&#39;"));
        return $notb[0];
        }
        function getonbuds($uid)
        {
        $counter =0;
        $buds = mysql_query("SELECT uid, tid FROM ibwf_buddies WHERE (uid=&#39;".$uid."&#39; OR tid=&#39;".$uid."&#39;) AND agreed=&#39;1&#39;");
        while($bud=mysql_fetch_array($buds))
        {
        if($bud[0]==$uid)
        {
        $tid = $bud[1];
        }else{
        $tid = $bud[0];
        }
        if(isonline($tid))
        {
        $counter++;
        }
        }
        return $counter;
        }
        //////////////in index
        $uid = getuid_sid($sid);
        $mybuds = getnbuds($uid);
        $onbuds = getonbuds($uid);
        echo "<img src=\"images/bil.gif\" alt=\".\"/><a href=\"lists.php?action=buds&amp;sid=$sid\">buddie s</a>($onbuds/$mybuds)
        ";</div>[/b][/quote]
        might help if the sql was right ??????? lol
        is it libwf_buddies or ibwf_buddies lol :P

        Comment


          #5
          <div class='quotetop'>QUOTE (something else @ Feb 24 2009, 01:45 AM) <{POST_SNAPBACK}></div>
          might help if the sql was right ??????? lol
          is it libwf_buddies or ibwf_buddies lol :P[/b]
          that depend from site owner !
          it could be also xxx_buddies or anything_buddies
          It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
          ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
          ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
          キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

          Comment


            #6
            but if I wont show buddy list of users??any1 have this code?
            if like my post click:

            http://coding-talk.com/images/totall...ost_thanks.gif

            Comment


              #7
              Code:
              $sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a INNER JOIN ibwf_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid=&#39;".$uid."&#39; OR b.tid=&#39;".$uid."&#39;) AND b.agreed=&#39;1&#39; AND a.id!=&#39;".$uid."&#39; GROUP BY 1,2 ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
              hey change $UID to $WHO

              Code:
              $sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a INNER JOIN ibwf_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid=&#39;".$who."&#39; OR b.tid=&#39;".$who."&#39;) AND b.agreed=&#39;1&#39; AND a.id!=&#39;".$who."&#39; GROUP BY 1,2 ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
              and dont forget to add

              $who = $_GET["who"];

              example

              Code:
              else if($action=="buds")
              {
                  addonline(getuid_sid($sid),"Viewing Buddies List","lists.php?action=buds");
                  echo "<card id=\"main\" title=\"Buddies\">";
              $who = $_GET["who"];
                  echo "<p align=\"center\">";
                  //echo "<img src=\"logos/buddylist.gif\" alt=\"buddylist\"/>
              ";
                  //////ALL LISTS SCRIPT <<
                  if($page=="" || $page<=0)$page=1;
                  $num_items = getnbuds($who); //changable
                  $items_per_page= 10;
                  $num_pages = ceil($num_items/$items_per_page);
                  if(($page>$num_pages)&&$page!=1)$page= $num_pages;
                  $limit_start = ($page-1)*$items_per_page;
              
                  //changable sql
                      $sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a INNER JOIN ibwf_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid=&#39;".$who."&#39; OR b.tid=&#39;".$who."&#39;) AND b.agreed=&#39;1&#39; AND a.id!=&#39;".$who."&#39; GROUP BY 1,2  ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
              
              
                  echo "<p align=\"center\">";
                  $items = mysql_query($sql);
                  echo mysql_error();
                  if(mysql_num_rows($items)>0)
                  {
                  while ($item = mysql_fetch_array($items))
                  {
                      
                        if(isonline($item[2]))
                {
                  $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>";
                }else{
                  $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
                }
                    $bmsg = parsemsg(getbudmsg($item[2]), $sid);
                    if($bmsg!="")
                    {
                    $budmood="($bmsg)";
                    }else{
                    $budmood="";
                    }
                    $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$iml$item[1]</a>$budmood";
                    echo "$lnk
              ";
                  }
                  }
                  echo "</p>";
                  echo "<p align=\"center\">";
                  if($page>1)
                  {
                    $ppage = $page-1;
                    echo "<a href=\"lists.php?action=buds&amp;page=$ppage&amp;sid=$sid&amp;view=$view\">«Prev</a> ";
                  }
                  if($page<$num_pages)
                  {
                    $npage = $page+1;
                    echo "<a href=\"lists.php?action=buds&amp;page=$npage&amp;sid=$sid&amp;view=$view\">Next»</a>";
                  }
                  echo "
              $page/$num_pages
              ";
                  if($num_pages>2)
                  {
                    $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
                      $rets .= "<anchor>[GO]";
                      $rets .= "<go href=\"lists.php\" method=\"get\">";
                      $rets .= "<postfield name=\"action\" value=\"$action\"/>";
                      $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
                      $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
                      $rets .= "</go></anchor>";
              
                      echo $rets;
                  }
                  echo "</p>";
                ////// UNTILL HERE >>
                echo "<p align=\"center\">";
                echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                echo "</p>";
                echo "</card>";
              }

              Comment

              Working...
              X