Jump to content

Wat does this? GetVar?


Gayner

Recommended Posts

$item_id = GetVar('item_id', 0, 'int');[/cod]e

then it uses it for 

:

[code]$DB->query("INSERT INTO {items_purchased} (item_id, pack_id, group_id, user_id, points_spent, purchase_date)
                VALUES ($item[item_id], $item[pack_id], $item[group_id], $user_info[user_id], $item[cost], " . TIME_NOW . ")");

 

 

what essentially is it doing?

Link to comment
https://forums.phpfreaks.com/topic/175573-wat-does-this-getvar/
Share on other sites

item_id is used

$item_id = GetVar('item_id', 0, 'int');[/cod]e

then it uses it for 

:

[code]$DB->query("INSERT INTO {items_purchased} (item_id, pack_id, group_id, user_id, points_spent, purchase_date)
                VALUES ($item[item_id], $item[pack_id], $item[group_id], $user_info[user_id], $item[cost], " . TIME_NOW . ")");

 

 

what essentially is it doing?

 

 

That just a cocky programmer, what i can see,

 

just a way to confuse the person that get the script i think,

 

i think the variable $item_id was misspelled should off been called $item

 

conclusion this part of the code.

 

$item_id = GetVar('item_id', 0, 'int'); << the number off these should match the insert number of variables, if i am correct.

 

The GetVar is another function to set the internal array settings to protect the database off a insert...

 

what i think anyway?

 

Link to comment
https://forums.phpfreaks.com/topic/175573-wat-does-this-getvar/#findComment-925223
Share on other sites

Yeah damn those cocky bastards, intentionally trying to confuse us all..  ::)

 

But for real, the best way to find out what something does in absence of documentation is look at the code. Find "function GetVar" in the code somewhere. But if I would have to make an educated guess, you'll find something like this:

 

function GetVar($index, $default = null, $dataType = 'string')
{
return settype(isset($_GET[$index]) ? $_GET[$index] : $default, $dataType);
}

Link to comment
https://forums.phpfreaks.com/topic/175573-wat-does-this-getvar/#findComment-925258
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.