Location: PHPKode > projects > OSShare > osshare-project-v1.0.1/app/models/user.php
<?php
/*
OsShare v1 , 
Coded By Paimpozhil B. , SaravanaKumar M.S.
*/
class User extends AppModel {

	var $name = 'User';

	var $validate = array(

		'id' => VALID_NUMBER,

		'username' =>  array('rule' => array('alphaNumeric')),

		'password' => VALID_NOT_EMPTY,

		'email' => VALID_EMAIL,

		'dob' => VALID_NOT_EMPTY,

		'gender' => VALID_NOT_EMPTY,

		'doj' => VALID_NOT_EMPTY,

		'question' => VALID_NOT_EMPTY,

		'answer' => VALID_NOT_EMPTY,

		'status' => VALID_NOT_EMPTY,

		'privilege' => VALID_NOT_EMPTY,

	);

	var $hasMany = array(

			'Favorite' => array('className' => 'Favorite',

								'foreignKey' => 'user_id'

								),

			'Video' => array('className' => 'Video',

								'foreignKey' => 'user_id'

								),

							

			'Message' => array('className' => 'Message',

								'foreignKey' => 'user_id',

								'conditions' => '',

								'fields' => '',

								'order' => '',

								'dependent'    =>  true,

								'counterCache' => ''),

								

			'Pl' => array('className' => 'Pl',

								'foreignKey' => 'user_id',

								'conditions' => '',

								'fields' => '',

								'order' => '',

								'dependent'    =>  true,

								'counterCache' => ''),

			'Alb'=> array('className' => 'Alb',

								'foreignKey' => 'user_id',

								'conditions' => '',

								'fields' => '',

								'order' => '',

								'dependent'    =>  true,

								'counterCache' => '')

	);

								

	var $hasOne = array(

			'Profile' => array('className' => 'Profile',

								'foreignKey' => 'user_id',

								 'dependent'    =>  true,

								));

	

	function validateLogin($data)

    {

	

        $user = $this->find(array('username' => $data['username'], 'password' => $data['password']), array('id', 'username','privilege'));

        if(empty($user) == false)
            return $user['User'];

        return false;

    } 



}

?>
Return current item: OSShare