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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2005, 04:30 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default pass url to php

i need to pass a url to a php page and i need the php tag to take the code in the url and perform an action on the page

ok let me explain a little better

if a member clicks this link below

http://www.mysite.com/forum/store.php?item=ipod

i want to be able to send that url to the store.php and where it says ipod i want the php page to display ipod listings from my store

i am not bothered about displaying the stuff as i can work that but i need to know how to make urls be able to make the php page work (i know it already works because the search engine on that page can display all this from my store page)

i know some php but i would really appreicate some help with this

Regards
Mickie D
Reply With Quote
  #2  
Old 12-22-2005, 06:19 PM
Guest190829
Guest
 
Posts: n/a
Default

PHP Code:
$vbulletin->input->clean_gpc('r''item'TYPE_NOHTML); 

if (
$vbulletin->GPC['item'] == 'whatever')
{
  
// do something

The above code will take item from the url, and if it equals the text 'whatever' it will //do something.
Reply With Quote
  #3  
Old 12-22-2005, 06:45 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah cheers danny i was reading through the php manual and found the

PHP Code:

$_REQUEST 
code and it has been good can you recommend using your version over the request i was reading that in vbulletin alot of the post and get globals are replaced with the code you said

and one last thing can you tell me what the clean_gpc code at the top does

thanks very much for the reply im very greatful because i dont know alot of the vbulletin built in codes as much as i am confident with the php stuff

and one last thing aswell can you tell me would it be easier to make a switch if i have alot of codes instead of using lots of if's and can you tell me the best way to do it in vbulletin

Regards
Mickie D
Reply With Quote
  #4  
Old 12-22-2005, 06:53 PM
Guest190829
Guest
 
Posts: n/a
Default

PHP Code:
 $vbulletin->input->clean_gpc() 
The above function sanitizing any variables that you are passing via GET, POST, or REQUEST. It's very important that you do this to avoid certain injections in your code.

About the $vbulletin->GPC thing, your code must follow this standard or else the code will not work. The sanitized variable resulting from the $vbulletin->input->clean_gpc() is assigned to it. However in the case of checking if the request == something, you can still use $_REQUEST['whatever'], but I would reccomend following vbulletin's coding standards and using $vbulletin->GPC[].
Reply With Quote
  #5  
Old 12-22-2005, 06:57 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

one last last thing and i will be so happy lol

i have been trying to take a profile field (which i made [field5]) but when i try and make the url in the postbit template

http://www.mysite.com/forums/store.php?item=$post['field5']

i get an error in the templates about a parse error and also is that the right conditional to get the profile field entered into a url so it can add to the rest of my code ?

thanks again for the help
Reply With Quote
  #6  
Old 12-22-2005, 07:10 PM
Guest190829
Guest
 
Posts: n/a
Default

Hm, I'm not really sure if the below will work but try:

PHP Code:
$userinfo[field5
It might only be in member.php in which that variable works...
Reply With Quote
  #7  
Old 12-22-2005, 07:21 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

managed to get it working with the $post[field5] but me being silly and jumping the gun found out that it posts the url as it should but the script does not recognise the actual $post[field5] because its not been added by myself in the if statement

i could never add them all to the php file it would be silly and we have alot of signups all with different stores (hence what the $item is for)

is it possible to make the script turn anything that is entered in a url be searched for as $item instead of having to know from the script what it is ?

i.e

http://www.mysite.com/forums/store.php?item=anything

and then it will search a product (because i can search using a form from my search page aimed at its self (store.php) and it will look for anything because in the form the variable is $item)


but thanks very much danny you have been a great help and made me code nice and tidy

Regards
Mickie D
Reply With Quote
  #8  
Old 12-22-2005, 07:25 PM
Guest190829
Guest
 
Posts: n/a
Default

Well you would do some sort of mysql query using a where clause and the 'anything' being what it's looking for.
Reply With Quote
  #9  
Old 12-22-2005, 07:30 PM
Mickie D Mickie D is offline
 
Join Date: Jun 2002
Posts: 430
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Danny.VBT
Well you would do some sort of mysql query using a where clause and the 'anything' being what it's looking for.
i get ya

you mean like because the profile field is stored in the database i can do a call to the database looking for the profile[field5] and then returning that as the $item

ill get looking into this im not great with mysql but i know where to start and you have helped me greatly.

top man danny can see why you are a mod here !

Regards
Mickie D
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 01:33 AM.


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.04134 seconds
  • Memory Usage 2,236KB
  • Queries Executed 13 (?)
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_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (5)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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