Hey guys.
I have created a guest section for the lavalair script, I managed to code it sothat it put guests online ect ect.
The problem I am having, it does show the total number of memebers online (inc guests) but doesnt show the guests in the online list, only registerd memebers.
heres the code
core.php
index.php action=online
I know i am forgetting something but can't seem to find the problem.
Thanks in advance
I have created a guest section for the lavalair script, I managed to code it sothat it put guests online ect ect.
The problem I am having, it does show the total number of memebers online (inc guests) but doesnt show the guests in the online list, only registerd memebers.
heres the code
core.php
Code:
function addguestonline($guid,$place,$plclink)
{
$guid = getip();
/////delete inactive users
$tm = time() ;
$timeout = $tm - 420; //time out = 5 minutes
$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
///now try to add user to online list and add total time online
$ttime = time();
$res = mysql_query("INSERT INTO guest SET id ='".$guid."', lastact='".$ttime."', name='Guest' ");
$res = mysql_query("INSERT INTO ibwf_online SET userid='".$guid."', actvtime='".$ttime."', place='".$place."', isguest='Guest', placedet='".$plclink."'");
if(!$res)
{
//most probably userid already in the online list
//so just update the place and time
$res = mysql_query("UPDATE ibwf_online SET actvtime='".$ttime."', place='".$place."', isguest='Guest', placedet='".$plclink."' WHERE userid='".$guid."'");
}
$maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));
$result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
if($result[0]>=$maxmem[0])
{
$tnow = date("D/d/M/Y - H:i", time());
mysql_query("UPDATE ibwf_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");
}
$maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
if($maxtoday[0]==0||$maxtoday=="")
{
mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d/m/y")."', ppl='1', dtm='".date("H:i:s")."'");
$maxtoday[0]=1;
}
if($result[0]>=$maxtoday[0])
{
mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
}
}
index.php action=online
Code:
////////////////////////////////////////MEMBERS ONLINE VIEW
else if($action=="online")
{
addonline(getuid_sid($sid),"Online List","");
$pstyle = theme($sid);
echo xhtmlhead("Online List",$pstyle);
if ($popuppm[0]=="1"){
include("popups.php");
}
echo "$themeh";
echo "<center><b> $ts1 ONLINE STATS $ts2 </b></center></div>";
echo "$themeb";
echo "$ts1";
$mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
echo "Most online ever: <b>$mols[1]</b><br/>";
$mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
echo "Most online today: <b>$mols[0]</b><br/>";
echo "$ts2";
echo "</div>";
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, specialid FROM ibwf_users a
INNER JOIN ibwf_online b ON a.id = b.userid
GROUP BY 1,2
LIMIT $limit_start, $items_per_page ";
$sql2 = "SELECT
a.name, b.place, b.id, number FROM guest a
INNER JOIN ibwf_online b ON a.id = b.id
GROUP BY 1,2
LIMIT $limit_start, $items_per_page ";
$items2 = mysql_query($sql2);
$items = mysql_query($sql);
echo mysql_error();
echo "$themeh";
echo "<center><b> $ts1 MEMBERS ONLINE $ts2 </b></center></div>";
echo "$themeb";
echo "$ts1";
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]=="0")
{
$staff = "";
}
else if ($item[4]=="1")
{
$staff = "[M]";
}
else if ($item[4]=="2")
{
$staff = "[A]";
}
else if ($item[4]=="3")
{
$staff = "[O]";
}
else if($item[4]=='3')
{
$name = "<font color=\"red\">$item[0]</font>";
}
else if($item[4]=='2')
{
$name = "<font color=\"#999900\">$item[0]</font>";
}
else if($item[4]=='1')
{
$name = "<font color=\"#336600\">$item[0]</font>";
}
else if($item[5]>0)
{
$name = "<font color=\"#006666\">$item[0]</font>";
}
else if($item2[0]=='Guest')
{
$name = "Guest $item[0] $item[3]";
}
{
$name = $item[0];
}
$lnk = "<a href=\"index.php?action=viewuser&who=$item[2]&sid=$sid\">$name</a>";
echo "$icon $lnk <b>$staff</b> - $item[1] <br/>";
}
echo "$ts2";
echo "</div>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"index.php?action=online&page=$ppage&sid=$sid\">$ts1« Prev$ts2</a> ";
}
echo "$ts1 $page/$num_pages $ts2";
if($page<$num_pages)
{
$npage = $page+1;
echo " <a href=\"index.php?action=online&page=$npage&sid=$sid\">$ts1Next »$ts2</a>";
}
if($num_pages>2)
{
echo "<br/>";
echo getjumper($action, $sid,"index");
}
echo "<br/>";
echo "$ts1<a href=\"lists.php?action=longon&sid=$sid\">Longest Online</a>$ts2";
echo "</p>";
////// UNTILL HERE >>
echo "<p>$ts1";
echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
echo " > ";
echo "Members Online";
echo "$ts2</p>";
echo xhtmlfoot($sid);
}
I know i am forgetting something but can't seem to find the problem.
Thanks in advance
Comment