here are some codes that might be useful to you...
Place the codes below in index.php
Place the codes below in index.php
PHP Code:
///////////////////////////////////Active Members
else if($action=="active")
{
addonline(getuid_sid($sid),"[Active Users List]","index.php?action=$action");
echo "<card id=\"main\" title=\"Active Users List\">";
echo "<p align=\"center\">";
echo "On this page you will find out the active members in different time periods.";
echo "</p>";
echo "<p align=\"left\">";
$tm60 = time() - (60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm60."'"));
echo mysql_error();
echo "Active users this hour: <a href=\"index.php?action=acthour&sid=$sid\">($aut[0])</a>
";
echo "----------
";
$tm24 = time() - (24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
echo mysql_error();
echo "Active users today: <a href=\"index.php?action=actmem&sid=$sid\">($aut[0])</a>
";
echo "----------
";
$tm3 = time() - (3*24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm3."'"));
echo mysql_error();
echo "Active users Last 3 days: <a href=\"index.php?action=active3&sid=$sid\">($aut[0])</a>
";
echo "----------
";
$tm7 = time() - (7*24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm7."'"));
echo mysql_error();
echo "Active users this week: <a href=\"index.php?action=actmemwk&sid=$sid\">($aut[0])</a>
";
echo "----------
";
$tm4 = time() - (4*7*24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm4."'"));
echo mysql_error();
echo "Active users this month: <a href=\"index.php?action=actmonth&sid=$sid\">($aut[0])</a>
";
echo "----------
";
echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"http://coding-talk.com/images/stat.gif\" alt=\"*\"/>";
echo "Statistics</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
///////////////////////////////////Active Members This Hour
else if($action=="acthour")
{
addonline(getuid_sid($sid),"[Active Users For This Hour]","index.php?action=$action");
echo "<card id=\"main\" title=\"Active Users For This Hour\">";
$tm60 = time() - (60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm60."'"));
echo mysql_error();
if($page=="" || $page<=0)$page=1;
$num_items = $aut[0]; //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;
$sql = "SELECT name, sex, lastact, id FROM ibwf_users WHERE lastact>'".$tm60."' ORDER BY lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
if($item[1]==M)
{
$usex = "<img src=\"http://coding-talk.com/images/male.gif\" alt=\"M\"/>";
}else if($item[1]==F){
$usex = "<img src=\"http://coding-talk.com/images/female.gif\" alt=\"F\"/>";
}else{
$usex = "<img src=\"http://coding-talk.com/images/unknown.gif\" alt=\"X\"/>";
}
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$item[0]</a>";
echo "$usex $lnk -".date("D d M y - H:i:s a", $item[2])."
";
echo "-------
";
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=acthour&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"index.php?action=acthour&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
echo getjumper($action, $sid,"index");
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"http://coding-talk.com/images/stat.gif\" alt=\"*\"/>";
echo "Statistics</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
///////////////////////////////////Active Members Today
else if($action=="actmem")
{
addonline(getuid_sid($sid),"[Active Users Today]","index.php?action=$action");
echo "<card id=\"main\" title=\"Active Users today\">";
$tm24 = time() - (24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
echo mysql_error();
if($page=="" || $page<=0)$page=1;
$num_items = $aut[0]; //changable
$items_per_page= 7;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT name, sex, lastact, id FROM ibwf_users WHERE lastact>'".$tm24."' ORDER BY lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
if($item[1]==M)
{
$usex = "<img src=\"http://coding-talk.com/images/male.gif\" alt=\"M\"/>";
}else if($item[1]==F){
$usex = "<img src=\"http://coding-talk.com/images/female.gif\" alt=\"F\"/>";
}else{
$usex = "<img src=\"http://coding-talk.com/images/unknown.gif\" alt=\"X\"/>";
}
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$item[0]</a>";
echo "$usex $lnk -".date("D d M y - H:i:s a", $item[2])."
";
echo "-------
";
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=actmem&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"index.php?action=actmem&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
echo getjumper($action, $sid,"index");
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"http://coding-talk.com/images/stat.gif\" alt=\"*\"/>";
echo "Statistics</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
///////////////////////////////////Active Members This Week
else if($action=="actmemwk")
{
addonline(getuid_sid($sid),"[Active Users For This Week]","index.php?action=$action");
echo "<card id=\"main\" title=\"Active Users this week\">";
$tm7 = time() - (7*24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm7."'"));
echo mysql_error();
if($page=="" || $page<=0)$page=1;
$num_items = $aut[0]; //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;
$sql = "SELECT name, sex, lastact, id FROM ibwf_users WHERE lastact>'".$tm7."' ORDER BY lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
if($item[1]==M)
{
$usex = "<img src=\"http://coding-talk.com/images/male.gif\" alt=\"M\"/>";
}else if($item[1]==F){
$usex = "<img src=\"http://coding-talk.com/images/female.gif\" alt=\"F\"/>";
}else{
$usex = "<img src=\"http://coding-talk.com/images/unknown.gif\" alt=\"X\"/>";
}
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$item[0]</a>";
echo "$usex $lnk -".date("D d M y - H:i:s a", $item[2])."
";
echo "-------
";
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=actmemwk&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"index.php?action=actmemwk&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
echo getjumper($action, $sid,"index");
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"http://coding-talk.com/images/stat.gif\" alt=\"*\"/>";
echo "Statistics</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
///////////////////////////////////Active Members This Month
else if($action=="actmonth")
{
addonline(getuid_sid($sid),"[Active Users For This Month]","index.php?action=$action");
echo "<card id=\"main\" title=\"Active Users this week\">";
$tm4 = time() - (4*7*24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm4."'"));
echo mysql_error();
if($page=="" || $page<=0)$page=1;
$num_items = $aut[0]; //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;
$sql = "SELECT name, sex, lastact, id FROM ibwf_users WHERE lastact>'".$tm4."' ORDER BY lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
if($item[1]==M)
{
$usex = "<img src=\"http://coding-talk.com/images/male.gif\" alt=\"M\"/>";
}else if($item[1]==F){
$usex = "<img src=\"http://coding-talk.com/images/female.gif\" alt=\"F\"/>";
}else{
$usex = "<img src=\"http://coding-talk.com/images/unknown.gif\" alt=\"X\"/>";
}
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$item[0]</a>";
echo "$usex $lnk -".date("D d M y - H:i:s a", $item[2])."
";
echo "-------
";
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=actmonth&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"index.php?action=actmonth&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
echo getjumper($action, $sid,"index");
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"http://coding-talk.com/images/stat.gif\" alt=\"*\"/>";
echo "Statistics</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
///////////////////////////////////Active Members LAST 3 DAYS
else if($action=="active3")
{
addonline(getuid_sid($sid),"[Active Users For 3 Days]","index.php?action=$action");
echo "<card id=\"main\" title=\"Active Users For 3 Days\">";
$tm3 = time() - (3*24*60*60);
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm3."'"));
echo mysql_error();
if($page=="" || $page<=0)$page=1;
$num_items = $aut[0]; //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;
$sql = "SELECT name, sex, lastact, id FROM ibwf_users WHERE lastact>'".$tm3."' ORDER BY lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
if($item[1]==M)
{
$usex = "<img src=\"http://coding-talk.com/images/male.gif\" alt=\"M\"/>";
}else if($item[1]==F){
$usex = "<img src=\"http://coding-talk.com/images/female.gif\" alt=\"F\"/>";
}else{
$usex = "<img src=\"http://coding-talk.com/images/unknown.gif\" alt=\"X\"/>";
}
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$item[0]</a>";
echo "$usex $lnk -".date("D d M y - H:i:s a", $item[2])."
";
echo "-------
";
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=active3&page=$ppage&sid=$sid\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"index.php?action=active3&page=$npage&sid=$sid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
echo getjumper($action, $sid,"index");
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"http://coding-talk.com/images/stat.gif\" alt=\"*\"/>";
echo "Statistics</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}</div>
Place this code in index.php?action=stats
[code]echo "<a href=\"index.php?action=active&sid=$sid\">Active Members</a>
";
Comment