06.28 php saved
XantoM
Tags add more
 
Note
XantoM did not leave a note
  1. <?php
  2.  
  3. // User Model
  4.  
  5. class User extends AppModel
  6. {
  7.     public $name = 'User';
  8.    
  9.     public $validate = array(
  10.         'username' => array('rule' => 'alphaNumeric', 'allowEmpty'=>false),
  11.         'password' => array('rule' => 'alphaNumeric', 'allowEmpty'=>false),
  12.         'email' => array('rule' => 'email', 'allowEmpty'=>false)
  13.         );
  14. }
  15.  
  16. // Register function within User Controller
  17.  
  18.     function register()
  19.     {
  20.         if (!empty($this->data))
  21.         {
  22.             $this->User->set($this->data);
  23.             if ($this->User->save($this->data))
  24.             {
  25.                 $this->Session->setFlash('Your registration information was accepted.');
  26.             }
  27.         }  
  28.     }
  29.  
  30. // Register view
  31.  
  32. echo $form->create('User', array('action' => 'register'));
  33. <div>
  34. echo $form->input('User.first_name');
  35. echo $form->input('User.last_name');
  36. echo $form->input('User.username');
  37. echo $form->input('User.email');
  38. echo $form->input('User.password');
  39. </div>
  40. echo $form->end('Register');
  41.  
  42.  
  43.  
  44. ?>
Parsed in 0.093 seconds, using GeSHi 1.0.7.14

Modify this Paste