![]() |
Having problems with clean_gpc function
I am using the following code...
Code:
function update_event($event) I thought this code would "sanitize" my inputs so that I wouldn't have any poisoning going on... but I still get the following error when I try to input something with a ' in it... Code:
Database error in vBulletin 3.8.1: How do I fix this? |
Code:
clean_gpc(array $source, string $varname, [integer $vartype = TYPE_NOCLEAN]) Code:
[S]clean_gpc('p', 'venue', TYPE_STR)[/S] //bad call Code:
clean_gpc($vbulletin, 'ProductOptionName', TYPE_STR) But what you really need to consider is the addslashes function. Code:
addslashes($input); |
I simply changed it to the following...
Code:
$venue = htmlspecialchars($vbulletin->input->clean_gpc('p', 'venue', TYPE_STR),ENT_QUOTES); https://vborg.vbsupport.ru/showthread.php?t=119372 Code:
clean_gpc('p', 'venue', TYPE_STR) |
That article is from 2006, are you sure that's how they're still calling the function?
What about sticking $_POST in there instead of 'p' ?? Have you tried addslashes? That's the function that replaced magic_quotes. The other thing that article talks about is that you retrieve the value like so: Code:
$vbulletin->GPC['value'] Code:
$vbulletin->input->clean_gpc('p', 'venue', TYPE_STR); Yeah, I think I had it wrong at first, I misunderstood the API. The code sample above should be appropriate. |
htmlspecialchars() is for sanitising HTML, that function should be used on display, and not when inserting into the database. You should be using $db->escape_string() on the variable.
|
Thanks Dismounted... you've solved all of my problems... escape_string is what I was looking for.
|
All times are GMT. The time now is 07:46 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|