Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.43 KB | None | 0 0
  1.     public function step2()
  2.     {
  3.         if($this->session->userdata('type') != 1){
  4.                 redirect('Devolucion/index');
  5.         }
  6.         if($this->session->userdata('step2') ===true){
  7.                 redirect('Devolucion/step3');
  8.         }
  9.        
  10.         echo 'esto es= '.$this->session->userdata('server');
  11.         $data['error'] = '';
  12.         $this->form_validation->set_rules('usuario_old','usuario_old','required|max_length[12]|alpha_numeric');
  13.         $this->form_validation->set_rules('password_old','password_old','required|max_length[12]|alpha_numeric');
  14.         $this->form_validation->set_rules('email_old','email_old','required|max_length[50]|valid_email');
  15.         $this->form_validation->set_rules('character','character','required|max_length[12]|alpha_numeric');
  16.  
  17.         if($this->form_validation->run() === true){
  18.         // guardamos el servidor antes de comenzar las validaciones de datos para poder designar a cual base de datos nos conectaremos en el modelo de datos.  
  19.         $_SESSION['server'] = (int) $this->server; 
  20.  
  21.             if($this->input->post('accion') === 'step2'){
  22.  
  23.                 if($this->Devolucion_model->valDatos($this->user_old,$this->pass_old,$this->email_old)){
  24.                     if($this->checKExistsChar($this->user_old,$this->char_old)=== true){
  25.  
  26.                         $rows =$this->Devolucion_model->getMailValidate($this->user_old,'2');
  27.                         if($rows['mail_validate'] == '1' && $rows['mail_validate']!= null ){
  28.                             $_SESSION['step2'] = (bool) true;
  29.                             $_SESSION['emailOld'] = (string) $this->email_old;
  30.                             $_SESSION['userOld'] = (string) $this->user_old;
  31.                             $_SESSION['server'] = (int) $this->server;
  32.                            
  33.                             redirect('devolucion/step4');
  34.                         }else{
  35.                             $key = strtoupper(bin2hex($this->encryption->create_key(20)));
  36.                             // insertamos nueva key
  37.                             $this->Devolucion_model->updateKey($this->user_old,$key);
  38.  
  39.                             // notificamos y enviamos key al email
  40.                             $this->notificar($this->user_old,$this->email_old,$key);
  41.  
  42.                             $_SESSION['step2'] = (bool) true;
  43.                             $_SESSION['emailOld'] = (string) $this->email_old;
  44.                             $_SESSION['userOld'] = (string) $this->user_old;
  45.                             $_SESSION['server'] = (int) $this->server;
  46.  
  47.                             //redireccionamos step 3
  48.                             redirect('Devolucion/step3');
  49.  
  50.                         }
  51.  
  52.                     }else{
  53.                         $data['error'] = 'Personaje Inexistente';  
  54.                     }
  55.                 }else{
  56.                     $data['error'] = 'Usuario,contraseña o correo incorrectos';
  57.                     //$this->load->view()
  58.                 }
  59.             }
  60.         }
  61.  
  62.  
  63.         $data['user'] = $this->user_activate;
  64.  
  65.         $this->load->view('devoluciones/step2',$data);
  66.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement