php - SQL queries in Redbeanphp -


i trying execute following code using redbeansphp(works on top of php pdo). issue when pass valid id in format - "id;drop table users;" , if id matches id in database result returned. although sql injection doesnt work. tried other methods of injection well. none of them works. why result though id incorrect. 1 more thing that if add code in front of id results don't come. ?

$article =  r::getall( 'select avg(rating) reviews id =?', array($id));          //throwing exception if query unsuccesful         if(!$article){             throw new exception();         }          //response message          $arr=array('status' => 'successful', 'message' => 'reviews found','reviews'=> $article );         $app->response()->header('content-type', 'application/json');         $msg=json_encode($arr);         $app->response->body($msg ); 

after lot of research , going through redbeans file came across abs() function being used in binding parameters.it returns absolute value "number" input. if 1 enters abs("11;drop table users;"), function converts 11.

so, reason though invalid input(with valid id preceeding it) given, 1 gets valid output without sql injection.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -