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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-16-2010, 05:33 PM
razec razec is offline
 
Join Date: Nov 2009
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Form problems: everything posts as "S"

I created my own PHP-based form that integrates with vBulletin. When the form posts, everything has a value of "S" which makes absolutely no sense. I'll have a text input field called "CompanyName", and then in the code to process the form I'll have:


echo $_POST['CompanyName'];


The value will show as "S". It's like this for all of my fields.

I'm using the method described in this post to generate my form/page. The same file that generates the form is also the one that handles the processing. I'm just using a switch() to check the value of a hidden field that determines if the form has been submitted or not. Of course, that doesn't work right either because the value of that hidden field is also posting as "S", even though if I view source on the form it shows the correct value.

Any ideas why this is happening?


EDIT: I should mention, if I change the target of the form to a PHP file that does not use any of the vBulletin stuff from that post mentioned above (no template or anything, just straight output), the values display properly. I'm assuming it's something that vBulletin does to forms?
Reply With Quote
  #2  
Old 01-16-2010, 06:03 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's really hard to tell what is going on from what you said, but you shouldn't be using echo on a page. You should be putting your results into a variable and then the variable in the template.

Also, make sure you are running your form input through the vbulletin cleaner (there are articles on this).
Reply With Quote
  #3  
Old 01-16-2010, 06:08 PM
razec razec is offline
 
Join Date: Nov 2009
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The echo was just for testing purposes when I realized the form wasn't working at all. As far as the input cleaner goes, I was not aware of that. I'll take a look for the article you mentioned.

--------------- Added [DATE]1263672988[/DATE] at [TIME]1263672988[/TIME] ---------------

Just a clarification: by input cleaning, is there something else I should be doing in addition to mysql_real_escape_string()? That's the function I use to prevent SQL injection, but I don't know if you mean that there's something else that vBulletin has to format/handle/process/whatever form data.

--------------- Added [DATE]1263673697[/DATE] at [TIME]1263673697[/TIME] ---------------

Ok, I think I figured it out and it appears to be the problem you've described. I located this post which describes the input cleaner.

When I used clean_array_gpc() and changed $_POST['CompanyName'] to $vbulletin->GPC['CompanyName'], everything looks good so far. I'll keep playing around with this but I think this is the solution.

Thanks again, Lynne.
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 09:48 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.03677 seconds
  • Memory Usage 2,175KB
  • 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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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