vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using $_GET (https://vborg.vbsupport.ru/showthread.php?t=138601)

RedTyger 02-11-2007 08:16 PM

That's what I just said. :confused:

Is there any reason to use the input cleaner instead of just performing the checks yourself as I suggested? The advantage that way is that you don't have to change the way you access the variable and you can also assign extra or different checks instead of being limited to the few GPCs and can assign if/else to deal with the data as well. That's a terrific tutorial but the one thing it doesn't do is explain why you should use it instead of your own way.

KingPuyol 02-12-2007 01:11 PM

Thanks :)

If I did this:
$playername = SELECT name FROM players WHERE id='" . $_REQUEST['id'] . ''

Will it work?

Guest190829 02-12-2007 03:44 PM

Quote:

Originally Posted by RedTyger (Post 1180150)
That's what I just said. :confused:

Is there any reason to use the input cleaner instead of just performing the checks yourself as I suggested? The advantage that way is that you don't have to change the way you access the variable and you can also assign extra or different checks instead of being limited to the few GPCs and can assign if/else to deal with the data as well. That's a terrific tutorial but the one thing it doesn't do is explain why you should use it instead of your own way.

It complies with vBulletin's coding standards, I don't know why you wouldn't want to use a tool like that provided for you. If you are going to run the sanitizing functions manually, it is fine, but it is always open to you forgetting to clean a variable. If you use $vbulletin->GPC, you have more confidence that your variables are being cleansed properly.

Analogpoint 02-12-2007 04:08 PM

The only case where I would consider not using vB's sanitizing functions would be if you're only dealing with one single int variable in a plugin, then it would probably be more readable/simpler to just use intval to force it to be an int. If I remember right, that's what vB does anyway to sanitize an int variable.

$i = intval ($_GET['i']);

In all other cases (and maybe even in this one), follow Danny's advice.

KingPuyol 02-13-2007 12:24 PM

What should I put in the red text if I'm going to using REDTYGER's advice?

Code:

if($_GET['id'] == "here)
{
do something else;
}



All times are GMT. The time now is 09:36 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.01108 seconds
  • Memory Usage 1,727KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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