Send ID by GET

1

I am currently working with codeigniter and I am passing a parameter as follows:

<p><a href="<?= base_url()?>session/documentos/<?= $id_cur_ses ?>"><strong>DOCUMENTOS</strong></a><br>

The issue is that on the next page the ID appears in the URL and if someone modifies it automatically it refreshes with the data of the ID that I modify, my query is: How do I make this happen? That is, when someone changes the transaction is canceled or does not show data.

    
asked by Luis Vega 01.08.2016 в 17:28
source

2 answers

1

Depending on how the application works and what you want / need to do, you can use one or more of these at the time:

  • Do not use GET. You can use POST, PUT, etc. depending on what you need and you will not see the ID in the URL, however making a request for POST changing the ID may not be so complicated.
  • Use the PHP session to store the current Id and do not let others see at a certain time, according to the logic of your application.
  • Create / use permissions within your application, for example: the user only has access to the IDs he created himself.
answered by 01.08.2016 в 17:47
0

Use encrypt as follows:

<?= base_url();?>session/documentos/<?=$this->encrypt->encode($id_cur_ses);?>

But before that, you have to activate the library in the autoload in the following way:

$autoload['libraries'] = array('encrypt');

I hope I have served you, Greetings! ;)!

    
answered by 01.09.2016 в 16:35