Lavalair Wapdesire

Started on the old forum in November 2008 · view the original in the archive · old links redirect here

21 replies · 1,299 views · started 18 years ago · 1 min read

5 participants
monk77 Junior · 30 posts #1

By default only the owner of a profile can see a link to his own friends:

This is the code for this function:

$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "[b]Buddies:[/b] $nob[0]
";

example: My Buddies: 10

Now I want, that everybody can see, who is my friend. I want to use a link to my friends, which is shown to everybody in my profil, but it doesn't work

//////////////////////////////friends edit///////////////////////////
  
$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "[b]1 [/b]buddies : <a accesskey=\"1\" href=\"lists.php?action=buds&sid=$sid;uid=$nob[0]\">$nob[0]</a>
";
  
 //////////////////////////////////////////////////////////////////////////
honkytonkman Senior · 252 posts #2

QUOTE (monk77 @ Nov 28 2008, 03:57 PM) <{POST_SNAPBACK}>

By default only the owner of a profile can see a link to his own friends:

This is the code for this function:

$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "Buddies: $nob[0]
";

example: My Buddies: 10

Now I want, that everybody can see, who is my friend. I want to use a link to my friends, which is shown to everybody in my profil, but it doesn't work

//////////////////////////////friends edit///////////////////////////
  
$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "1 buddies : <a accesskey=\"1\" href=\"lists.php?action=buds&sid=$sid;uid=$nob[0]\">$nob[0]</a>
";
  
 //////////////////////////////////////////////////////////////////////////

good code..maybe the link to see buddies it don't works because there is somethin'wrong in php variables i don't have idea..i got my trubles trying to put hour/date in chatrooms message.. sometmes it's real hard making changes in others one script

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

monk77 Junior · 30 posts #3

Nobody does have an idea?

monk77 Junior · 30 posts #5

QUOTE (inca @ Nov 28 2008, 09:36 PM) <{POST_SNAPBACK}>

i got it on mine but its only for admins :P

well, the function could be edited. can you post your code?

something else Fellow · 2,296 posts #6

there is a slight error in it that i couldnt be bothered to work out lol (shows users aswell)

//////////////////////////////////users Buddies

else if($action=="ubuds")
{
    addonline(getuid_sid($sid),"Main Page","");
    $uid = getuid_sid($sid);
$who = $_GET["who"];
  $nick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$who."'"));
  echo "<head>";
  echo "<title>$sitename</title>";
  echo "</head>";
  echo "<body>";  
  echo "<div>
$nick[0]'s Buddies
</div>";
    echo "<p align=\"center\">";
    echo "$nick[0]`s Buddy Message
";
    echo parsemsg(getbudmsg($who));
    
    echo "</p>";
    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $num_items = getnbuds($who);
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
        $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='".$who."' OR b.tid='".$who."') AND b.agreed='1' GROUP BY 1,2  ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
    echo "

";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
        if($uid!=$item[2])
        {
          if(isonline($item[2]))
  {
    $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    $uact = "WHERE: ";
    $plc = mysql_fetch_array(mysql_query("SELECT place FROM ibwf_online WHERE userid='".$item[2]."'"));
    $uact .= $plc[0];
  }else{
    $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    $uact = "Last Active: ";
    $ladt = date("d m y-H:i:s", $item[0]);
    $uact .= $ladt;
  }
      $lnk = "<a href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$iml$item[1]</a>";
      echo "$lnk
";

      $bs = date("d m y-H:i:s",$item[5]);
      echo "Buddy since:$bs
";
      echo "$uact
";
      echo "Says: ";
      $bmsg = parsemsg(getbudmsg($item[2]));
      echo "$bmsg
";

      }
    }
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"lists.php?action=ubuds&page=$ppage&sid=$sid&view=$view&who=$who\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"lists.php?action=ubuds&page=$npage&sid=$sid&view=$view&who=$who\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
      $rets = "<form action=\"lists.php\" method=\"get\">";
      $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
      $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\">";
      $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\">";
      $rets .= "<input type=\"hidden\" name=\"who\" value=\"$who\">";
      $rets .= "<input type=\"Submit\" name=\"Submit\" Value=\"Go To Page\"></form>";
      echo $rets;
    }
    echo "</p>";
  ////// UNTILL HERE >>
    echo "<p align=\"center\">";
    //echo "<a href=\"index.php?action=chbmsg&sid=$sid\">";
