What errors are you getting?
Jeremy Burns
[email protected]
On 8 Jun 2010, at 07:28, Narendra Padala wrote:
> Hi am new to cakephp, i am using postgress sql database this is an existing
> database here i am not having permissions to change any thing in database.
> but i have to wrote user authentication using app_controller.php
> so tried to wrote code like this but it was not working properly please any
> one can help me out to solve this problem.
>
>
> ---------------------
> Database table:
> ---------------------
> table name: tbluser
> ---------------------
>
>
> Column | Type |
> Modifiers
> ----------------+------------------------+---------------------------------------------------------------------
> lnguser | integer | not null default
> nextval(('"tbluser_lnguser_seq"'::text)::regclass)
> strfname | character varying(100) | not null
> strlname | character varying(100) | not null
> struid | character varying(100) | not null
> strpid | character varying(100) | not null
> lnguser_group | integer | not null
> strtelarea | character varying(20) |
> strtelno | character varying(20) |
> stremail | character varying(100) |
> struserconfirm | character varying(100) |
> dtmregistered | date |
> dtmapproved | date |
> blnchatuser | bit(1) |
> Indexes:
> "tbluser_pkey" PRIMARY KEY, btree (lnguser)
>
>
> --------------------
> Model : tbluser.php
> --------------------
> <?php
>
> class Tbluser extends AppModel {
>
> var $useTable = 'tbluser';
> }
> ?>
>
>
>
> -------------------------------------
> Controller : tblusers_controller.php
> -------------------------------------
> <?php
>
> class TblusersController extends AppController {
>
> var $name = "Tblusers";
>
> var $uses = array('Tbluser');
>
> var $helpers = array('Html', 'Form');
>
> function login() {
>
> }
>
> function index() {
>
> }
> function logout() {
>
> $this->Session->setFlash('Successfully logout');
>
> $this->redirect($this->Auth->logout());
> }
>
>
> }
>
> ?>
>
>
> -----------------------
> Login page : login.ctp
> -----------------------
>
> <?php
> if ($session->check('Message.auth')) {
> $session->flash('auth');
> }
> if ($form->isFieldError('User.username')) {
> e($form->error ('User.username', null));
> }
> ?>
>
> <!-- login form start -->
> <table width="80%" cellpadding="0" cellspacing="0" border="0">
> <?php e($form->create('Tbluser',array('action' => 'login'))); ?>
> <tr>
> <td width="10%"> </td>
> <td width="20%"> Username </td>
> <td width="20%"> <?php e($form->text('struid')); ?> </td>
> <td width="30%"> </td>
>
> </tr>
> <tr>
> <td width="10%"> </td>
> <td width="20%"> Password </td>
> <td width="20%"> <?php e($form->password('strpid')); ?> </td>
> <td width="30%"> </td>
>
> </tr>
> <tr>
> <td width="10%"> </td>
> <td width="20%"> </td>
> <td width="20%"><?php e($form->submit('Login')); ?></td>
> <td width="30%"> </td>
> </tr>
> <?php e($form->end()); ?>
> </table>
> <!-- login form end -->
>
>
>
> -----------------------
> index page : login.ctp
> -----------------------
> <?php
> echo "Welcome cakephp world ...!";
> ?>
>
>
>
>
> ------------------------------------
> App Controller : app_controller.php
> ------------------------------------
>
> <?php
>
> class AppController extends Controller {
> {
> var $components = array('Auth', 'RequestHandler');
>
> var $uses = array ('Tbluser') ;
>
> var $helpers = array('Javascript','Html','Form','Ajax');
>
> function beforeFilter(){
>
> $this->Auth->allow('adduser');
>
> $struid = $this->Auth->user('struid');
>
> $id = $this->Auth->user('lnguser');
>
> $this -> Session -> write('struid', $struid);
>
> $this -> Session -> write('id', $id);
>
> $this->set('struid', $this->Auth->user('struid'));
>
> $this->set('userId', $this->Auth->user('lnguser'));
>
> $this->Auth->loginRedirect = array('controller' => 'tblusers',
> 'action' => 'index');
>
> }
>
> function isAuthorized() {
>
> return true;
>
> }
>
> }
>
> ?>
> --------------------------------
>
> please any one can help me out...here i attached the copy code as text file.
>
>
>
> 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
> <user_auth.php>
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