Hola, que tal?
necesito de ayuda de alguien que pueda ayudarme con este error....
mi vista es :
<div id="login_form">
<?php if ( !empty( $error ) ) { ?>
<div class="message_error">
<span><?php e( $error ); ?></span>
</div>
<?php } ?>
<?php echo $form->create('Ingreso',array('action'=>'index')); ?
> // <-- error
<table>
<tr>
<th>Usuario:</th>
<td><?php e($form->text('usu_username')) ?></td>
</tr>
<tr>
<th>Contraseña:</th>
<td><?php e($form->text('usu_password',
array('type' =>
'password'))) ?></td>
</tr>
<tr>
<th> </th>
<td><?php echo $form->submit('Ingresar',
array('id' =>
'submit_login')); ?></td>
</tr>
<tr>
<th> </th>
<td><?php echo $html->link('¿Ha olvidado su
contraseña?', '/
Usuarios/reestableceContrasena/'); ?></td>
</tr>
</table>
<?php echo $form->end(); ?>
</div>
-- controller
<?php
class IngresosController extends AppController {
var $name = 'Ingresos';
var $uses = array ( 'Usuario') ;//usaremos solo el modelo
usuario
var $helpers = array ( 'Html','Form') ;
function index ( )
{
$this->layout = 'inicio_layout'; //layout por hacer...
if ( !empty ( $this->data ) )
{
//aqui se reciben los datos de la vista
$user = $this->data['Ingreso']['usu_username'];
$pass = sha1 ( $this->data['Ingreso']['usu_password'] ) ;
$usuario = $this->Usuario->find ( 'first', array
( 'conditions'=>array ( 'usu_username'=>$user,'usu_password'=>
$pass ) ) ) ;
// si existe el usuario y contraseña, se crea la session
de el y se redirije al sistema q deberia llamarse inicio/inicio
if ( !empty ( $usuario ) )
{
//escribe la session del usuario
$this->Session->write ( 'usuario',$usuario['Usuario'] )
;
$this->redirect ( array ( 'controller' =>
'Inicio','action'
=> 'Inicio' ) ) ;
}//sino da mensaje de error
else
$this->set ( 'error', 'Nombre de usuario y/o
contraseña incorrecto.' ) ;
}
}
function logout ( )
{
// destruye la sesiones activas
$this->Session->del ( 'usuario' ) ;
//por si acaso mata todas las sessiones
$this->Session->destroy ( ) ;
//redirecciona a la pagina de ingreso, para volver a ingresar.
$this->redirect ( array ( 'controller' => 'Ingresos','action'
=> 'Index' ) ) ;
}
}
?>
Por favor ayuda.... !!.....
Gracias..
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php