<?phpif(!defined('BASEPATH'))exit('Nodirectscriptaccessallowed');
classPageextendsCI_Controller
{
publicfunction__construct()
{
parent::__construct();
$this->load->model('pp');
$this->pp->unset_authorization();
}
publicfunctionpassword_recovery_login_and_email()
{
$data['notice']=$this->session->userdata('notice')?$this->session->userdata('notice'):'';
$data['error']='';
if($this->app->is_user()===FALSE)
{
$data['login']=array('name'=>'login','value'=>$this->input->post('login')?$this->func->string($this->input->post('login')):'');
$data['email']=array('name'=>'email','value'=>$this->input->post('email')?$this->func->string($this->input->post('email')):'');
$data['captcha']=array('name'=>'captcha','value'=>$this->input->post('captcha')?$this->func->string($this->input->post('captcha')):'');
$vals=array('word'=>random_string('numeric',5),'img_path'=>'./captcha/','img_url'=>base_url().'captcha/','font_path'=>'./system/fonts/texb.ttf','img_width'=>'100','img_height'=>'30','expiration'=>'600');
$data['code']=create_captcha($vals);
if($this->input->post('submit'))
{
$login=$this->func->string($this->input->post('login'));
$login=trim($login);
$email=$this->func->string($this->input->post('email'));
$email=trim($email);
$code=$this->func->string($this->input->post('captcha'));
$code=trim($code);
//Проверкалогина
if($this->func->alpha_dash($login)===FALSE)
$data['error'][]='Неверныйлогин';
//ПроверкаE-mail
if($this->func->valid_email($email)===FALSE)
$data['error'][]='Некорректныйадресэлектроннойпочты';
//Проверкакодаскартинки
if($code!=abs(intval(trim($this->session->userdata('word')))))
{
$this->session->unset_userdata('word');
$data['error'][]='Неверновведенкодскартинки';
}
if(empty($data['error']))
{
//Находимсовпадения
if($this->user->check_login($login)===TRUE&&$this->user->check_email($email)===TRUE)
{
//Новыйпароль
$password=random_string('nozero',12);