vb.org Archive

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

gengar003 05-03-2003 12:08 AM

showthread php question
 
So, i've got my showthread.php file right?


Now, you'd think if i put something at the top of the page, it would execute upon loading of the page, right? well it doesn't... :( This is probably because of some inadequacy of mine, but I don't get what, so there you are. Anyway, I've got a simple code to check the user's Points (from lesane store hack) and I know it does indeed pull them from the DB and assign it to a variable, because is can make the points print @ the top of the page. I have this set to work ONLY in forum id #51.


However, when I try to put that into an "If" statement, and show the points ONLY if they've less than 1000, it ONLY works when, on the forum main page, I click the "goto newest" arrow thing by the time and poster....


Anywhere else, it does nothing. Any Ideas why?


PHP Code:


require('./global.php');
$userstuff $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if (
$points 1000 && $forumid == 51){
echo 
$points;



mr e 05-03-2003 06:57 AM

have you tried adding an else?

gengar003 05-03-2003 11:30 AM

Hmm... Yes, actually, but I had the "else" containing the rest of the file. Would that have caused a problem?

mr e 05-03-2003 05:14 PM

and right now your file looks like this?

PHP Code:

require('./global.php');
$userstuff $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if (
$points 1000 && $forumid == 51){
echo 
$points;
}

rest of file 


noppid 05-04-2003 01:30 PM

The reason it fails is you are requiring global.php, then later in the file it tries to include it again and the page fails. Try moving your code below the forms actual call to require(global.php).

At least that's what bit us once.

gengar003 05-04-2003 02:11 PM

Quote:

Yesterday at 07:14 PM mr e said this in Post #4
and right now your file looks like this?

PHP Code:

require('./global.php');
$userstuff $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if (
$points 1000 && $forumid == 51){
echo 
$points;
}

rest of file 



yes

gengar003 05-04-2003 02:12 PM

Quote:

Today at 03:30 PM noppid said this in Post #5
The reason it fails is you are requiring global.php, then later in the file it tries to include it again and the page fails. Try moving your code below the forms actual call to require(global.php).

At least that's what bit us once.


Hm? The page runs, but my code doesn't... and the call to require etc that was originally there is halfway down the page, (roughly) and there's code above it I want to run AFTER the check is preformed... I'll try it, though.

gengar003 05-20-2003 11:25 PM

anyone?

Boofo 05-21-2003 12:17 AM

Try this:

$userstuff = $DB_site->query_first("SELECT storep AS points FROM user WHERE userid=$bbuserinfo[userid]");
if ($userstuff[points] < 1000 && $forumid == 51){
echo $userstuff[points];
}

Link14716 05-21-2003 02:41 AM

Quote:

05-02-03 at 09:08 PM gengar003 said this in Post #1
PHP Code:


require('./global.php');
$userstuff $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if (
$points 1000 && $forumid == 51){
echo 
$points;




Why do so many people select from the user table for something already in the $bbuserinfo array?

PHP Code:

$points=$bbuserinfo[storep];
if (
$points 1000 && $forumid == 51){
echo 
$points;


Put that under this:
PHP Code:

$templatesused 'showthread_ratingdisplay,postbit_search,postbit_buddy,postbit_ignore,postbit_useremail,icq,aim,yahoo,postbit_homepage,postbit_profile,postbit_ip_show,postbit_ip_hidden,postbit,postbit_sendpm,postbit_avatar,postbit_offline,postbit_online,postbit_editedby,postbit_signature,postbit_attachment,postbit_attachmentimage,showthread_adminoptions,showthread_threadrate,showthread_pollresults_voted,showthread_pollresults_closed,showthread_pollresults_cantvote,showthread_firstunread,showthread_nextnewestthread,showthread_nextoldestthread,forumrules,showthread';
require(
'./global.php'); 



All times are GMT. The time now is 06:23 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.01099 seconds
  • Memory Usage 1,756KB
  • 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
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete