Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 08-11-2008, 01:35 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh ok lol... Change the forms method from 'POST' to 'GET'. Aslo change the action from 'page.php?do=search' to just 'page.php' and add a hidden input with the name 'do' that has the value set as 'search'.
Reply With Quote
  #12  
Old 08-11-2008, 02:26 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ahh.. thank you so much !! I had used get method earlier but did not change action or added that hidden field. It does work now. You solved a big problem of mine.

alright.. one more thing, GET method adds all the fields in the URL. How do I remove some ? for ex. that long securitytoken value also appends now. I must use that but do not want to show that in URL.

Thank You
Reply With Quote
  #13  
Old 08-11-2008, 03:08 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You do not need the security tokens in a 'get' form.
Reply With Quote
  #14  
Old 08-11-2008, 12:46 PM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh great.. everything works now !!

few more things plzz :-

1. How do I make URL parameters mandatory or say redirect to main page or give an error message. Say, I have a page with a form that works only like page.php?do=edit&uid=50. Now, I do not want it to be opened/viewed like page.php?do=edit as it shows a blank form.

2. I wanted to know, when is $db->close(); used ?
Reply With Quote
  #15  
Old 08-11-2008, 07:20 PM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Judging by your url, I have one comment about it. The url makes it seem as if your editing something on the page, I would go back to using the POST request or implement your own CRSF protection on the GET request if your page allows for editing of anything important. VB's CSRF does not cover get requests only post requests.


1.
PHP Code:
if(empty($_REQUEST['uid'])){
//there was no uid sent to the form


2. when your finished with the database.
Reply With Quote
  #16  
Old 08-12-2008, 01:16 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes I am already using POST method there for the above "edit form page" and have implemented the CSRF protection.

1. Great.. DONE !

2. In my page, its like this:-

PHP Code:
if(empty($_REQUEST['do'])) 
{
     
# Go to a default catch all
     
$_REQUEST['do'] = 'main';
}

if(
$_REQUEST['do'] == 'main') {
  
// Main page code
}

if(
$_REQUEST['do'] == 'sub1') {
  
// sub page 1 code...

}

// and so on..... 
So, where do I put $db->close(); ? at the end of every subpage ? or just once at the very end above ?>

Thank You
Reply With Quote
  #17  
Old 08-12-2008, 02:00 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

From what I understand you do not need to use that unless your accessing the database in your code. And all that function does is clean up and close the connection to the database.

If Im wrong someone may correct me.
Reply With Quote
  #18  
Old 08-12-2008, 03:08 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but I am accessing database in my code, lot of queries are there !

Also, please tell, is there a way to insert escape charaters in the database by NOT using $vbulletin->db->escape_string_like(htmlspecialchars_uni($variable )) in the query, as it makes it very long when there are many fields.

Thanks
Reply With Quote
Reply

Thread Tools
Display Modes

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:09 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.04213 seconds
  • Memory Usage 2,221KB
  • 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
  • (2)bbcode_php
  • (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
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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