Re: Problem with Login Redirect

2010-07-28 Thread Avishek Kumar Singh
hi frnds ,
i m new in cakephp.
can anyone tell me where is log file of cake php and how can we insert some
value in logfile.

waiting for response.

With Best Regards,

AviSingh RAJPUT

Web Designer  Developer
http://mantralabsglobal.com/

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Problem with Login Redirect

2010-07-27 Thread sebas46825
hello, i have a problem with the login redirect i dont no why but when
i write the loginRedirect it not redirect me, just show me the login
page and i want to redirect to another page. i manually inserted the
username and pasword in the database. any help would be great, thanks

NOTE: if some see Productos is in spanish.

my code

app_controller
_
?php
class ProductosController extends AppController {

var $name = 'Productos';
var $helpers = array('Html', 'Form');
var $components = array('Auth');


function index() {
$this-set('productos', $this-paginate());
}

function view($id = null) {
if (!$id) {
$this-Session-setFlash(__('No hay productos 
agregados.', true));
$this-redirect(array('action'='index'));
}
$this-set('producto', $this-Producto-read(null, $id));
}

function add() {
if (!empty($this-data)) {
$this-Producto-create();
if ($this-Producto-save($this-data)) {
$this-Session-setFlash(__('El producto ha 
sido agregado',
true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('El producto no ha 
sido agregado,
intentelo de nuevo.', true));
}
}
}

function edit($id = null) {
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('No hay productos 
agregados', true));
$this-redirect(array('action'='index'));
}
if (!empty($this-data)) {
if ($this-Producto-save($this-data)) {
$this-Session-setFlash(__('El producto ha 
sido editado', true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('El producto no ha 
sido editado,
intentelo de nuevo.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Producto-read(null, $id);
}
}

function delete($id = null) {
if (!$id) {
$this-Session-setFlash(__('Error en la identificacion 
del
Producto', true));
$this-redirect(array('action'='index'));
}
if ($this-Producto-del($id)) {
$this-Session-setFlash(__('Producto eliminado', 
true));
$this-redirect(array('action'='index'));
}
$this-redirect(array('action'='index'));
}

function beforeFilter() {
$this-Auth-userModel = 'User';
$this-Auth-fields = array('username' = 'username', 
'password' =
'password');
$this-Auth-loginAction = array('admin' = false, 'controller' 
=
'users', 'action' = 'login');
$this-Auth-loginRedirect = array('controller' = 'users', 
'action'
= 'index');
$this-loginError = 'Username o Password incorrectos';
 }
}
?


users_controller
_

?php
class UsersController extends AppController
{
var $name = Users;
var $helpers = array('Html', 'Form');


function index() {

}

function login()
{

}


function logout()
{
$this-redirect($this-Auth-logout());
}
}
?

user model


?php
  class User extends AppModel {
var $name = 'User';

  }
?


login form (login.ctp)


div class=login form
?php
if  ($session-check('Message.auth')) $session-flash('auth');

echo $form-create('Users', array('action' = 'login'));?
legend?php __('Ingresar');?/legend
?php
echo $form-input('username');
echo $form-input('password');
echo $form-end('Entrar');
?
/div



my app directory is

app/
  config/
  controllers/
   productos_controller
   users_controller
   .
   models/
  producto
  user
   views/
 productos/  in this directory i have index page, this is
the page that i want to REDIRECT
 users/ --- in this directory i have the login page
 ...

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake

Re: Problem with Login Redirect

2010-07-27 Thread Shaz
Where does loginRedirect redirect you at the moment? Or no redirects
at all?

On Jul 27, 6:16 am, sebas46825 sebas46...@gmail.com wrote:
 hello, i have a problem with the login redirect i dont no why but when
 i write the loginRedirect it not redirect me, just show me the login
 page and i want to redirect to another page. i manually inserted the
 username and pasword in the database. any help would be great, thanks

 NOTE: if some see Productos is in spanish.

 my code

 app_controller
 _
 ?php
 class ProductosController extends AppController {

         var $name = 'Productos';
         var $helpers = array('Html', 'Form');
         var $components = array('Auth');

         function index() {
                 $this-set('productos', $this-paginate());
         }

         function view($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('No hay productos 
 agregados.', true));
                         $this-redirect(array('action'='index'));
                 }
                 $this-set('producto', $this-Producto-read(null, $id));
         }

         function add() {
                 if (!empty($this-data)) {
                         $this-Producto-create();
                         if ($this-Producto-save($this-data)) {
                                 $this-Session-setFlash(__('El producto ha 
 sido agregado',
 true));
                                 $this-redirect(array('action'='index'));
                         } else {
                                 $this-Session-setFlash(__('El producto no 
 ha sido agregado,
 intentelo de nuevo.', true));
                         }
                 }
         }

         function edit($id = null) {
                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('No hay productos 
 agregados', true));
                         $this-redirect(array('action'='index'));
                 }
                 if (!empty($this-data)) {
                         if ($this-Producto-save($this-data)) {
                                 $this-Session-setFlash(__('El producto ha 
 sido editado', true));
                                 $this-redirect(array('action'='index'));
                         } else {
                                 $this-Session-setFlash(__('El producto no 
 ha sido editado,
 intentelo de nuevo.', true));
                         }
                 }
                 if (empty($this-data)) {
                         $this-data = $this-Producto-read(null, $id);
                 }
         }

         function delete($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('Error en la 
 identificacion del
 Producto', true));
                         $this-redirect(array('action'='index'));
                 }
                 if ($this-Producto-del($id)) {
                         $this-Session-setFlash(__('Producto eliminado', 
 true));
                         $this-redirect(array('action'='index'));
                 }
                 $this-redirect(array('action'='index'));
         }

         function beforeFilter() {
                 $this-Auth-userModel = 'User';
                 $this-Auth-fields = array('username' = 'username', 
 'password' =
 'password');
                 $this-Auth-loginAction = array('admin' = false, 
 'controller' =
 'users', 'action' = 'login');
                 $this-Auth-loginRedirect = array('controller' = 'users', 
 'action'
 = 'index');
                 $this-loginError = 'Username o Password incorrectos';
          }}

 ?

 users_controller
 _

 ?php
 class UsersController extends AppController
 {
     var $name = Users;
     var $helpers = array('Html', 'Form');

     function index() {

     }

     function login()
     {

     }

     function logout()
     {
         $this-redirect($this-Auth-logout());
     }}

 ?

 user model
 

 ?php
   class User extends AppModel {
                 var $name = 'User';

   }
 ?

 login form (login.ctp)
 

 div class=login form
 ?php
     if  ($session-check('Message.auth')) $session-flash('auth');

         echo $form-create('Users', array('action' = 'login'));?
         legend?php __('Ingresar');?/legend
         ?php
                 echo $form-input('username');
                 echo $form-input('password');
                 echo $form-end('Entrar');
         ?
 /div

 my app directory is

 app/
   config/
   controllers/
        productos_controller
        users_controller
    .
    models/
       producto
       user
    views/
      productos/  in this directory i have index page, this is
 the page that i want to REDIRECT
      users/ --- in this directory i have the login page
      ...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you