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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2005, 01:37 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default passing the $post[userid]

I am making a custom mod for someone and I'm stuck.

I made a link "battle_stats.php?bs=$post[userid]" in the postbit_legacy template and the userid shows up.

In the battle_stats.php file what do I put in the query to receive that userid from the userfield?

I am trying to make a pop-up window with certain profile fields.
Reply With Quote
  #2  
Old 09-04-2005, 01:45 AM
Guest190829
Guest
 
Posts: n/a
Default

I think you have to use $_GET to access a variable in a url. Also make sure you sanitize it before doing anything with it. (Globalize for 3.0 or $vbulletin->input->clean_array_gpc() for 3.5)
Reply With Quote
  #3  
Old 09-04-2005, 02:02 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is for version 3.0.8
I have tried these three but they don't work

Code:
$getstats = $DB_site->query("SELECT * FROM userfield WHERE userid='$post[userid]'")or die(mysql_error());
   $stats = mysql_fetch_array($getstats);
Code:
$getstats = $DB_site->query("SELECT * FROM userfield WHERE userid='$_GET[userid]'")or die(mysql_error());
   $stats = mysql_fetch_array($getstats);
Code:
$getstats = $DB_site->query("SELECT * FROM userfield WHERE userid='$userid'")or die(mysql_error());
   $stats = mysql_fetch_array($getstats);
can you explain "sanitize" and "globalize"?
Reply With Quote
  #4  
Old 09-04-2005, 02:34 AM
Guest190829
Guest
 
Posts: n/a
Default

Your using some functions that have specific vbulletin functions

like mysql_fetch array equals
PHP Code:
$DB_site->fetch_array($foo
..

I suggest reading Brad's excellant tutorial located here

You can also use
PHP Code:
$DB_site->query_first 
instead of just query, since your only retrieving one row.

Globalize santizes variables to make sure they are holding the correct data types, this helps greatly with security.
Reply With Quote
  #5  
Old 09-04-2005, 03:10 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have tried the following but it gave me a blank white screen.
Code:
 $DB_site->query_first
Reply With Quote
  #6  
Old 09-04-2005, 03:23 AM
Guest190829
Guest
 
Posts: n/a
Default

Here's an example of using it:

PHP Code:
 $query $DB_site->query_first("SELECT * FROM userfield WHERE userid='" .$userid "'"); 
Reply With Quote
  #7  
Old 09-04-2005, 03:39 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh!! I see.

I tried it with
Code:
 $getstats = $DB_site->query_first("SELECT * FROM userfield WHERE userid='".$userid."'");  
   $stats = $DB_site->fetch_array($getstats);
But "$stats = $DB_site->fetch_array($getstats);" isn't needed.

Maybe I have to join tables together because the variable isn't being passed.
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 04:22 PM.


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.03625 seconds
  • Memory Usage 2,216KB
  • 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
  • (5)bbcode_code
  • (3)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
  • (4)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