<?php
class ContactsController extends AppController {
    var $name = 'Contact';
    var $uses = 'Contact';
    var $components = array('Email', 'MathCaptcha');

    function index() {
        if ($this->RequestHandler->isPost()) {
            $this->Contact->set($this->data);
            if ($this->MathCaptcha->validates($this->data['Contact']
['security_code'])) {
                if ($this->Contact->validates()) {
                    //$this->Email->to =
Configure::read('SiteSettings.email_form_address');
                    $this->Email->to =
'[email protected]';
                    $this->Email->subject = 'Contact from message from
' . $this->data['Contact']['name'];
                    $this->Email->from = $this->data['Contact']
['email'];

                    $this->Email->send($this->data['Contact']
['comments']);
                }
            } else {
                $this->Session->setFlash(__('Please enter the correct
answer to the math question.', true));
            }
        }

        $this->set('mathCaptcha', $this->MathCaptcha-
>generateEquation());
    }
}
?>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to