Longest Online

Started on the old forum in July 2008 · view the original in the archive · old links redirect here

12 replies · 1,067 views · started 18 years ago · 2 min read

5 participants
Guest #1

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 " "; $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 " "; echo " "; 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 " ";

////// UNTILL HERE >> echo " "; 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 " "; 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 ;

rukiya Lead · 569 posts #2

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 " "; $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 " "; echo " "; 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 " "; ////// UNTILL HERE >> echo " "; 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 " "; 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 ;

bcz here is nothing that can update it

BoYzONe Developer · 88 posts #3

after succesfull use this script..my hidden function cannot use anymore..why??

Guest #4

I know theres nothing to update it thats why i was askin for help!

Guest #6

add new row in users table

tottimeonl int(100) NOT NULL default '0'

Theres already a table in user for it

nclemale36 Lead · 537 posts #7

pmpl i got same prob and just made exact same post without seeing this one . oops i take it no one can help us then ,

nclemale36 Lead · 537 posts #8

ok i found my prob.

find this function in core and add the sql query

//////////////////////Function add user to online list 😛

function addonline($uid,$place,$plclink) { /////delete inactive users $tm = (time() - $timeadjust) ; $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 // ADD THE BELOW CODE

$lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$uid."'")); tolsla = (time() - $timeadjust) - $lastactive[0]; $totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$uid."'"));
$totaltimeonline = $totaltimeonline[0] + $tolsla; $res = mysql_query("UPDATE ibwf_users SET tottimeonl='".$totaltimeonline."' WHERE id='".$uid."'");

it pays to look .which i have done. hope this helps others

Guest #9

Thank you will give that a go 🙂

nclemale36 Lead · 537 posts #10

Thank you will give that a go :)

discovered a bug on new users signing up . its picking up the last active time as an online time and showing as 14737 days or sumat . cant work it out.

brand Senior · 391 posts #11

nclemale36 wrote: discovered a bug on new users signing up . its picking up the last active time as an online time and showing as 14737 days or sumat . cant work it out.

has any one got this working

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

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