Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Unhappy having problem with 2 php pages

    i am trying to code a friend online list it is done but facing some problem in the combination which is when user chat in the room it shows online but when the user is in the other pages it wont show online which means if the user is in room only show online in the buddylist and also in a sapart page like page 1 will show 10 then page 2 will show 20 like this. another problem is how do i end sessons like after pressing logout it will wont show online.i am posting all the details with code but just need to combine it but i am messed up with all the codes actually and my one is showing error so can anybody please help me.

    now here is the pages :
    1.THIS ONE SHOWS ONLINE OF ALL THE USERS ONLINE IN ROOM AND IN OTHER PAGES.WITH EACH PAGE 10 MEMBERS.[PERFECT WITH I WANT FOR BUDDYLIST]
    Code:
    <?
    
    echo "<card title=\"Users In Room\">";
    echo "<p align=\"$align\">";
    echo "<small>";
    
    $onl = mysql_fetch_array(mysql_query("SELECT COUNT(`id`) FROM chat_users WHERE ltime>'".intval(time()-$offline)."'"));
    echo "Users online: ".$onl[0]."<br/>\n";
    $memtot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `chat_users` where ltime >'".intval(time()-$offline)."'"));
    $CountUser = $memtot[0];
    $p = 10;
    if ($npage == ""){$npage = "1";}
    $dbfirst=($npage*$p)-$p;
    $first = $CountUser - ($p * ($npage - 1));
    $second = $CountUser - ($p * $npage) + 1;
    if ($second < 1) {$second = 1;}
    $npages = ceil(($CountUser)/$p);
    if ($npage <= $npages and $npage>1) $gline_rew = "<a href=\"".$_SERVER["PHP_SELF"]."?npage=".($npage-1)."&amp;action=inchat&amp;orderby=$orderby\">&#171; Prev</a>";
    if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"".$_SERVER["PHP_SELF"]."?npage=".($npage+1)."&amp;action=inchat&amp;orderby=$orderby\">Next &#187;</a>";
    $q = @mysql_query("select login from `chat_users` where  ltime >'".intval(time()-$offline)."' order by `id` asc LIMIT ".$dbfirst.",".$p."");
     while($arr = @mysql_fetch_array($q)) {
    print "<a href=\"ouser.php?action=viewuser&amp;baction=$action&amp;dblogin=".$arr['login']."\">*</a>".$arr['login']."<br/>";
             }
    
    echo "<br/>";
    echo "$gline_rew $gline_next<br/>";
    echo "Page $npage of $npages<br/>";
    if($npages>2)echo 'Jump to Page: <input emptyok="true" name="q" format="*N" size="3" value="" /><a href="'.$_SERVER["PHP_SELF"].'?npage=$(q)&amp;action=inchat&amp;orderby='.$orderby.'">Jump</a><br/>';
    echo "<a href=\"index.php?time=".time()."\">&#171;Back</a>\n";
    
    
    ?>

    2.THIS ONE IS THE FRIENDLIST/BUDDYLIST PAGE WITH SHOWS ONLY USERS ONLINE IN CHATROOM NOT IN OTHER PAGES.ALSO I CANT MAKE IT IN PAGES LIKE FIRST PAGE 10 SECOND PAGE WILL SHOW NEXT 10.LIKE THE 1ST ONE I SHOWED I WANT IT TO BE LIKE THAT BUT ONLY SHOW FRIENDS THATS ARE ADDED NOT ALL THE USERS.

    Code:
    $user = mysql_fetch_assoc($q);
    
    
    $q = @mysql_query("select * from `buddylist` where `test`='".$user['login']."' and ci='".$ci."' and agreed='".$p."';");
    while($man = @mysql_fetch_array($q)) {
    
    $rs = @mysql_query("select * from `chat_users` where login='".$man['name']."' and `ltime`>'".intval(time()-$offline)."';");
    $d = @mysql_fetch_array($rs);
    
    $rr = @mysql_query("select * from `chat_users` where login='".$man['name']."';");
    $r = @mysql_fetch_array($rr);
    echo "".$man['name'].",
    <a href=\"./user.php?".SID."&amp;nocache=$nocache&amp;room=$room&amp;m=$n&amp;dblogin=".$man['name']."\">Pm</a>";
    
     
    $rss = @mysql_query("select `name` from `chat_rooms` where id='".$d['room']."';");
    
    
    $dd = @mysql_fetch_array($rss);
    
    if ($d['room']=="") { echo " Offline<br/>"; } else { echo " <b>Online</b><br/>"; } }

    so can anybody help me out here please.[Sorry for my bad english i know it hard to understand a liltle bit]

    Thanks in advance.

  • #2
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts
    nobody to help me pplease ???


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •