[eluser]bhakti.thakkar[/eluser]
Dear all,
I am creating change password functionality in a lightbox. the only thing now that is left is intimating the user where his/her password is changed or not. i am not able to persist that lightbox after submit and flash the relative message to the user
how can i do it and from where?
VIEW:
Code:
<?php
$attributes = array('id' => 'mainform' , 'name' => 'mainform');
echo form_open('password/pass_change_conf' , $attributes);
?>
<!--form name ='mainform' id ='mainform' action='pass_change_conf' method='post'-->
<input type="hidden" name="Registration_ID" id="Registration_ID" value="<?=$_SESSION['sregistration_id']?>" />
<input type="hidden" name="Username_VC" id="Username_VC" value="<?=$_SESSION['suname']?>" />
<table width='80%' border='0' class="table" cellpadding=2 cellspacing=2>
<tr>
<td colspan='2' class="headertd">
<h3>Change password<h3>
</td>
</tr>
<TR>
<TD class="tdheader" width="30%">Old password</TD>
<TD class="datatd">
<input type="password" name="old_password" id="old_password" value="" class="txtbox" />
</td>
</tr>
<TR>
<TD class="tdheader">New password</TD>
<TD class="datatd"><input type="password" name="new_password" id="new_password" value="" class="txtbox" /></td>
</tr>
<TR>
<TD class="tdheader">Confirm password</TD>
<TD class="datatd"><input type="password" name="conf_password" id="conf_password" value="" class="txtbox" /> </td>
</tr>
<TR>
<TD colspan='2'>
<input type="submit" name="save" value="Save" style="cursor:hand">
<input type="button" value="Cancel" style="cursor:hand" name="Cancel">
</td>
</tr>
</table>
</form>
CONTROLLER: password.php
Code:
<?php
class Password extends Controller {
function __construct()
{
parent::Controller();
if (!$this->site_sentry->is_logged_in()) {redirect('login');}
}
// --------------------------------------------------------------------
function index()
{
$data['page_title'] = $this->lang->line('change_password');
}
// --------------------------------------------------------------------
function change_password()
{
//$data['extraHeadContent'] = "[removed][removed]\n";
$data['page_title'] = $this->lang->line('change_password');
$this->load->view('password/change_password', $data);
}
// --------------------------------------------------------------------
function pass_change_conf(){
$Username_VC = $this->input->post('Username_VC');
$Registration_ID = $this->input->post('Registration_ID');
$old_password = $this->input->post('old_password');
$new_password = $this->input->post('new_password');
$this->load->model('password_model');
$data = $this->password_model->user_pass_change($Username_VC , $Registration_ID , $old_password, $new_password);
if($data == true){
$this->session->set_flashdata('message', '<p>Your password has change, you need to logout & again login to activate your new password</p>');
$this->session->destroy();
redirect('logout');
//echo "pass change";
}else{
$data['message'] = "<p>Old password does not matched</p>";
$this->session->set_flashdata('message', '<p>Old password does not matched</p>');
//echo "pass not change";
}
}
}
?>