php - insert a function forgot password Codeigniter
425
I need help to insert in the following site enter link description here a forgot function in Codeigniter. I try my self but give page not found. The form html:
<div >
<h1>Welcome To Kea Talks.</h1>
<p>Kea talks helps you to connect and share with the people in your Kea life.</p>
<img src="<?php echo base_url();?>assets/css/images/logo1.png" alt="logo">
</div>
</div>
<div >
<form action="<?php echo base_url();?>index.php/user/signin" method="post" id="signin">
<div >
<input type="text" id="signin-email" required name="email" autocomplete="on" placeholder="Email">
</div>
<table >
<tbody>
<tr>
<td >
<div >
<input type="password" id="signin-password" required name="password" placeholder="Password">
</div>
</td>
<td >
<button type="submit" >
Sign in
</button>
</td>
</tr>
</tbody>
</table>
<div >
<span >ยท</span>
<a href="<?php echo base_url();?>index.php/user/resend_password.php">Forgot password?</a>
</div>
</form>
The function in models:
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";
}
Controller:
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 Part:
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');
}
Answer
Solution:
first of all replace your anchor to forgot password with this:
Then define a function with name resend_password inside user class:
Answer
Solution:
And you write a function resend_password in controller user