Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 06-28-2002, 04:03 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default makelabelcode...

Can someone please help me with this? I want to be able to call up this file for the information in it for the server load and add it to quik stats. I know it's not right yet.

Code:
makelabelcode('Server Uptime', 'uptime.php');
Reply With Quote
  #2  
Old 06-29-2002, 07:53 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What?
Reply With Quote
  #3  
Old 06-29-2002, 05:59 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's a small hack out that gives the server uptime according to the db. Here is the code I have in my phpinclude:

Code:
//Server Uptime Code
$result = mysql_query("show status"); 
while ($row = mysql_fetch_array($result)){ 
if ($row['Variable_name'] == "Uptime") { $uptime = $row['Value']; } 
} 
$days = ((($uptime/60)/60)/24); 
$wholeday = (int) $days; 
$hours = (($days - $wholeday)*24); 
$wholehour = (int) $hours; 
$minutes = (($hours - $wholehour)*60); 
$wholeminute = (int) $minutes;
I want to be able to call this to work in Freddie's Quick Stats using:

Code:
makelabelcode('Server Uptime', 'whatever I need to put here');
Reply With Quote
  #4  
Old 06-30-2002, 06:00 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
makelabelcode('Server Uptime', "whatever variables you want here");
And you can use this:
$days
$wholedays
$hours
$wholehours
$minutes
$wholeminutes

So for example you can do this:
Code:
makelabelcode('Server Uptime', "$wholedays days, $wholehours hours and $wholeminutes minutes.");
You just need to include the code you pasted above this line.
Reply With Quote
  #5  
Old 06-30-2002, 08:01 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Chen. I forgot about the double quotes. I was trying to do it with single quotes.

Is there an easier way to have it say like 1 day instead of 1 days than what I did here? Maybe a global way for all of the s variables instead of having to do them one at a time here?

PHP Code:
//Server Uptime Code
$result mysql_query("show status"); 
while (
$row mysql_fetch_array($result)){ 
if (
$row['Variable_name'] == "Uptime") { $uptime $row['Value']; } 

$days = ((($uptime/60)/60)/24); 
$wholeday = (int) $days
$a='s';
if (
intval($wholeday)<1){
    
$wholeday=0;
}if (
intval($wholeday)==1){
    
$a='';
}
$hours = (($days $wholeday)*24); 
$wholehour = (int) $hours
$b='s';
if (
intval($wholehour)<1){
    
$wholehour=0;
}if (
intval($wholehour)==1){
    
$b='';
}
$minutes = (($hours $wholehour)*60); 
$wholeminute = (int) $minutes;
$c='s';
if (
intval($wholeminute)<1){
    
$wholeminute=0;
}if (
intval($wholeminute)==1){
    
$c='';
}
$seconds = (($minutes $wholeminute)*60);
$wholesecond = (int) $seconds;
$d='s';
if (
intval($wholesecond)<1){
    
$wholesecond=0;
}if (
intval($wholesecond)==1){
    
$d='';

I had to use a,b,c,d for the variables because when I tried to do s for all of them, it wouldn't work.

PHP Code:
makelabelcode('Server Uptime'"$wholeday day$a$wholehour hour$b$wholeminute minute$c and $wholesecond second$d."); 
Reply With Quote
  #6  
Old 06-30-2002, 08:14 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's no easier way, no.
Reply With Quote
  #7  
Old 06-30-2002, 08:50 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Chen. I didn't think there was an easier way.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05340 seconds
  • Memory Usage 2,231KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete