CodeIgniter Forums
How to set time in Global redirect session - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Regional User Groups (https://forum.codeigniter.com/forumdisplay.php?fid=25)
+--- Thread: How to set time in Global redirect session (/showthread.php?tid=81232)



How to set time in Global redirect session - luckmoshy - 02-07-2022

How to set out those minutes in this way?

PHP Code:
return redirect()->to('login')->with('blockHacker''You requested too many times Try again after 40 minutes'); 



RE: How to set time in Global redirect session - captain-sensible - 02-08-2022

the way I approaches it was not to time them but t oset a limit of login attempts like this in the login contoller :

Code:
else
        {
                
               $logic =isset(   $_SESSION['count']);
               if ($logic ==false)
               {
                $_SESSION['count']=5;  
                return redirect()->route('loginRoute');
                
                
                
                }  
                  
                elseif($logic==true)
                
                {
                if(    $_SESSION['count']<=1 )
                {
                    
                    return redirect()->to('http://www.google.com');
                    
               }        
                    
                else
                
                {
                              
                                       $oldCount=  $_SESSION['count'];
                                        $newCount = $oldCount-1;
                                        $_SESSION['count']= $newCount;

basically in each attempt and failure of login , count goes down by one .