vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Still need some help (https://vborg.vbsupport.ru/showthread.php?t=100868)

Parker Clack 11-15-2005 03:32 PM

Still need some help
 
I have a link that I am using to call on a php file with an id in it. For some reason the external file doesn't get the id.

If I use http://www.myplace.com/my.php?do=edit&id=133

and I have in my php file

Code:

if ($_REQUEST['do'] == 'edit') {

  $ba = $db->query("SELECT * FROM " . TABLE_PREFIX ."mytable WHERE id='$id'");

The value of the id doesn't make it to the php file and I get a database error at id=.

Any ideas what has changed in 3.51 that the file doesn't get the id number? It used to work in 2.xx just fine.

Thanks,
Parker

tnguy3n 11-15-2005 05:47 PM

and what's the variable $id in your script?

Marco van Herwaarden 11-15-2005 05:54 PM

It should at least be $_REQUEST['id'], but using it like this in a query, will open your script to SQL insertions.

You should really consider sanatizing the input before using it.

Parker Clack 11-15-2005 06:52 PM

the variable id comes from the link after the do=edit.

Marco:

So something like
Quote:

$ba = $db->query("SELECT * FROM " . TABLE_PREFIX ."mytable WHERE id=$_Request['id']");

tnguy3n 11-15-2005 09:42 PM

TRY:

PHP Code:

$vbulletin->input->clean_array_gpc('r', array('id' => TYPE_INT));

$ba $db->query("SELECT * FROM " TABLE_PREFIX ."mytable WHERE id = '" intval($vbulletin->GPC[id]) . "'"); 



All times are GMT. The time now is 02:02 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.00924 seconds
  • Memory Usage 1,719KB
  • 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_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete