All pastes #636718 Raw Edit

Someone

public text v1 · immutable
#636718 ·published 2007-07-28 04:11 UTC
rendered paste body
Here is all the files I thought were relevant: 


###########################
### app/models/user.php ###
###########################
<?php 
	class User extends AppModel
	{
	    var $name = 'User';
        
        var $validate = array(
            'username' => VALID_NOT_EMPTY,
            'password' => VALID_NOT_EMPTY,
            'email' => VALID_EMAIL
        );
	}
?>


###########################################
### app/controllers/user_controller.php ###
###########################################
<?php 
	class UsersController extends AppController
	{
	    function register()
	    {
	        if (!empty($this->data))
            {
	        	if ($this->User->validates($this->data))
                {
	        		$this->User->save($this->data);
                    $this->flash('Registration accepted<br />Please click here to continue.', '/users/knownusers');
	        	}
                else 
                {
                    $this->validateErrors($this->User); 
                }
	        }
	    }
        
        function knownusers()
        {
            $this->set('knownusers', 
                $this->User->findAll(null, array('id', 'username', 'first_name', 'last_name', 'email'), 'id DESC')
            );
        }
	}
	
?>
################################
### app/views/register.thtml ###
################################

<?php echo $html->formTag('/users/register') ?>
<p>please fill out the form below to create an account</p>
<label>Username:</label>
<?php echo $html->inputTag('User/username', array('size' => '40')) ?>
<?php $html->tagErrorMsg('User/username', 'Username is required') ?>

<label>Password:</label>
<?php echo $html->inputTag('User/password', array('size' => '40')) ?>
<?php $html->tagErrorMsg('User/password', 'Password required.') ?>

<label>Email address</label>
<?php echo $html->inputTag('User/email', array('size' => '40', 'maxlength' => '255')) ?>
<?php $html->tagErrorMsg('User/email', 'Invalid email address, or too long >255 characters') ?>

<label>First Name:</label>
<?php echo $html->inputTag('User/first_name', array('size' => '40')) ?>
<?php $html->tagErrorMsg('User/first_name', 'First Name required') ?>

<label>Last Name:</label>
<?php echo $html->inputTag('User/last_name', array('size' => '40')) ?>
<?php $html->tagErrorMsg('User/last_name', 'Last Name required') ?>


<?php echo $html->submitTag('register') ?>
</form>