Hello All,
I have a tabel with data in it.
i have created a form that store's the data, its working fine.
now i want to encrypt the saved data only on 1 textfield.
is this possible and how can i do it?
Printable View
Hello All,
I have a tabel with data in it.
i have created a form that store's the data, its working fine.
now i want to encrypt the saved data only on 1 textfield.
is this possible and how can i do it?
Use a HOOK before values are saved and use the class Encryption in
system/modules/core/library/Contao/Encryption.php
e.g.
PHP Code:
\Encryption::encrypt($myVar)
Thanks for the replay,
I have made a hook and add it to my config file,
When i create a autoload (backend autoload creator) the class is not be saved in my autoload.
The hook in config/config.php :
and the class in classes/encrypt_form_data.php is :Code:$GLOBALS['TL_HOOKS']['prepareFormData'][] = array('encrypt_form_data', 'MyEncryptFormData');
When i add it in autoload.php See code below i get a error Cannot redeclare classCode:<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
class MyEncryptFormData
{
public function EncryptFormData($arrSubmitted, $arrLabels, $objForm)
{
if (isset($arrSubmitted['dossier'])){
$arrSubmitted['dossier'] = Encryption::encrypt($arrSubmitted['dossier']);
}
}
}
Code:'encrypt_form_data' => 'system/modules/inbalans/classes/encrypt_form_data.php',
First build an extension with the extension creator from within back end. Then take a look at the config files. It should be self-explanatory.
Thanks, The problem is solved.
My class was a different name then the file so it wassend loading.