Model:
class Registration extends AppModel {
        var $name = 'Registration';
        var $validate = array(
                'name'  => array(
                                                 'rule' => array('minLength', 
5),
                                                'required' => true,
                                                 'message' => 'Please enter 
your full name<br/>'
                                         ),
                 'email' => array(
                                                'rule' => array('email'),
                                                 'message' => 'Please supply a 
valid email address.'
                                        ),
                'password' => array(
                                                 'rule' =>array('minLength', 5),
                                                'required' => true,
                                                 'message' => 'Your password 
must be longer than 5 characters'
                                        ),
                 'tel' => array(
                                                 'rule' => array('phone', 
"/((\+44\s?\(0\)\s?\d{2,4})|(\+44\s?
(01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s?
\d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.)
(((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))/", null),
                                                'required' => true,
                                                 'message' => 'Please enter a 
correct UK number'
                                         ),
                 'mobile' => array(
                                                 'rule' => array('phone', 
"/((\+44\s?\(0\)\s?\d{2,4})|(\+44\s?
(01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s?
\d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.)
(((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))/", null),
                                                 'message' => 'Please enter a 
correct UK mobile number'
                                         ),
                        'add1' => array(
                                                 'rule' =>array('minLength', 5),
                                                'required' => true,
                                                 'message' => 'You must enter 
the first line of your address'
                                        ),
                        'postcode' => array(
                         'rule' =>array('minLength', 3),
                        'required' => true,
                         'message' => 'You must enter your postcode'
                                ),


                 );
 }
controller:
App::import('Sanitize');
class RegistrationsController extends AppController {
        var $name = 'Registrations';
        var $helpers =  array('Form');
        var $components = array('Email');
function signup() {
         $this->pageTitle = 'Find Work Abroad:Sign up for free online today -
Guaranteed work TEFL Teaching english in southern China, Guaranteed
job and placement, EFL, ESL Teach English in China';
                $validates = true;
                $saved = true;
                $alldone = false;
                $message = "";
                         if(isset($_GET['year'])) {
                                 $this->set('year', 
Sanitize::paranoid($_GET['year']));
                        } else if(isset($_POST['signupYear'])) {
                                $this->set('year', 
Sanitize::paranoid($_POST['signupYear']));
                        } else {
                                $this->set('year','2010');
                        }

                        if(isset($this->data['Registration']['name'])) {
                                $this->set("registration", $this->data);
                           $this->Registration->set($this->data);
                                
if($this->data['Registration']['password']!=$this-
>data['Registration']['password2']) {
                                                
$this->Registration->invalidate('password2', 'Your passwords
must match');
                                }
                                 if ($this->Registration->validates()) {
                                 //check we dont have that email already
                                if(($this->Registration->find('count', 
array('conditions' =>
array('Registration.email' => $this->data['Registration']
['email']))))==0)                                                               
                                {
                                                
$this->data['Registration']['address'] = $this-
>data['Registration']['add1']."  ".$this->data['Registration']
['add2'];
                                                
$this->data['Registration']['password'] = md5($this-
>data['Registration']['password']);
                                                
$this->data['Registration']['signupdate'] = date('l jS \of F Y
h:i:s A');
                                                 if 
($this->Registration->saveAll(Sanitize::clean($this->data),
array('validate' => false))) {
                                                
$this->sendEmail("[email protected]","new FWA Account","New
account created on FWA, name:".$this->data['Registration']['name']."
email:".$this->data['Registration']['email']."  tel:".$this-
>data['Registration']['tel']);
                                                                //login
                                                                
$this->set('loggedin', $this->login(Sanitize::clean($this-
>data['Registration']['email']),Sanitize::clean($this-
>data['Registration']['password'])));
                                                                $alldone = true;
                                                                
//$this->redirect('/my-account');
                                                   } else {
                                                                        $saved 
= false;
                                                                        
$message = "There was a problem when saving your details
to the database, Please try again";
                                                   }

                                        } else {
                                                $saved = false;
                                                $message = "We already have 
your email address on our system,
please login with your account or create a new one with a different
email address";
                                        }
                                 } else {
                                        $validates = false;
                                        
//pr($this->Registration->invalidFields());
                                        
$this->set('invalidFields',$this->Registration->invalidFields());
                                 }
                        }
                        $this->set('validates', $validates);
                        $this->set('saved', $saved);
                        $this->set('alldone', $alldone);
                        $this->set('message',$message);
                }
}
On Feb 18, 4:41 am, Jamal Aziz <[email protected]> wrote:
> Can you post your model and your controller action?
>
> On Feb 18, 3:43 am, Atti <[email protected]> wrote:
>
> > Hi all,
> > Just a quick question, I managed to get my data validation working
> > perfectly on my local apache (XAMPP) web server, but as soon as I
> > uploaded the site to the internet the validation flag seems to be
> > always true, ie, there is not validation going on, so it seems. What
> > settings on my live server would allow this to happen, the page im
> > talking about is:http://www.findworkabroad.com/signup
>
> > any help grately appreciated
>
> > Thanks
> > Atti

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