Welcome Guest, Not a member yet? Register   Sign In
How to secure the segment passed by the user?
#1

[eluser]FlyingCat[/eluser]
Hi guys. I was wondering what are the best practice before sending segment to the Model.

For example:

Get the segment1 from
base_url/controller/query_detail/segment1

on my controller
Code:
public function query_detail($segment1)
{
//what are the best practice before I send the segment1 to the Model?
   $this->load->model('model');
   $this->model->query($segment1);  
   ......  
}

I hope I explain well. Thanks for the help.
#2

[eluser]Bhashkar Yadav[/eluser]
yes, in the same way ... a little change
Code:
$this->model->model_method($segment1);

now you can access segment into model_method of model and also $segment1.
#3

[eluser]FlyingCat[/eluser]
[quote author="Bhashkar" date="1327718355"]yes, in the same way ... a little change
Code:
$this->model->model_method($segment1);

now you can access segment into model_method of model and also $segment1.
[/quote]

I have the same thing you have. $this->model->query($segment1)
The 'query' is my model method. I thought people usually check the security before sending the segment to the Model? I just don't know what's the best practice in CI
#4

[eluser]InsiteFX[/eluser]
If you are retrieving the segment then you should know the type and length of it!

Check your segment for it's type and length...

Never never never trust your users input!!!




Theme © iAndrew 2016 - Forum software by © MyBB