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

Reply
 
Thread Tools Display Modes
  #11  
Old 02-08-2007, 06:16 AM
KingPuyol KingPuyol is offline
 
Join Date: Oct 2006
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by harmor19 View Post
PHP Code:
if($_GET['act'] == "mods")
{
   echo 
"List mods";

   if(
$_GET['do'] == "download")
   {
       echo 
"download mod ID: ".$_GET['modid'];
   }

Thanks, I really appreciate it, and the "List mods" will be shown everywhere isn't it?

Quote:
Originally Posted by AN-net View Post
if($_REQUEST['modid'] == 46)
{
do something;
}
if($_REQUEST['page'] == "home)
{
do something else;
}

please though run your data through the vbulletin GPC if your using vbulletin or sanatize incoming data.
What's the difference between $_GET and $_REQUEST?
Reply With Quote
  #12  
Old 02-08-2007, 06:23 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$_REQUEST can be used as both $_POST and $_GET
Reply With Quote
  #13  
Old 02-08-2007, 09:27 AM
KingPuyol KingPuyol is offline
 
Join Date: Oct 2006
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply
Reply With Quote
  #14  
Old 02-08-2007, 09:43 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps you should start by reading about php, these are pretty basic questions covered by any php online manual or book.
Reply With Quote
  #15  
Old 02-11-2007, 09:21 AM
KingPuyol KingPuyol is offline
 
Join Date: Oct 2006
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
Perhaps you should start by reading about php, these are pretty basic questions covered by any php online manual or book.
I actually know these stuff but they didn't work at the first place for some typo mistakes, that's why I asked.

I just have one more question:

If I had a MySQL table called players:
Code:
ID   -   Player
1    -    John
2    -    Paul
3    -    Puyol
By using $_GET, how can I set the value of "$playername" to the player name in the database according to the ID.

For example, if someone opened index.php like:
index.php?id=1, then I want the $playername to be set to John, and if ?id=2 then to be set to Paul, then if ?id=3 then to be set as Puyol. According to what's on the database.
Reply With Quote
  #16  
Old 02-11-2007, 10:12 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
Perhaps you should start by reading about php, these are pretty basic questions covered by any php online manual or book.
as paul says
start reading about php and mysql
or look into the tutorials

https://vborg.vbsupport.ru/forumdisplay.php?f=184
Reply With Quote
  #17  
Old 02-11-2007, 03:01 PM
KingPuyol KingPuyol is offline
 
Join Date: Oct 2006
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ragtek View Post
as paul says
start reading about php and mysql
or look into the tutorials

https://vborg.vbsupport.ru/forumdisplay.php?f=184
I know what he said and I couldn't find it because what I want to do is lots of combination of codes and I've read lots and lots of php tutorial and I can't waste some time in finding this answer, so if anyone can be kind enough in giving me the answer please.
Reply With Quote
  #18  
Old 02-11-2007, 04:55 PM
RedTyger's Avatar
RedTyger RedTyger is offline
 
Join Date: Nov 2006
Location: UK
Posts: 1,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would use something like

Code:
SELECT *
FROM yourdb
WHERE id='" . $_REQUEST['id'] . ''
In this case I'd also use strlen and is_numeric to check that it's only a number and it's very short character sequence being requested, or some other failsafing of your choice. Note the use of REQUEST and not GET, when using vBulletin you should always use REQUEST and not GET.

Quote:
Originally Posted by harmor19 View Post
$_REQUEST can be used as both $_POST and $_GET
That's not strictly speaking true, $_REQUEST is a combination of both. It's not a case of "can be used" as you don't have a choice.
Reply With Quote
  #19  
Old 02-11-2007, 06:13 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm pretty sure you would want to clean the variables before doing something like that.
Reply With Quote
  #20  
Old 02-11-2007, 06:45 PM
Guest190829
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by thincom2000 View Post
I'm pretty sure you would want to clean the variables before doing something like that.
Yes, always clean global variables $_POST, $_GET, and $_REQUEST with vBulletin's built in cleanser:

https://vborg.vbsupport.ru/showthread.php?t=119372
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:28 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.04357 seconds
  • Memory Usage 2,265KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (7)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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete