online kist male & female

Started on the old forum in June 2009 · view the original in the archive · old links redirect here

1 reply · 408 views · started 17 years ago · 1 min read

riderz Lead · 975 posts #1

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

index.php

 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&nick=$nick&pass=$pass&page=$pagefrw\">Next »</a><br/>";
        $page=$page-2;
        if ($page>-1) echo "<a href=\"index.php?action=online&nick=$nick&pass=$pass&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&pass=$pass\"><img src=\"./images/home.gif\" alt=\"*\"/>Forum Home</a><br/>";
        echo "</p>";
        echo "</card>";
                                           }

core.php

///////////////////////////////////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


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #2

Here are the code i use at my site now

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&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&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&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&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&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="2")
          {
          $lnk = "<a class=\"admin\" href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="3")
          {
          $lnk = "<a class=\"owner\" href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="4")
          {
          $lnk = "<a class=\"coder\" href=\"index.php?action=viewuser&who=$item[2]&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&who=$item[2]&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&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=online&page=$npage&sid=$sid\">Next»</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&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&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&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&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&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&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="2")
          {
          $lnk = "<a class=\"admin\" href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="3")
          {
          $lnk = "<a class=\"owner\" href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="4")
          {
          $lnk = "<a class=\"coder\" href=\"index.php?action=viewuser&who=$item[2]&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&who=$item[2]&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&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=online&page=$npage&sid=$sid\">Next»</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&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&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&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&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&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&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="2")
          {
          $lnk = "<a class=\"admin\" href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="3")
          {
          $lnk = "<a class=\"owner\" href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$item[0]</a>";
          }
          else if ($item[4]=="4")
          {
          $lnk = "<a class=\"coder\" href=\"index.php?action=viewuser&who=$item[2]&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&who=$item[2]&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&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=online&page=$npage&sid=$sid\">Next»</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&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}

and the usage

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&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&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&sid=$sid\">Male Seeking Female [$kazz[0]]</a><br/>";

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Write your reply now; next you create a free account (or sign in) and it is posted right away. 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