I have a field in my database table with the name download_key. It is saved normally in the table no encryption is done. I am sending this key as hidden value in the form. If someone right click on the page and view the source of page the key is visible. Is it possible to encrypt it in the view only? I am also comparing the hidden value of the key with the one stored in database.
Some code
Controller
$query = $this->db->get_where('mc_boxes', array('idmc_boxes' => $id));
$row = $query->row();
$data['download_key'] = strtolower($row->downloadkey);
Inside my view
<form name="form" method="post" onsubmit="return validateForm('<?php echo $download_key ?>')">
<input type="hidden" name="key" value="<?php echo $download_key ?>" />
</form>
There are Encryption/Decryption functions available – please have a look at http://codeigniter.com/user_guide/libraries/encryption.html
See if this helps in your case. 🙂