//echo "Buddy Message</a>
";
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo "</body>";
  exit(); 
}
monk77 Junior · 30 posts #7

Hi Inca,

I want to test your script, but it's a little bit difficult. The first part of your script must be put in index.php and the second one in lists? What kind of error is that?

something else Fellow · 2,296 posts #8

oh i forgot heres the link for profiles:

$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "Buddies: <a href=\"lists.php?action=ubuds&who=$who&sid=$sid\">$nob[0]</a>
";

the error is that it shows the user aswell as there buddies lol it doesnt really matter to me so i havent bothered to code it out lol

monk77 Junior · 30 posts #9

I think actually, there is no way to show users' buddies.

@Inca

Can you tell me, where I must paste your code? First part of code in index.php und the secound one in lists.php?

monk77 Junior · 30 posts #10

QUOTE (monk77 @ Nov 30 2008, 11:09 AM) <{POST_SNAPBACK}>

I think actually, there is no way to show users' buddies.

@Inca

Can you tell me, where I must paste your code? First part of code in index.php und the secound one in lists.php?

I edited my lists.php, but the script don't work. It's such the same as my simple link does. If I klick to a user, nothing else as users name is show in his buddy-list. Why do you have a second lists-file? A few links go to lists2.php

edit: script works now, but why the second lists.php? Is this a must have oder can I edit the code from lists2.php in list.php in the links?

sweetangel Lead · 885 posts #11
$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mw_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "Buddies: <a href=\"../friends/".$swsid."action=member&who=$who\">$nob[0]</a>

";

this is my code 😛

if like my post click:

External image (may be gone)

honkytonkman Senior · 252 posts #12

QUOTE (sweetangel @ Nov 30 2008, 04:52 PM) <{POST_SNAPBACK}>

$nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mw_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
echo "Buddies: <a href=\"../friends/".$swsid."action=member&who=$who\">$nob[0]</a>

";

this is my code :P

but you need having a folder called "friends" to use it..

the italian/international COMMUNITY of friendship http://people2000.netne.net WAP/WEB peoplemailbox@katamail.com

ori Lead · 512 posts #13

so u want every1 2 see ur buddy list lol thats kinda weird but not that hard buddylist runs off ur own uid jus make another n run it off the users uid easy lol

monk77 Junior · 30 posts #14

QUOTE (honkytonkman @ Nov 30 2008, 05:17 PM) <{POST_SNAPBACK}>

but you need having a folder called "friends" to use it..

is this a joke or what does the folder friends contain?????????

ori Lead · 512 posts #15

u dnt use a folder wtf lol

something else Fellow · 2,296 posts #16

sorry yeah i got list2.php i tried to edit it back to list.php but i must have missed a few links 🙂 @ monk

monk77 Junior · 30 posts #17

QUOTE (something else @ Nov 30 2008, 08:37 PM) <{POST_SNAPBACK}>

sorry yeah i got list2.php i tried to edit it back to list.php but i must have missed a few links 🙂 @ monk

Do you mean, that there are more links, which are linked to lists2.php? In your code are three links which matched to lists2.php.

monk77 Junior · 30 posts #20

QUOTE (something else @ Nov 30 2008, 10:29 PM) <{POST_SNAPBACK}>

where ever it says list2.php change to list.php :)

I have done this directly after I add your code in my lists.php, but still I thought I ask you about lists2.php.

I had a little problem with your code. The default value of items_per_page is 5. Now one of my users have 10 buddies. The system will only show 5 buddies per page. This is almost correctly, but the link "next" (next page) doesn't shown. I check your code a few times, but I cannot detect a bug in code. Everthing seems to be ok. What is wrong with the code?

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