vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   question about a small snippet of code (https://vborg.vbsupport.ru/showthread.php?t=18329)

Sarge 05-27-2001 09:32 AM

$curTime = localtime();
$uts = time() - ($curTime[2]*566401 + $curTime[1]*60 + $curTime[0]);
$lts = $uts - (566401);
unset($curTime);

IS this time set for the past 7 days?
If not... what would it read?

Sarge 05-27-2001 02:27 PM

anyone know?

Sarge 05-28-2001 02:03 AM

bump

Sarge 05-28-2001 08:13 AM

I am upping my postcount on this one

the_sisko 05-28-2001 08:41 AM

Don't know what you are looking for but maybe:
PHP Code:

$pastweek time()-(60*60*24*7); 

This is the timestamp from last week...but tell me what your are looking for!

Sarge 05-28-2001 09:13 AM

<?php

$templatesused = "highpost2,highpostbit2";
require ("global.php");

$numberHighPostPerPage = 20; //set for this paste of the script
$curTime = localtime();
$uts = time() - ($curTime[2]*566401 + $curTime[1]*60 + $curTime[0]);
$lts = $uts - (566401); // 3600 * 24 + 1 (to be completely honest about "yesterday")
unset($curTime);

$users = $DB_site->query("
SELECT post.userid, user.username, COUNT(post.userid) AS count
FROM post
LEFT JOIN user ON post.userid=user.userid
WHERE dateline >= $lts AND dateline <= $uts
GROUP BY post.userid
ORDER BY count DESC
LIMIT $numberHighPostPerPage"
);

while ($user = $DB_site->fetch_array( $users ) )
{
eval( "\$highpostbits2 .= \"".gettemplate("highpostbit2")."\";");
$numhp++;
}
for ( ; $numhp < $numberHighPostPerPage; $numhp++ )
{
$user[userid] = "-1"; $user[username] = "Unclaimed"; $user[count] = "0";
eval( "\$highpostbits2 .= \"".gettemplate("highpostbit2")."\";");
}
eval("dooutput(\"".gettemplate('highpost2')."\");" );

?>

Thanks... trying to change this so it lists top posters from the past 7 days
Sarge

the_sisko 05-28-2001 09:45 PM

Try this one.
Code:

<?php

$templatesused = "highpost2,highpostbit2";
require ("global.php");

$numberHighPostPerPage = 20; //set for this paste of the script
$uts = time() - (604800);
$lts = time() - (86401);
unset($curTime);


$users = $DB_site->query("
SELECT post.userid, user.username, COUNT(post.userid) AS count
FROM post
LEFT JOIN user ON post.userid=user.userid
WHERE dateline >= $lts AND dateline <= $uts
GROUP BY post.userid
ORDER BY count DESC
LIMIT $numberHighPostPerPage"
);

while ($user = $DB_site->fetch_array( $users ) )
{
eval( "\$highpostbits2 .= \"".gettemplate("highpostbit2")."\";");
$numhp++;
}
for ( ; $numhp < $numberHighPostPerPage; $numhp++ )
{
$user[userid] = "-1"; $user[username] = "Unclaimed"; $user[count] = "0";
eval( "\$highpostbits2 .= \"".gettemplate("highpostbit2")."\";");
}
eval("dooutput(\"".gettemplate('highpost2')."\");");

?>



All times are GMT. The time now is 08:40 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.01062 seconds
  • Memory Usage 1,724KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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