The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vB4 - Trouble using variables from custom form in dynamic PHP page
I have set up a dynamic PHP page that includes a custom form like this from which I want to use the input field's value for a database query search:
Code:
$search_output .= '<form name="medal_search" action="' . $searchURL . '" method="post">'; $search_output .= '<label for="medal_search_player">Spieler suchen (Name oder SteamID eingeben):</label>'; $search_output .= '<input name="medal_search_player" type="text" value="' . $playerSearchString . '" />'; $search_output .= '<input id="medal_search_token" name="securitytoken" value="' . vb::$vbulletin->userinfo[securitytoken] . '" type="hidden" />'; $search_output .= '<input name="do" value="process" type="hidden" />'; $search_output .= '<input type="submit" value="Suchen..." />'; $search_output .= '</form>'; Code:
vB::$vbulletin->input->clean_gpc('p', 'medal_search_player', TYPE_STR); Code:
$medalStatsSearchVars = array( 'medal_search_player' => vB::$vbulletin->input->clean_gpc('p', 'medal_search_player', TYPE_STR), 'name' => vB::$vbulletin->input->clean_gpc('g', 'name', TYPE_STR), 'steamid' => vB::$vbulletin->input->clean_gpc('g', 'steamid', TYPE_STR) ); vB_Template::preRegister('vbcms_content_phpeval_page', array('medalStatsSearchVars' => $medalStatsSearchVars)); echo $medalStatsSearchVars['medal_search_player'] . '|' . $medalStatsSearchVars['name']; Code:
$medalStatsSearchVars['medal_search_player'] $vbulletin->GPC['medal_search_player'] |
#2
|
||||
|
||||
First of all:
Never use strings from user input in output directly -> Cross Site Scripting. What's in the twmplate (vbcms_content_phpeval_page) you are trying to output? It needs to be smth. like Code:
Player Name: {vb:raw medalStatsSearchVars.medal_search_player} |
#3
|
|||
|
|||
Quote:
To make this situation more clear: I created a new article and selected dynamic PHP content which uses said template, then I pasted my PHP code into that article and that's where I want to use the variables. The code format that you posted is only usable in a HTML template if I'm not mistaken? |
#4
|
||||
|
||||
Quote:
PHP Code:
You can't put any custom variables into template vbcms_content_phpeval_page without customizign it (or creating a new one). The only variable that is their for your ot use is $outut: PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|