Jump to content

help stupid long `T_STRING error


Rifts

Recommended Posts

 

     $sql1 = "INSERT INTO `playerdb` ( `ID` , `User_ID` , `User_PW` , `Rx` , `Ry` , `Rz` , `Tx` , `Ty` , `Level` , `XP_total` , `XP_spent` , `qp` , `class` , `Base_h` , `Base_t` , `Base_ar` , `Base_al` , `Base_l` , `Base_b` , `Bday` , `Creation_time` , `Last_login` , `Admin` , `Items` , `Worn` , `att` , `att_xp` , `agi` , `agi_xp` , `dex` , `dex_xp` , `vit` , `vit_xp` , `mag` , `mag_xp` , `skill_name` , `skill_xp` ) VALUES ('', '$_POST['uid']', '$_POST['upw']', '$Rx', '$Ry', '$Rz', '$Tx', '$Ty', '1', '0', '0', '0', '$_POST['classa']', '$_POST['haira']', '$_POST['bodya']', '$_POST['armsa']', '$_POST['armsa']', '$_POST['legsa']', '$_POST['bootsa']', '$_POST['age_yeara']-$_POST['age_montha']-$_POST['age_daya']', NOW( ) , NOW( ) , '0', '', '', '5', '0', '5', '0', '5', '0', '5', '0', '5', '0', '$skilllvls', '$skillexps')";

 

 

Link to comment
https://forums.phpfreaks.com/topic/211406-help-stupid-long-t_string-error/
Share on other sites

Enclose your $_POST array element vars in curly braces (or use proper string concatenation). Also, you really shouldn't be putting user-supplied form data directly into a query string. It should be sanitized with mysql_real_escape_string(), typecasting, etc. first to prevent SQL injection.

 

$sql1 = "INSERT INTO `playerdb` ( `ID` , `User_ID` , `User_PW` , `Rx` , `Ry` , `Rz` , `Tx` , `Ty` , `Level` , `XP_total` , `XP_spent` , `qp` , `class` , `Base_h` , `Base_t` , `Base_ar` , `Base_al` , `Base_l` , `Base_b` , `Bday` , `Creation_time` , `Last_login` , `Admin` , `Items` , `Worn` , `att` , `att_xp` , `agi` , `agi_xp` , `dex` , `dex_xp` , `vit` , `vit_xp` , `mag` , `mag_xp` , `skill_name` , `skill_xp` ) VALUES ('', '{$_POST['uid']}', '{$_POST['upw']}', '$Rx', '$Ry', '$Rz', '$Tx', '$Ty', '1', '0', '0', '0', '{$_POST['classa']}', '{$_POST['haira']}', '{$_POST['bodya']}', '{$_POST['armsa']}', '{$_POST['armsa']}', '{$_POST['legsa']}', '{$_POST['bootsa']}', '{$_POST['age_yeara']}-{$_POST['age_montha']}-{$_POST['age_daya']}', NOW( ) , NOW( ) , '0', '', '', '5', '0', '5', '0', '5', '0', '5', '0', '5', '0', '$skilllvls', '$skillexps')";

the values are from drop down boxes so users can not enter anything

 

LOL, anyone can submit any values they want because they don't need your form to do so.

 

A hacker or just someone who wants to cheat at whatever you are doing could inject sql and INSERT any number of records into your table with any values they want.

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.