View Full Version : Post variable not working..
rogersnm
07-27-2006, 07:13 AM
Ok, so here's my code:
$vbulletin->input->clean_array_gpc('p', array(
'id' => TYPE_STR, // i have tried TYPE_UNIT
));
if ($vbulletin->GPC['id'] AND is_numeric())
{
$vbulletin->GPC['id'] = $vbulletin->GPC['id'];
} else {
$vbulletin->GPC['id'] = 6;
echo 'not picked up';
}
when i type in: file.php?&id=6 for the adress it doesn't pick up the variable id - 6 - which it should it just sets it as 2 and echo's "not picked up"... Can anybody see what i am doing wrong?
Mythotical
07-27-2006, 07:19 AM
You need to get rid of that echo and turn that into a die(mysql_error(not picked up))
echo will keep showing/repeating instead of actually doing what it should.
I could be wrong tho.
rogersnm
07-27-2006, 07:29 AM
it's not an sql error...
and it doesn't change if i remove it or keep it. It's merely an echo. It shouldn't have any impact at all.
FatalBreeze
07-27-2006, 07:52 AM
i had the same problem the last hack i built, but i managed to solve it finally. here's my code:
$vbulletin->input->clean_array_gpc('r', array(
'userid' => TYPE_STR,
'act' => TYPE_STR,
));
$vbulletin->GPC['userid'] = intval($vbulletin->GPC['userid']);
$vbulletin->GPC['act'] = intval($vbulletin->GPC['act']);
and now it should work, i used type_str for the id cause that's the only one that worked...
i hope it will also work for you and you won't have a problem. all you have to do now is the "if" part.
rogersnm
07-27-2006, 08:35 AM
which is i have already done
thanks, i just have to change UNIT to STR
nope, still not picking it up...
hmm, if i take out the if it works.... it seems to be that the else dominates when it shouldn't...
FatalBreeze
07-27-2006, 08:41 AM
try change
$vbulletin->input->clean_array_gpc('p', array(
to:
$vbulletin->input->clean_array_gpc('r', array(
(notice the 'p' replaced by the 'r' - i gave it to your in the first post but you didn't notice it)
rogersnm
07-27-2006, 08:42 AM
wohoo, thanks for that no it does work :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.