Hi,
I have a CakePHP application that allows a user to register and post projects. At some point whilst I have been tinkering with it I have managed to change the way the current date is captured when the user record is created :( when a new user account is created the date is defaulted to
Jan 19th 1970, 01:00
Here is my register action in the users controller:
function register()
{
if ( !empty( $this->data ) ){
if ( $this->data['User']['password']
== $this->Auth->password( $this->data['User']['password_confirm'])) {
$this->User->create();
if ( $this->User->save($this->data) ){
$this->redirect(array('action' => 'index'));
}
} else {
$this->Session->setFlash('password mismatch');
}
}
}
Register view:
<?php
$currentdatetime = time();
echo $form->create( 'User', array('action' => 'register' ) );
echo $form->input('username', array( 'label' => 'Username' ) );
echo $form->input('fname', array( 'label' => 'First name' ) );
echo $form->input('lname', array( 'label' => 'Last name' ) );
echo $form->input('emailaddress', array( 'label' => 'Email Address') );
echo $form->input('website', array( 'label' => 'Website') );
echo $form->hidden( 'created', array( 'value' => $currentdatetime ) );
echo $form->input('password', array( 'label' => 'Password', 'type' => 'password') );
echo $form->input('password_confirm', array( 'label' => 'Retype Password', 'type' => 'password' ) );
echo $form->submit();
echo $form->end();
?>
I have a users table with a created DATETIME column. Not NULL, default '0000-00-00'
Can someone help me out here? I'm thinking I've maybe just deleted a line of cod or something
Thanks,
Jonesy