php - Laravel 5 route get parameters SQLinjection -


i have route

route::get('/car-{traveltype}/{cityfrom}-{cityto}-{id}.html','articlecontroller@getdetail')->name('articles_detail'); 

and in controller, catch parameters this

public function getdetail($cityfrom, $cityto, $id, request $request) {     $article_detail = db::select("call article_detail(?,?,?)", [$cityfrom,$cityto,$id]);     return $article_detail; } 

this working fine there have problem query getting sqlinjection because route sent raw parameter.

in post request can catch request $request->input('some_fields') , laravel protect me behind screen, not in request.

how can resolved issue?

you can use $request->get('somefield') on request using

www.site.com/page?somefield=value 

in case when take $request->get('somefield') should give "value"

so in case :

www.site.com/page?travel-type=foo&city-from=berlin&city-to=munich&id=1  $request->get('travel-type'); // foo $request->get('city-from');   // berlin $request->get('city-to');     // munich $request->get('id');          // 1 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -