vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Broken code.... (https://vborg.vbsupport.ru/showthread.php?t=53510)

noppid 05-28-2003 07:59 PM

Broken code....
 
This snippet is from index.php, it's supposed to only update when the number of users online is equal or greater then the previous stat. Problem is this template keeps getting updated with a lower number.

PHP Code:

  if ((int)$maxusers[0] <= $totalonline) {
    
$time time();
    
$maxloggedin "$totalonline " $time;
    
$DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    
$maxusers[0] = $totalonline;
    
$maxusers[1] = $time;
  } 

Is there another instance of it anywhere that is breaking it or is this a bug?

It's really annoying me.

Regards

filburt1 05-28-2003 08:09 PM

For one thing, you don't need to usually typecast in PHP. It handles variable comparisons intelligently.

Also, shouldn't it be >= anyway?

noppid 05-28-2003 08:28 PM

I checked and double checked a virgin index.php. The code is exactly as it appears in the distributed file of vB version 2.3.0.

Boofo 05-28-2003 08:57 PM

If you find a fix for this, please let us know. ;)

filburt1 05-28-2003 09:04 PM

$totalonline probably isn't set, so it's evaluating to 0.

A fun trick is to copy that line of code and encapusate it in quotes in an echo statement (i.e., echo "that line of code;"). You'll see (mostly) what PHP is doing.

noppid 05-28-2003 10:21 PM

Since it's not code that I've modified, I'll call it a bug and leave it to the authors of vB.

Thanks

Boofo 05-28-2003 10:48 PM

If you hear anything on it, we would be interested.

noppid 05-29-2003 05:03 PM

Holding steady and not decrementing since adding....

Code:

  if ( (int)$maxusers[0] <= $totalonline &&  $maxusers[0] != 0 ) {

Katman 06-25-2003 03:07 PM

All that does is change the number to a date, still not working correctly.

noppid 06-26-2003 01:30 PM

Quote:

Yesterday at 01:07 PM Katman said this in Post #9
All that does is change the number to a date, still not working correctly.
Could you have made a typo? It's working fine here still and there is a number displayed, not a date. The edit should not effect the display. We only change the condition on which it will update the DB.

Quote:

Most users ever online was 16 on 06-18-2003 at 01:13 PM.


All times are GMT. The time now is 05:43 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01687 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete