Longest Online

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Longest Online

    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>&#39;0&#39;"));

    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>&#39;0&#39; 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&amp;who=$item[0]&amp;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&amp;page=$ppage&amp ;sid=$sid&amp;view=$view\">«Prev</a> ";
    }
    if($page<$num_pages)
    {
    $npage = $page+1;
    echo "<a href=\"lists.php?action=longon&amp;page=$npage&amp ;sid=$sid&amp;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&amp;sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
    echo "Site Stats</a>
    ";
    echo "<a href=\"index.php?action=main&amp;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 &#39;&#39;,
    `pass` varchar(60) NOT NULL default &#39;&#39;,
    `birthday` varchar(50) NOT NULL default &#39;&#39;,
    `sex` char(1) NOT NULL default &#39;&#39;,
    `location` varchar(100) NOT NULL default &#39;&#39;,
    `val` tinyint(2) NOT NULL default &#39;0&#39;,
    `perm` char(1) NOT NULL default &#39;0&#39;,
    `posts` int(100) NOT NULL default &#39;0&#39;,
    `plusses` int(100) NOT NULL default &#39;0&#39;,
    `signature` varchar(100) NOT NULL default &#39;&#39;,
    `avatar` varchar(100) NOT NULL default &#39;avatars/1.gif&#39;,
    `email` varchar(50) NOT NULL default &#39;&#39;,
    `site` varchar(50) NOT NULL default &#39;&#39;,
    `browserm` varchar(50) NOT NULL default &#39;&#39;,
    `ipadd` varchar(30) NOT NULL default &#39;&#39;,
    `lastact` int(100) NOT NULL default &#39;0&#39;,
    `regdate` int(100) NOT NULL default &#39;0&#39;,
    `chmsgs` int(100) NOT NULL default &#39;0&#39;,
    `chmood` int(100) NOT NULL default &#39;0&#39;,
    `shield` char(1) NOT NULL default &#39;0&#39;,
    `gplus` int(100) NOT NULL default &#39;0&#39;,
    `budmsg` varchar(100) NOT NULL default &#39;&#39;,
    `lastpnreas` varchar(100) NOT NULL default &#39;&#39;,
    `lastplreas` varchar(100) NOT NULL default &#39;&#39;,
    `shouts` int(100) NOT NULL default &#39;0&#39;,
    `pollid` int(100) NOT NULL default &#39;0&#39;,
    `rbcid` varchar(255) NOT NULL default &#39;&#39;,
    `hvia` char(1) NOT NULL default &#39;1&#39;,
    `lastvst` int(100) NOT NULL default &#39;0&#39;,
    `battlep` int(100) NOT NULL default &#39;0&#39;,
    `mood` varchar(30) NOT NULL default &#39;Only Scruffy talks to me&#39;,
    `quiz` int(100) NOT NULL default &#39;0&#39;,
    `tottimeonl` int(100) NOT NULL default &#39;0&#39;,
    `visit` varchar(250) NOT NULL default &#39;0&#39;,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name` (`name`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1711 ;


    #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>&#39;0&#39;"));

    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>&#39;0&#39; 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&amp;who=$item[0]&amp;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&amp;page=$ppage&amp ;sid=$sid&amp;view=$view\">«Prev</a> ";
    }
    if($page<$num_pages)
    {
    $npage = $page+1;
    echo "<a href=\"lists.php?action=longon&amp;page=$npage&amp ;sid=$sid&amp;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&amp;sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
    echo "Site Stats</a>
    ";
    echo "<a href=\"index.php?action=main&amp;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 &#39;&#39;,
    `pass` varchar(60) NOT NULL default &#39;&#39;,
    `birthday` varchar(50) NOT NULL default &#39;&#39;,
    `sex` char(1) NOT NULL default &#39;&#39;,
    `location` varchar(100) NOT NULL default &#39;&#39;,
    `val` tinyint(2) NOT NULL default &#39;0&#39;,
    `perm` char(1) NOT NULL default &#39;0&#39;,
    `posts` int(100) NOT NULL default &#39;0&#39;,
    `plusses` int(100) NOT NULL default &#39;0&#39;,
    `signature` varchar(100) NOT NULL default &#39;&#39;,
    `avatar` varchar(100) NOT NULL default &#39;avatars/1.gif&#39;,
    `email` varchar(50) NOT NULL default &#39;&#39;,
    `site` varchar(50) NOT NULL default &#39;&#39;,
    `browserm` varchar(50) NOT NULL default &#39;&#39;,
    `ipadd` varchar(30) NOT NULL default &#39;&#39;,
    `lastact` int(100) NOT NULL default &#39;0&#39;,
    `regdate` int(100) NOT NULL default &#39;0&#39;,
    `chmsgs` int(100) NOT NULL default &#39;0&#39;,
    `chmood` int(100) NOT NULL default &#39;0&#39;,
    `shield` char(1) NOT NULL default &#39;0&#39;,
    `gplus` int(100) NOT NULL default &#39;0&#39;,
    `budmsg` varchar(100) NOT NULL default &#39;&#39;,
    `lastpnreas` varchar(100) NOT NULL default &#39;&#39;,
    `lastplreas` varchar(100) NOT NULL default &#39;&#39;,
    `shouts` int(100) NOT NULL default &#39;0&#39;,
    `pollid` int(100) NOT NULL default &#39;0&#39;,
    `rbcid` varchar(255) NOT NULL default &#39;&#39;,
    `hvia` char(1) NOT NULL default &#39;1&#39;,
    `lastvst` int(100) NOT NULL default &#39;0&#39;,
    `battlep` int(100) NOT NULL default &#39;0&#39;,
    `mood` varchar(30) NOT NULL default &#39;Only Scruffy talks to me&#39;,
    `quiz` int(100) NOT NULL default &#39;0&#39;,
    `tottimeonl` int(100) NOT NULL default &#39;0&#39;,
    `visit` varchar(250) NOT NULL default &#39;0&#39;,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name` (`name`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1711 ;[/b]
    bcz here is nothing that can update it

    Comment


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

      Comment


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

        Comment


          #5
          add new row in users table

          tottimeonl int(100) NOT NULL default &#39;0&#39;
          Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

          <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

          Comment


            #6
            add new row in users table

            tottimeonl int(100) NOT NULL default &#39;0&#39;[/b]

            Theres already a table in user for it


            Comment


              #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 ,
              Wapchat4u


              Topsites4u

              Comment


                #8
                ok i found my prob.

                find this function in core and add the sql query

                //////////////////////Function add user to online list :P

                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 <&#39;".$timeout."&#39;");

                ///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=&#39;".$uid."&#39;"));
                tolsla = (time() - $timeadjust) - $lastactive[0];
                $totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id=&#39;".$uid."&#39;"));
                $totaltimeonline = $totaltimeonline[0] + $tolsla;
                $res = mysql_query("UPDATE ibwf_users SET tottimeonl=&#39;".$totaltimeonline."&#39; WHERE id=&#39;".$uid."&#39;");




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


                Topsites4u

                Comment


                  #9
                  Thank you will give that a go

                  Comment


                    #10
                    Thank you will give that a go [/b]
                    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.
                    Wapchat4u


                    Topsites4u

                    Comment


                      #11
                      Originally posted by nclemale36 View Post
                      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



                      i only work on wapdesire v_2 coding only

                      Comment


                        #12
                        yep i got it working
                        Wapchat4u


                        Topsites4u

                        Comment


                          #13
                          Originally posted by nclemale36 View Post
                          yep i got it working
                          any chance u can share it please bro
                          HELP THEM WHO HELPS YOU



                          i only work on wapdesire v_2 coding only

                          Comment

                          Working...
                          X