Can anyone see why this isnt updating in the database please...
Code in lists.php
//////////////////////////////////Longest Online
else if($action=="longon")
{
addonline(getuid_sid($sid),"Longest Online","");
echo "<card id=\"main\" title=\"Longest Online\">";
//////ALL LISTS SCRIPT <<
$noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM fun_users WHERE tottimeonl>'0'"));
if($page=="" || $page<=0)$page=1;
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = "SELECT id, name, tottimeonl FROM fun_users WHERE tottimeonl>'0' ORDER BY tottimeonl DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$num = $item[2]/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
$secs = intval($num4);
echo "<p align=\"center\">";
$lnk = "<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$item[1]</a>: $days days, $hours hours, $mins mins, $secs seconds";
echo "$lnk
";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=longon&page=$ppage& ;sid=$sid&view=$view\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=longon&page=$npage& ;sid=$sid&view=$view\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"lists.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
echo "Site Stats</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
Database Table
`id` int(100) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`pass` varchar(60) NOT NULL default '',
`birthday` varchar(50) NOT NULL default '',
`sex` char(1) NOT NULL default '',
`location` varchar(100) NOT NULL default '',
`val` tinyint(2) NOT NULL default '0',
`perm` char(1) NOT NULL default '0',
`posts` int(100) NOT NULL default '0',
`plusses` int(100) NOT NULL default '0',
`signature` varchar(100) NOT NULL default '',
`avatar` varchar(100) NOT NULL default 'avatars/1.gif',
`email` varchar(50) NOT NULL default '',
`site` varchar(50) NOT NULL default '',
`browserm` varchar(50) NOT NULL default '',
`ipadd` varchar(30) NOT NULL default '',
`lastact` int(100) NOT NULL default '0',
`regdate` int(100) NOT NULL default '0',
`chmsgs` int(100) NOT NULL default '0',
`chmood` int(100) NOT NULL default '0',
`shield` char(1) NOT NULL default '0',
`gplus` int(100) NOT NULL default '0',
`budmsg` varchar(100) NOT NULL default '',
`lastpnreas` varchar(100) NOT NULL default '',
`lastplreas` varchar(100) NOT NULL default '',
`shouts` int(100) NOT NULL default '0',
`pollid` int(100) NOT NULL default '0',
`rbcid` varchar(255) NOT NULL default '',
`hvia` char(1) NOT NULL default '1',
`lastvst` int(100) NOT NULL default '0',
`battlep` int(100) NOT NULL default '0',
`mood` varchar(30) NOT NULL default 'Only Scruffy talks to me',
`quiz` int(100) NOT NULL default '0',
`tottimeonl` int(100) NOT NULL default '0',
`visit` varchar(250) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1711 ;
Code in lists.php
//////////////////////////////////Longest Online
else if($action=="longon")
{
addonline(getuid_sid($sid),"Longest Online","");
echo "<card id=\"main\" title=\"Longest Online\">";
//////ALL LISTS SCRIPT <<
$noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM fun_users WHERE tottimeonl>'0'"));
if($page=="" || $page<=0)$page=1;
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = "SELECT id, name, tottimeonl FROM fun_users WHERE tottimeonl>'0' ORDER BY tottimeonl DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$num = $item[2]/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
$secs = intval($num4);
echo "<p align=\"center\">";
$lnk = "<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$item[1]</a>: $days days, $hours hours, $mins mins, $secs seconds";
echo "$lnk
";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=longon&page=$ppage& ;sid=$sid&view=$view\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=longon&page=$npage& ;sid=$sid&view=$view\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"lists.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
echo "Site Stats</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
Database Table
`id` int(100) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`pass` varchar(60) NOT NULL default '',
`birthday` varchar(50) NOT NULL default '',
`sex` char(1) NOT NULL default '',
`location` varchar(100) NOT NULL default '',
`val` tinyint(2) NOT NULL default '0',
`perm` char(1) NOT NULL default '0',
`posts` int(100) NOT NULL default '0',
`plusses` int(100) NOT NULL default '0',
`signature` varchar(100) NOT NULL default '',
`avatar` varchar(100) NOT NULL default 'avatars/1.gif',
`email` varchar(50) NOT NULL default '',
`site` varchar(50) NOT NULL default '',
`browserm` varchar(50) NOT NULL default '',
`ipadd` varchar(30) NOT NULL default '',
`lastact` int(100) NOT NULL default '0',
`regdate` int(100) NOT NULL default '0',
`chmsgs` int(100) NOT NULL default '0',
`chmood` int(100) NOT NULL default '0',
`shield` char(1) NOT NULL default '0',
`gplus` int(100) NOT NULL default '0',
`budmsg` varchar(100) NOT NULL default '',
`lastpnreas` varchar(100) NOT NULL default '',
`lastplreas` varchar(100) NOT NULL default '',
`shouts` int(100) NOT NULL default '0',
`pollid` int(100) NOT NULL default '0',
`rbcid` varchar(255) NOT NULL default '',
`hvia` char(1) NOT NULL default '1',
`lastvst` int(100) NOT NULL default '0',
`battlep` int(100) NOT NULL default '0',
`mood` varchar(30) NOT NULL default 'Only Scruffy talks to me',
`quiz` int(100) NOT NULL default '0',
`tottimeonl` int(100) NOT NULL default '0',
`visit` varchar(250) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1711 ;
Comment