簡體   English   中英

插入功能忘記密碼Codeigniter

[英]insert a function forgot password Codeigniter

我需要幫助才能在以下網站中插入鏈接描述,此處是Codeigniter中的一個忘記函數。 我嘗試自我,但找不到頁面。 表單html:

<div class="callout-copy">
  <h1>Welcome To Kea Talks.</h1>
  <p>Kea talks helps you to connect and share with the people in your Kea life.</p>
  <img class="logo" src="<?php echo base_url();?>assets/css/images/logo1.png" alt="logo">
</div>
</div>
<div class="front-signin js-front-signin">
<form action="<?php echo base_url();?>index.php/user/signin" class="signin" method="post"  id="signin">
<div class="username">
  <input type="text" id="signin-email" required class="text-input email-input" name="email" autocomplete="on" placeholder="Email">
  </div>
 <table class="flex-table password-signin">
  <tbody>
  <tr>
    <td class="flex-table-primary">
      <div class="password flex-table-form">
        <input type="password" id="signin-password" required class="text-input flex-table-input" name="password" placeholder="Password">
      </div>
    </td>

    <td class="flex-table-secondary">
      <button type="submit" class="submit btn primary-btn flex-table-btn js-submit">
        Sign in
      </button>
    </td>
    </tr>
    </tbody>
    </table>
    <div class="remember-forgot">
    <span class="separator">·</span>
    <a class="forgot" href="<?php echo base_url();?>index.php/user/resend_password.php">Forgot  password?</a>
    </div>
    </form>

模型中的功能:

class user_model extends CI_Model{
function __construct(){
    parent::__construct();
}

function validate($email , $password){
    $this->db->where('email',$email);
    $this->db->where('password',$password);
    $query=$this->db->get('user');
    if($query->num_rows==1){
        $row = $query->row();
        $data = array(
                'userid' => $row->userid,
                'fullname'=> $row->fullname,
                'profilepic'=> $row->profilepic,
                'validated' => true
                );
        $this->session->set_userdata($data);




        return "1";
    }
    return "0";



}

控制器:

class user extends CI_Controller{
    function __construct(){
    parent::__construct();
    $this->load->helper('url');

}
public function index(){
if(!$this->session->userdata('userid')){    
$this->load->view('user/login');
$this->load->view('header');
} 
else{

redirect('index.php/user/profile','refresh');
 }
 }

2sd部分:

public function login(){
$name=$this->security->xss_clean($this->input->post('username'));
$pass=$this->security->xss_clean($this->input->post('password'));
$this->load->model('user_model');
$status=$this->user_model->validate($name,$pass);
    echo $status;
    }
    function logout(){


$this->session->sess_destroy();
    redirect('index.php/user','refresh');

      }

首先,將錨替換為忘記密碼:

<a class="forgot" href="<?php echo base_url();?>index.php/user/resend_password">Forgot  password?</a>   

然后在用戶類中定義一個名稱為resend_password的函數:

 public function resend_password(){
   #your code here..
 }
<a class="forgot" href="<?php echo site_url('user/resend_password/')?>Forgot  password?</a>

然后在控制器用戶中編寫一個函數resend_password

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM