Time Online

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

    Time Online

    Hi everyone ive searched the forums for this with no luck im trying to find the coding for time online (example) Time online: 1 hour 46 mins 3 secs any help wud be grateful

    #2
    Also if any code for time idle ....thanks

    Comment


      #3
      save the time when a user has logged in and substract it from current time the diference would be the online time.

      Code:
      round((time()-$login_time)/60); //minutes online
      Advertise your mobile site for FREE with AdTwirl

      Comment


        #4
        i made this code can use it for idle and online time it will give the msg from seconds so like doing time()-lastseen then that value goes in this function also it does up to weeks if u want put months and years in jus add them lol its easy

        Code:
        function TimeMsg($secs)
        {
        $mins=floor(($secs)/60);
        $hours=floor(($mins)/60);
        $days=floor(($hours)/24);
        $weeks=floor(($days)/7);
        if($secs>59)$secs=$secs-($mins*60);
        if($mins>59)$mins=$mins-($hours*60);
        if($hours>23)$hours=$hours-($days*24);
        if($days>6)$days=$days-($weeks*7);
        $msg="";
        if($weeks>0)$msg.=$weeks." week";
        if($weeks>1)$msg.="s";
        if($weeks>0&&$days>0)$msg.=", ";
        if($days>0)$msg.=$days." day";
        if($days>1)$msg.="s";
        if(($days>0||$weeks>0)&&$hours>0)$msg.=", ";
        if($hours>0)$msg.=$hours." hour";
        if($hours>1)$msg.="s";
        if(($hours>0||$days>0)&&$mins>0)$msg.=", ";
        if($mins>0)$msg.=$mins." minute";
        if($mins>1)$msg.="s";
        if($mins>0&&$secs>0)$msg.=", ";
        if($secs>0)$msg.=$secs." second";
        if($secs>1)$msg.="s";
        if(!$secs&&!$mins&&!$hours&&!$days)$msg="0 seconds";
        return $msg;
        }

        Comment


          #5
          <div class='quotetop'>QUOTE (ori @ Oct 3 2008, 12:17 AM) <{POST_SNAPBACK}></div>
          i made this code can use it for idle and online time it will give the msg from seconds so like doing time()-lastseen then that value goes in this function also it does up to weeks if u want put months and years in jus add them lol its easy

          Code:
          function TimeMsg($secs)
          {
          $mins=floor(($secs)/60);
          $hours=floor(($mins)/60);
          $days=floor(($hours)/24);
          $weeks=floor(($days)/7);
          if($secs>59)$secs=$secs-($mins*60);
          if($mins>59)$mins=$mins-($hours*60);
          if($hours>23)$hours=$hours-($days*24);
          if($days>6)$days=$days-($weeks*7);
          $msg="";
          if($weeks>0)$msg.=$weeks." week";
          if($weeks>1)$msg.="s";
          if($weeks>0&&$days>0)$msg.=", ";
          if($days>0)$msg.=$days." day";
          if($days>1)$msg.="s";
          if(($days>0||$weeks>0)&&$hours>0)$msg.=", ";
          if($hours>0)$msg.=$hours." hour";
          if($hours>1)$msg.="s";
          if(($hours>0||$days>0)&&$mins>0)$msg.=", ";
          if($mins>0)$msg.=$mins." minute";
          if($mins>1)$msg.="s";
          if($mins>0&&$secs>0)$msg.=", ";
          if($secs>0)$msg.=$secs." second";
          if($secs>1)$msg.="s";
          if(!$secs&&!$mins&&!$hours&&!$days)$msg="0 seconds";
          return $msg;
          }
          [/b]
          Thanks ori but whats usage code?

          Thanks

          Comment


            #6
            <div class='quotetop'>QUOTE (friend @ Oct 23 2008, 05:26 AM) <{POST_SNAPBACK}></div>
            Thanks ori but whats usage code?

            Thanks[/b]
            just use methos script author hehehe..

            Comment


              #7
              <div class='quotetop'>QUOTE (DarkSilent @ Oct 23 2008, 05:48 AM) <{POST_SNAPBACK}></div>
              just use methos script author hehehe..[/b]

              Thanks

              Comment


                #8
                I got

                Member For: 42 years 2 months 6 hours 51 seconds

                Comment


                  #9
                  for online time jus use the seconds they been online 4 and for idle time use the difference between time now and last seen time so 61 would return 1 minute , 1 second

                  Comment


                    #10
                    ok i get online time for recent

                    but

                    I also get in forum post on 2nd and other page date 31-12-69

                    dont know why

                    Comment


                      #11
                      you must of replacet the old time format pmsl

                      Comment


                        #12
                        in index.php?action=viewuser
                        Code:
                        $totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id=&#39;".$who."&#39;"));  
                        $num = $totaltimeonline[0]/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 "Time Online: ";
                        if(($days==0) and ($hours==0) and ($mins==0)){
                         echo "[b]$secs[/b] seconds
                        ";
                        }else
                        if(($days==0) and ($hours==0)){
                         echo "[b]$mins[/b] mins, ";
                        echo "[b]$secs[/b] seconds
                        ";
                        }else
                        if(($days==0)){
                        echo "[b]$hours[/b] hours, ";
                        echo "[b]$mins[/b] mins, ";
                        echo "[b]$secs[/b] seconds
                        ";
                        }else{
                        echo "[b]$days[/b] days, ";
                         echo "[b]$hours[/b] hours, ";
                        echo "[b]$mins[/b] mins, ";
                        echo "[b]$secs[/b] seconds
                        ";
                        }
                        $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id=&#39;".$who."&#39;"));
                        echo "$idleofline ";
                         $idleofline = "Idle For:";
                        $remain = time() - $noi[0];
                        $num = $remain/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);
                        if(($days==0) and ($hours==0) and ($mins==0)){
                        echo "[b]$secs[/b] seconds
                        ";
                        }else
                        if(($days==0) and ($hours==0)){
                        echo "[b]$mins[/b] mins, ";
                         echo "[b]$secs[/b] seconds
                        ";
                        }else
                        if(($days==0)){
                         echo "[b]$hours[/b] hours, ";
                        echo "[b]$mins[/b] mins, ";
                        echo "[b]$secs[/b] seconds
                        ";
                        }else{
                        echo "[b]$days[/b] days, ";
                         echo "[b]$hours[/b] hours, ";
                         echo "[b]$mins[/b] mins, ";
                         echo "[b]$secs[/b] seconds
                        ";
                        }
                        add new row in ibwf_users
                        Code:
                         `tottimeonl` int(100) NOT NULL default &#39;0&#39;,

                        Comment


                          #13
                          can somebody make it for mobile chat 2.0.2 by ghost and device

                          Comment


                            #14
                            <div class='quotetop'>QUOTE (jsyguy23 @ Oct 24 2008, 04:14 AM) <{POST_SNAPBACK}></div>
                            you must of replacet the old time format pmsl[/b]
                            where to replace that?

                            Comment


                              #15
                              <div class='quotetop'>QUOTE (bijaybd @ Oct 28 2008, 10:27 PM) <{POST_SNAPBACK}></div>
                              can somebody make it for mobile chat 2.0.2 by ghost and device[/b]
                              i don&#39;t think is it possible..that chat don&#39;t have database but file.txt
                              sigpicthe italian/international COMMUNITY of friendship
                              http://people2000.netne.net
                              WAP/WEB
                              peoplemailbox@katamail.com

                              Comment

                              Working...
                              X