1
I have been on this login part of my program for a while but i have just been failing..I am just so tired of this thing...Please how do you do login controller and view for cakephp?...I have tried and tried but it still doesnt work...please HELP!!!
這是我的登錄view.ctp登錄控制器和視圖
<html>
<body background="bgimage.jpg">
<center>
<strong><h2>LOGIN FORM</h2><strong>
<?php
echo $this->form->create('Login', array('action' => 'login'));
echo $this->form->input('Username'); ?> <br>
<?php echo $this->form->input('Password'); ?> <br>
<?php echo $this->form->end('Login');
?>
<br><br>
<?php echo $this->html->link ('Forgot Password?',array('action'=>'forgot')); ?>
</center>
<p><?php echo $this->html->link ('Create Account', array('action' =>'add')); ?></p>
</body>
</html>
這isthe在我的控制器代碼登錄功能:
function login() {
$this->loadModel('User');
$this->request->data['MyModel']['username'];
$this->request->data['MyModel']['title'];
$this->redirect(array('action' => 'home'));
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl('home'));
// `return $this->redirect($this->Auth->redirect());`
} else {
$this->Session->setFlash(
__('Username or password is incorrect'),
'default',
array(),
'auth'
);
}
}
請,我是不是做錯了什麼? 請您如何做cakephp的登錄控制器和視圖?
什麼是您的控制器名稱或您將哪個控制器放入了登錄功能? –
我正在使用「UsersController」 –