Pls! Check this recode! If correct,

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

    #16
    Originally posted by arg0s12 View Post
    O.K bro, i have code for 5 hours online stat, like pwap later, but my problem is what code that i put in users profile, e.g 5 hrs stat: 2 hrs, 39 mins, 50 sec.
    to index.php in $action=="viewuser"
    Code:
      $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
      $var1 = date("His",$noi[0]);
      $var2 = time();
      $var21 = date("His",$var2);
      $var3 = $var21 - $var1;
      $var4 = date("s",$var3);
      echo "Idle: ";
      $remain = time() - $noi[0];
      $idle = gettimemsg($remain);
      echo "$idle<br/>";
    check this function in core.php

    Code:
    function gettimemsg($sec)
    {
      $ds = floor($sec/60/60/24);
      if($ds > 0)
      {
        return "$ds days";
      }
      $hs = floor($sec/60/60);
      if($hs > 0)
      {
        return "$hs hours";
      }
      $ms = floor($sec/60);
      if($ms > 0)
      {
        return "$ms minutes";
      }
      return "$sec Seconds";
    }
    Last edited by huwad; 11.12.09, 14:17.

    Comment


      #17
      Thanks, bro, after a long time, your the only one who post this code, thanks, by the way, im visiting at zyclone, and thinking to use the script, a lot of stuff, ,

      Comment


        #18
        Not working bro? . . Only article's sql working to my script? Any idea?

        Comment


          #19
          Originally posted by arg0s12 View Post
          Not working bro? . . Only article's sql working to my script? Any idea?
          i thought it was idle time,, uhhm.. try this.. 5hrs status..

          Code:
            $totaltimeonline = mysql_fetch_array(mysql_query("SELECT onlinetime FROM [COLOR="Red"]tableprefix(ibwf)[/COLOR]_users WHERE id='".$who."'"));  
            $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 "5 hrs: ";
            if(($days==0) and ($hours==0) and ($mins==0))
            {
            echo $secs."s.<br/>";
            }else if(($days==0) and ($hours==0))
            {
            echo $mins."m, ";
            echo $secs."s.<br/>";
            }else if(($days==0))
            {
            echo $hours."h, ";
            echo $mins."m, ";
            echo $secs."s.<br/>";
            }else{
            echo $days."d, ";
            echo $hours."h, ";
            echo $mins."m, ";
            echo $secs."s.<br/>";
            }

          Comment


            #20
            the idle time alwys 0s ,,, ill try to fix..

            Comment


              #21
              bro.. thanks.. its working now...

              Comment


                #22
                Originally posted by arg0s12 View Post
                the idle time alwys 0s ,,, ill try to fix..
                because you are viewing your own profile, try to view others profile that are not active..

                Comment

                Working...
                X