Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-03-2003, 12:08 AM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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;

Reply With Quote
  #2  
Old 05-03-2003, 06:57 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

have you tried adding an else?
Reply With Quote
  #3  
Old 05-03-2003, 11:30 AM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm... Yes, actually, but I had the "else" containing the rest of the file. Would that have caused a problem?
Reply With Quote
  #4  
Old 05-03-2003, 05:14 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 
Reply With Quote
  #5  
Old 05-04-2003, 01:30 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 05-04-2003, 02:11 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 05-04-2003, 02:12 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 05-20-2003, 11:25 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone?
Reply With Quote
  #9  
Old 05-21-2003, 12:17 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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];
}
Reply With Quote
  #10  
Old 05-21-2003, 02:41 AM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'); 
Reply With Quote
Reply


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 03:46 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.05303 seconds
  • Memory Usage 2,279KB
  • Queries Executed 13 (?)
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
  • (6)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete