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

Reply
 
Thread Tools Display Modes
  #11  
Old 05-11-2011, 07:48 PM
Artistichaven Artistichaven is offline
 
Join Date: Feb 2011
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
That's a good question, and I just now figured it out: the print_form_header() function is adding do on the url *and* as a hidden field, and the hidden field value is run through htmlspecialchars(), so the '&' gets encoded and it looks like one field. I guess this hidden POSTed field is overriding the GET value for do on the url. So maybe your existing code would work if you used $_GET for do and u and $_REQUEST for the rest of the values.



I think you need {$vbulletin->GPC['userid']} to make it so you don't get "Array['userid'] ".
I changed it from if ($_REQUEST['do'] == 'banned') to $_GET and it didn't work. Maybe I should try displaying the URL.
Reply With Quote
  #12  
Old 05-11-2011, 08:03 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I wish I understood this: I put a print_r($_GET) in the code and got this:

Array ( [do] => banned&u=1 [u] => 1 [userid] => 1 )

So somehow it's actually finding the u parameter, but insists on lumping it in with the do value as well. I changed the print_form_head() code to 'do=banned&u=1' and it makes no difference to what's in the $_GET array.
Reply With Quote
  #13  
Old 05-11-2011, 08:10 PM
Artistichaven Artistichaven is offline
 
Join Date: Feb 2011
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How did you check it?
Reply With Quote
  #14  
Old 05-11-2011, 08:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I created a plugin using hook location misc_start and this code:

Code:
if ($_REQUEST['do'] == 'form')
{
   require_once("includes/adminfunctions.php");
  $userid = 1;
  print_form_header('misc', 'banned&u=' . $userid);
  print_table_header("Ban a User");
  print_label_row("Ban: " . $username);
  print_select_row("Ban Length", 'banLength', array(24 => "1 Day", 48 => "2 Days", 72 => "3 Days", 168 => "1 Week", 336 => "2 Weeks", 720 => "1 Month", -1 => "Permanently"), $vbulletin->GPC['userid']);
  print_input_row("Ban Reason:", 'banreason');
  print_submit_row("Ban");
    exit;
}
if (strpos($_GET['do'], 'banned') === 0)
{
    echo "banned userid=" . $_REQUEST['userid'] . "<BR />\n";
    print_r($_GET);
    exit;
}

Then I go to url misc.php&do=form, then submit the form.

I think I'm going to try a non-vb test file and see if maybe some vb code is messing with $_GET[do].
Reply With Quote
  #15  
Old 05-11-2011, 08:19 PM
Artistichaven Artistichaven is offline
 
Join Date: Feb 2011
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I created a plugin using hook location misc_start and this code:

Code:
if ($_REQUEST['do'] == 'form')
{
   require_once("includes/adminfunctions.php");
  $userid = 1;
  print_form_header('misc', 'banned&u=' . $userid);
  print_table_header("Ban a User");
  print_label_row("Ban: " . $username);
  print_select_row("Ban Length", 'banLength', array(24 => "1 Day", 48 => "2 Days", 72 => "3 Days", 168 => "1 Week", 336 => "2 Weeks", 720 => "1 Month", -1 => "Permanently"), $vbulletin->GPC['userid']);
  print_input_row("Ban Reason:", 'banreason');
  print_submit_row("Ban");
    exit;
}
if (strpos($_GET['do'], 'banned') === 0)
{
    echo "banned userid=" . $_REQUEST['userid'] . "<BR />\n";
    print_r($_GET);
    exit;
}

Then I go to url misc.php&do=form, then submit the form.

I think I'm going to try a non-vb test file and see if maybe some vb code is messing with $_GET[do].

I got it to work! Your error here was "'banned&u='" it should have been "'banned&amp;u="
Reply With Quote
  #16  
Old 05-11-2011, 08:28 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep...and I was sure I tried that, but I must have messed it up.

Anyway, I also made a file called testform.php containing only this:

Code:
<?php
print_r($_GET);
?>

and changed the form script to 'testform', and I got this:

Code:
Array ( [do] => banned [u] => 1 )

even with 'do=banned&u=1' (no &amp; ).

So I guess the 'problem' is that the vb startup code is doing something with the 'do' value. I put 'problem' in quotes because there may be a good reason for it that I don't understand.

Anyway, sounds like you've got it solved.
Reply With Quote
  #17  
Old 05-11-2011, 09:36 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Artistichaven View Post
I got it to work! Your error here was "'banned&u='" it should have been "'banned&amp;u="
They should have both worked in that case as &amp; = &.

&amp; is the validated way to use &.
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 05:10 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.05705 seconds
  • Memory Usage 2,226KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_code
  • (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
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete