加密在保存之前在UI中输入的Phone_Office值,并将加密值传递给Phone_Office。但是该值未保存在数据库中。我在以下文件中进行了更改: - 模块/帐户/AccountsFormBase.PHP 在此我添加了以下函数下的代码: - function handleSave($ prefix,$ redirect = true,$ useRequired = false) { //为Accounts模块编写的其他代码位于此处//以下是我添加的代码段。
$text = $_POST['phone_office'];
$PhNum = $_POST['phone_office'];
$cipher = mcrypt_module_open ( MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '' );
$iv_size = mcrypt_enc_get_iv_size ( $cipher );
$key = '12345678901234561234567890123456';
$iv = '9532654BD781547023AB4FA7723F2FCD';
//加密
if (mcrypt_generic_init ( $cipher, $key, $iv ) != - 1) {
$encrypted = mcrypt_generic ( $cipher, $text );
mcrypt_generic_deinit ( $cipher );
}
// Decrypt
if (mcrypt_generic_init ( $cipher, $key, $iv ) != - 1) {
$decrypted = mdecrypt_generic ( $cipher, $encrypted );
mcrypt_generic_deinit ( $cipher );
}
$txtE = bin2hex ( $encrypted );
$phone_office = $txtE;
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->save($check_notify);
答案 0 :(得分:0)
您应该为电话号码使用正确的变量:
$focus->phone_office = $txtE;
您目前将值分配给新变量,当您保存焦点时,不会使用新变量。