online kist male & female

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

    online kist male & female

    Hey guys who can help me i need a code to show who online but male alone and female alone

    index.php
    Code:
     if ($action=="online")           {
            echo "<card id=\"viewforum\" title=\"Online list\">";
            echo "<p align=\"center\">";
            $onlinetot=mysql_fetch_array(mysql_query("SELECT DISTINCT COUNT(*) FROM online WHERE username IS NOT NULL"));
            $onlinetot[0]=$onlinetot[0]-1;
            $onlinetot=ceil($onlinetot[0]/10);
            $pagefrw=$page+1;
            $pagepws=$page-1;
            echo onlinelist($nick,$pass,$page);
            echo "<br/>";
            if ($page<$onlinetot) echo "<a href=\"index.php?action=online&amp;nick=$nick&amp;pass=$pass&amp;page=$pagefrw\">Next »</a><br/>";
            $page=$page-2;
            if ($page>-1) echo "<a href=\"index.php?action=online&amp;nick=$nick&amp;pass=$pass&amp;page=$pagepws\">« Prev</a><br/>";
            $page=$page+2;
            if ($onlinetot==0) $onlinetot=1;
            echo "Page: $page/$onlinetot<br/>";
            echo "<br/><a href=\"index.php?nick=$nick&amp;pass=$pass\"><img src=\"./images/home.gif\" alt=\"*\"/>Forum Home</a><br/>";
            echo "</p>";
            echo "</card>";
                                               }
    core.php
    Code:
    ///////////////////////////////////Online////////////////////////////////////
    function onlineadd($nick)
             {
              $nick=strtolower($nick);
              $taimautas_sekundem = 500;
              $laikas = time();
              $timeout = $laikas-$taimautas_sekundem;
               if ($nick!=null) {
              $insert = mysql_query("INSERT INTO online VALUES
              ('".$laikas."','".$nick."')");  }
              $deleted = mysql_query("DELETE FROM online WHERE laikas<".$timeout."");
             };
    this is the code im using
    Last edited by riderz; 17.06.09, 03:40. Reason: mis spelled

    #2
    Here are the code i use at my site now

    Code:
    else if($action=="online")
    {
     $showavatar = mysql_fetch_array(mysql_query("SELECT showavatar FROM ibwf_users WHERE id='".$uid."'"));
      addonline(getuid_sid($sid),"Online List - xHTML","");
    $pstyle = gettheme($sid);
        echo xhtmlhead("Online List",$pstyle);
    
    
      //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $num_items = getnumonline(); //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;
    //changable sql
        $sql = "SELECT
                a.name, b.place, b.userid, sex, perm FROM ibwf_users a
                INNER JOIN ibwf_online b ON a.id = b.userid
                GROUP BY 1,2
                LIMIT $limit_start, $items_per_page
        ";
        echo "<p><small>";
    getalert($sid);
    echo "<meta http-equiv=\"refresh\" content=\"30; url=index.php?action=online&amp;sid=$sid\">";
        $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
        print "Most online: <b>$mols[1]</b><br/>";
        $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
        print "Most online today only: <b>$mols[0]</b><br/>";
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm ='4' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=codes&amp;sid=$sid\">Coders ".$noi[0]."</a><br/>";
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE specialid>'0' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=vipol&amp;sid=$sid\">V.I.P ".$noi[0]."</a><br/>";
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=stfol&amp;sid=$sid\">Staff ".$noi[0]."</a><br/>";
      $timeout = (time() - $timeadjust)  - 180;
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
        {
          if ($item[3]=="M"){
          $icon = "<img src=\"images/male.gif\" alt=\"M\"/>";
          }else
          if ($item[3]=="F"){
          $icon = "<img src=\"images/female.gif\" alt=\"F\"/>";
          }
            if ($item[4]=="1")
              {
              $lnk = "<a class=\"mod\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="2")
              {
              $lnk = "<a class=\"admin\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="3")
              {
              $lnk = "<a class=\"owner\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="4")
              {
              $lnk = "<a class=\"coder\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
    /////////////////////online avatar
     if($showavatar[0]=="1")
    {
    $avlink = getavatar($item[2]);
    if ($avlink!=""){
    echo "<img src=\"$avlink\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }else{
    echo "<img src=\"/images/nopic.jpg\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }
    }
    /////////////////////////////////////
          $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
          echo "$icon $lnk - $item[1] <br/>";
        }
        echo "</small></p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
          echo getjumper($action, $sid,"index");
        }
        echo "</p>";
      ////// UNTILL HERE >>
    
      echo "<p align=\"center\">";
      $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    //////////////////////////////////////////////////////////////////Male Online
    else if($action=="monline")
    {
     $showavatar = mysql_fetch_array(mysql_query("SELECT showavatar FROM ibwf_users WHERE id='".$uid."'"));
      addonline(getuid_sid($sid),"Online List - xHTML","");
    $pstyle = gettheme($sid);
        echo xhtmlhead("Online List",$pstyle);
    
    
      //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $num_items = getnumonline(); //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;
    //changable sql
        $sql = "SELECT
                a.name, b.place, b.userid, sex, perm FROM ibwf_users a
                INNER JOIN ibwf_online b ON a.id = b.userid WHERE a.sex='M'
                GROUP BY 1,2
                LIMIT $limit_start, $items_per_page
        ";
    
    
        echo "<p><small>";
    getalert($sid);
    echo "<meta http-equiv=\"refresh\" content=\"30; url=index.php?action=monline&amp;sid=$sid\">";
        $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
        print "Most online: <b>$mols[1]</b><br/>";
        $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
        print "Most online today only: <b>$mols[0]</b><br/>";
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm ='4' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=codes&amp;sid=$sid\">Coders ".$noi[0]."</a><br/>";
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE specialid>'0' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=vipol&amp;sid=$sid\">V.I.P ".$noi[0]."</a><br/>";
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=stfol&amp;sid=$sid\">Staff ".$noi[0]."</a><br/>";
      $timeout = (time() - $timeadjust)  - 180;
    
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
        {
          if ($item[3]=="M"){
          $icon = "<img src=\"images/male.gif\" alt=\"M\"/>";
          }else
          if ($item[3]=="F"){
          $icon = "<img src=\"images/female.gif\" alt=\"F\"/>";
          }
            if ($item[4]=="1")
              {
              $lnk = "<a class=\"mod\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="2")
              {
              $lnk = "<a class=\"admin\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="3")
              {
              $lnk = "<a class=\"owner\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="4")
              {
              $lnk = "<a class=\"coder\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
    /////////////////////online avatar
     if($showavatar[0]=="1")
    {
    $avlink = getavatar($item[2]);
    if ($avlink!=""){
    echo "<img src=\"$avlink\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }else{
    echo "<img src=\"/images/nopic.jpg\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }
    }
    /////////////////////////////////////
          $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
          echo "$icon $lnk - $item[1] <br/>";
        }
        echo "</small></p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
          echo getjumper($action, $sid,"index");
        }
        echo "</p>";
      ////// UNTILL HERE >>
    
      echo "<p align=\"center\">";
      $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    ///////////////////////////////////////////////////////////////////Female Online
    else if($action=="fonline")
    {
     $showavatar = mysql_fetch_array(mysql_query("SELECT showavatar FROM ibwf_users WHERE id='".$uid."'"));
      addonline(getuid_sid($sid),"Online List - xHTML","");
    $pstyle = gettheme($sid);
        echo xhtmlhead("Online List",$pstyle);
    
    
      //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $num_items = getnumonline(); //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;
    //changable sql
        $sql = "SELECT
                a.name, b.place, b.userid, sex, perm FROM ibwf_users a
                INNER JOIN ibwf_online b ON a.id = b.userid WHERE a.sex='F'
                GROUP BY 1,2
                LIMIT $limit_start, $items_per_page
        ";
    
        echo "<p><small>";
    getalert($sid);
    
    echo "<meta http-equiv=\"refresh\" content=\"30; url=index.php?action=fonline&amp;sid=$sid\">";
        $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
        print "Most online: <b>$mols[1]</b><br/>";
        $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
        print "Most online today only: <b>$mols[0]</b><br/>";
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm ='4' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=codes&amp;sid=$sid\">Coders ".$noi[0]."</a><br/>";
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE specialid>'0' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=vipol&amp;sid=$sid\">V.I.P ".$noi[0]."</a><br/>";
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
     $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeout."'"));
      echo "<a href=\"index.php?action=stfol&amp;sid=$sid\">Staff ".$noi[0]."</a><br/>";
      $timeout = (time() - $timeadjust)  - 180;
    
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
        {
          if ($item[3]=="M"){
          $icon = "<img src=\"images/male.gif\" alt=\"M\"/>";
          }else
          if ($item[3]=="F"){
          $icon = "<img src=\"images/female.gif\" alt=\"F\"/>";
          }
            if ($item[4]=="1")
              {
              $lnk = "<a class=\"mod\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="2")
              {
              $lnk = "<a class=\"admin\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="3")
              {
              $lnk = "<a class=\"owner\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
              else if ($item[4]=="4")
              {
              $lnk = "<a class=\"coder\" href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
              }
    /////////////////////online avatar
     if($showavatar[0]=="1")
    {
    $avlink = getavatar($item[2]);
    if ($avlink!=""){
    echo "<img src=\"$avlink\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }else{
    echo "<img src=\"/images/nopic.jpg\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }
    }
    /////////////////////////////////////
          $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
          echo "$icon $lnk - $item[1] <br/>";
        }
        echo "</small></p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
          echo getjumper($action, $sid,"index");
        }
        echo "</p>";
      ////// UNTILL HERE >>
    
      echo "<p align=\"center\">";
      $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
      echo xhtmlfoot();
    }
    and the usage
    Code:
    boxstart("men+women online list");
    
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/online1.gif\" align=\"absbottom\"></a>";
       $memberonline = "<a href=\"index.php?action=online&amp;sid=$sid\">Online ".getnumonline()."</a><br/>";
      echo "$memberonline";
      $timeout = (time() - $timeadjust)  - 180;
    echo "<img class=\"menu\" alt=\"Group\" src=\"images/girlon.gif\" align=\"absbottom\"></a>";
    $kazz = mysql_fetch_array(mysql_query("SELECT count(a.userid) FROM ibwf_online a,ibwf_users b where a.userid=b.id and b.sex='F'"));
       echo "<a href=\"index.php?action=fonline&amp;sid=$sid\">Female Seeking Men [$kazz[0]]</a><br/>";
     echo "<img class=\"menu\" alt=\"Gallery\" src=\"images/boyon.gif\" align=\"absbottom\"></a>";
    $kazz = mysql_fetch_array(mysql_query("SELECT count(a.userid) FROM ibwf_online a,ibwf_users b where a.userid=b.id and b.sex='M'"));
        echo "<a href=\"index.php?action=monline&amp;sid=$sid\">Male Seeking Female [$kazz[0]]</a><br/>";

    Comment

    Working...
    X