title: How to set the session time out for otp using codeigniter
body: <p>I want to set the session time out for OTP,after set the time OTP will expire</p>
  
  <p><strong>Controlller code as shown in below</strong></p>
  
  <pre><code>    $six_digit_random_number = mt_rand(100000, 999999);                
      $this-&gt;session-&gt;set_userdata('otp', $six_digit_random_number);
                      $this-&gt;load-&gt;model('Login_model');
       $pass['pass'] = $this-&gt;Login_model-&gt;forgot_pass_retrive($emailTo);
                      $config['protocol'] = 'smtp';
                      $config['smtp_host'] = 'ssl://smtp.gmail.com';
                      $config['smtp_port'] = '465';
                      $config['smtp_timeout'] = '7';
                      $config['smtp_user'] = 'tworkreport@gmail.com';
                      $config['smtp_pass'] = '87xxxxxxxx';
                      $config['charset'] = 'utf-8';
                      $config['newline'] = "\r\n";
                      $config['mailtype'] = 'text'; 
                      $config['validation'] = TRUE; 
                      $this-&gt;email-&gt;initialize($config);
         $this-&gt;email-&gt;from('tworkreport@gmail.com', 'Terasukhintrade');
                      $this-&gt;email-&gt;to($emailTo);
                      $this-&gt;email-&gt;subject('Reset your password');
                      $this-&gt;email-&gt;message('Click on link to reset your password '.$this-&gt;session-&gt;userdata['otp'] );
  
                      $this-&gt;email-&gt;send();
  
                      echo $this-&gt;email-&gt;print_debugger();
  
                      $this-&gt;load-&gt;view('login',$data);
                  } else {
  
                      $this-&gt;session-&gt;set_flashdata('message', ' Email address not found!');
                      $this-&gt;load-&gt;view('login',$data);
                  }
  
              }
          }
  </code></pre>