Question

My question can look stupid but I need to get in touch and get a decision. I want to pass parameters to url without the parameters being seen in the url. this is to secure my server. Because the url looks like this

controller/edit/123

and the '123' is the user ID in the database. I can simple do this

public function action_edit($id) {
    get_db_info($id);
}

Is it possible to hide the parameter while redirecting to this url from a view? ie in the view file

// Do something to set the ID
<?php Kohana_Request::post("user_id", $id); ?>
<a href="<?=URL::base()?>controller/edit">Click</a>

and get the ID like this

public function action_edit() {
    $id = $this->request->post("user_id");
    get_db_info($id);
}

But the problem I can't access the KOhana_Request instance and get this error

*Non-static method Kohana_Request::post() should not be called statically*

Can someone gives a secured approach to this ?

No correct solution

OTHER TIPS

I think I found a solution by encoding and decoding the parameters.

Since Kohana 3.3 do not allow parameters in controller functions see .

I do this in my view

$user_id = Encrypt::instance()->encode($liste->user_id);
$encode_id = base64_encode($user_id);
$encode_ure_id = urlencode($encode_id);

And from the controller,

$encoded_id = urldecode($this->request->param('uri_id'));
$encode_base_url = base64_decode($encoded_id);
$user_id = Encrypt::instance()->decode($encode_base_url);

If this can help others.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top