vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Looping templates help (https://vborg.vbsupport.ru/showthread.php?t=187608)

RLShare 08-11-2008 01:35 AM

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'.

veenuisthebest 08-11-2008 02:26 AM

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

RLShare 08-11-2008 03:08 AM

You do not need the security tokens in a 'get' form.

veenuisthebest 08-11-2008 12:46 PM

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 ?

RLShare 08-11-2008 07:20 PM

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.

veenuisthebest 08-12-2008 01:16 AM

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

RLShare 08-12-2008 02:00 AM

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.

veenuisthebest 08-12-2008 03:08 AM

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


All times are GMT. The time now is 11:47 AM.

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.01035 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete