User Online Time And Shop

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

    User Online Time And Shop

    Hi, how do i code the user online time eg:

    In User Profile

    Member's ID:
    Status:
    A/S/L:
    Topics:
    Posts:
    PMs IN: OUT:
    Credits:
    Chat Posts:
    *User Time: 1 day, 23 hours, 7 minutes, 56seconds*
    Battle Points:
    Shouts:
    Joined M:
    Last Active:
    Last Visit:
    Browser:
    Martial Status:
    E-mail:
    Site:
    Signature:
    IP:
    Buddies:


    --------------------------


    i also want to know the codes of the shop to buy items and send via a pm

    eg: BUY FLOWERS

    Then i want to send it to a user

    #2
    replace this with the gettimemsg() function
    Code:
    function gettimemsg($sec)
    {
    //////////////
    $years=0;
    $months=0;
    $weeks=0;
    $days=0;
    $mins=0;
    $hours=0;
    if ($sec>60)
    {
    $secs=$sec%60;
    $mins=$sec/60;
    $mins=(integer)$mins;
    }
    
    if ($mins>60)
    {
    $hours=$mins/60;
    $hours=(integer)$hours;
    $mins=$mins%60;
    }
    
    if ($hours>24)
    {
    $days=$hours/24;
    $days=(integer)$days;
    $hours=$hours%24;
    }
    
    if ($days>7)
    {
    $weeks=$days/7;
    $weeks=(integer)$weeks;
    $days=$days%7;
    }
    
    if ($weeks>4)
    {
    $months=$weeks/4;
    $months=(integer)$months;
    $weeks=$weeks%4;
    }
    
    if ($months>12)
    {
    $years=$months/12;
    $years=(integer)$years;
    $months=$months%12;
    }
    
    if($years>0)
    {
    if($years==1){$yearmsg="year";}else{$yearmsg="years";}
    if($months==1){$monthsmsg="month";}else{$monthsmsg="months";}
    if($days==1){$daysmsg="day";}else{$daysmsg="days";}
    if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";}
    if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";}
    if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($months!=0){$monthscheck="$months $monthsmsg ";}else{$monthscheck="";}
    if($days!=0){$dayscheck="$days $daysmsg ";}else{$dayscheck="";}
    if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";}
    if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";}
    if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";}
    
    return "$years $yearmsg $monthscheck$dayscheck$hourscheck$minscheck$secscheck";
    }
    
    if(($years<1)&&($months>0))
    {
    if($months==1){$monthsmsg="month";}else{$monthsmsg="months";}
    if($days==1){$daysmsg="day";}else{$daysmsg="days";}
    if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";}
    if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";}
    if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($days!=0){$dayscheck="$days $daysmsg ";}else{$dayscheck="";}
    if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";}
    if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";}
    if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";}
    
    return "$months $monthsmsg $dayscheck$hourscheck$minscheck$secscheck";
    }
    
    if(($months<1)&&($weeks>0))
    {
    if($weeks==1){$weeksmsg="week";}else{$weeksmsg="weeks";}
    if($days==1){$daysmsg="day";}else{$daysmsg="days";}
    if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";}
    if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";}
    if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($days!=0){$dayscheck="$days $daysmsg ";}else{$dayscheck="";}
    if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";}
    if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";}
    if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";}
    
    return "$weeks $weeksmsg $dayscheck$hourscheck$minscheck$secscheck";
    }
    
    if(($weeks<1)&&($days>0))
    {
    if($days==1){$daysmsg="day";}else{$daysmsg="days";}
    if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";}
    if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";}
    if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";}
    if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";}
    if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";}
    
    return "$days $daysmsg $hourscheck$minscheck$secscheck";
    }
    
    if(($days<1)&&($hours>0))
    {
    if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";}
    if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";}
    if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";}
    if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";}
    
    return "$hours $hoursmsg $minscheck$secscheck";
    }
    
    if(($hours<1)&&($mins>0))
    {
    if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";}
    if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";}
    
    return "$mins $minsmsg $secscheck";
    }
    
    if(($mins<1)&&($sec>0))
    {
    if($sec==1){$secsmsg="second";}else{$secsmsg="seconds";}
    
    if($sec!=0){$secscheck="$sec $secsmsg";}else{$secscheck="";}
    
    return "$secscheck";
    }
    }
    then add this to profiles code

    Code:
    $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id=&#39;".$who."&#39;"));
    $var1 = date("His",$noi[0]);
    $var2 = time();
    $var21 = date("His",$var2);
    $var3 = $var21 - $var1;
    $var4 = date("s",$var3);
    echo "[b]Idle For:[/b] ";
    $remain = time() - $noi[0];
    $idle = gettimemsg($remain);
    echo "$idle
    ";
    then that should be it

    Comment


      #3
      Where is gettimemsg() function

      Comment


        #4
        Where is gettimemsg() function[/b]

        its in the core....

        btw linkrx7 thanx 4 tht but thts just 4 idle time...... cn it b used 4 how many time user spend at site??????
        sigpiceeeeerrr....

        Comment


          #5
          idle time is how long they been on the site....

          Comment


            #6
            idle time is how long they been on the site....[/b]
            ur wrong..... this code makes u c how long user is not active..... im nt tht stupid u knw......

            look at the code ... it say IDLE......
            sigpiceeeeerrr....

            Comment


              #7
              YEP Alesh ryt

              Comment


                #8
                YEP Alesh ryt[/b]

                LOL i knw my english sux a lil bit but if they understood me at california, then they&#39;ll understand me here 2 lmao....

                ANYWAY IDLE TIME WORKS BUT WHTS THE CODE 4 HOW ANY TIME USER SPEND AT SITE....???????

                ANY1 SO GOOD AND SHARE IT PLS
                sigpiceeeeerrr....

                Comment


                  #9
                  I Also Want That Code

                  Comment


                    #10
                    how long they spent at the site?.. you dont make sence mate lol how long they been registered is how long they been at the site for! if you explane what you mean maybe people would help!!! you mean how long they been "ONLINE" for?..

                    Comment


                      #11
                      how long they spent at the site?.. you dont make sence mate lol how long they been registered is how long they been at the site for! if you explane what you mean maybe people would help!!! you mean how long they been "ONLINE" for?..[/b]

                      well fkn yes!!!! wht doesnt make any sence?????????????? how long they spent at site yes..... or if u prefer ONLINE FOR
                      sigpiceeeeerrr....

                      Comment


                        #12
                        thats quite pointless when u got registered time and idle time aint they enough? lol

                        Comment


                          #13
                          thats quite pointless when u got registered time and idle time aint they enough? lol[/b]

                          no its not lol

                          i removed reg time, last act and last visit and i got just idle time.... so now i wanna put excatly how many time they spent at site or like DrugsBunny prefer ONLINE FOR:!!!!!!!!!

                          but i cnt figure it out the code......
                          sigpiceeeeerrr....

                          Comment


                            #14
                            hmmm ....

                            there is a way.

                            Ive put me head to it, the best way is to add 2 new colums to ibwf_users eg. totaltime and temptime.

                            then at the top of each page where it updates the users session, add a function to update the users temptime from last login to that specific time.

                            Then whenever a user logs in, the script should add the temptime to the totaltime and start the temptime process over again?

                            Just a thought, it will work -tea- lol

                            Comment


                              #15
                              My code for Idle:

                              $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id=&#39;".$who."&#39;"));
                              $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);

                              echo "Idle For: ";
                              if(($days==0) and ($hours==0) and ($mins==0)){
                              echo "$secs seconds
                              ";
                              }else
                              if(($days==0) and ($hours==0)){
                              echo "$mins mins, ";
                              echo "$secs seconds
                              ";
                              }else
                              if(($days==0)){
                              echo "$hours hours, ";
                              echo "$mins mins, ";
                              echo "$secs seconds
                              ";
                              }else{
                              echo "$days days, ";
                              echo "$hours hours, ";
                              echo "$mins mins, ";
                              echo "$secs seconds
                              ";
                              }

                              Comment

                              Working...
                              X