I have some data coming from a form, and I'm trying to encrypt part of
it and save it in a mysql db. Everything gets saved, except the
encrypted field, which is empty when I look in the database.

I'm new to CakePHP and wasn't successful googling for a solution,
thanks for taking the time to read this.

/*
 * Encrypts and saves message
 */
function compose() {
                if(!empty($this->data)) {

                        $this->data['Message']['user_id'] = $this->Session-
>read('Auth.User.id');

                        // Encrypt message
                        $security = new Security;

                        $this->data['Message']['msg'] = $security->cipher($this-
>data['Message']['msg'],
                                                                                
                Configure::read('Security.cipherSeed'));

                        // Save message
                        if($this->Message->save($this->data)){
                                $this->Session->setFlash('Ok', 'flash_ok');
                        } else {
                                $this->Session->setFlash('Error');
                        }
                }
        }
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to