2

I want to let user be able to choose when they login, whether they want to be remembered for 30 days or for the session only. I a bit new to PHP programming

After 30 days session will expire, and for one hour it will expire after an hour.

I have this currently

HTML:

<label>Email :</label></br>
<div class="warn"><input  type="email" autofocus name="email" id="email" placeholder="Email" required="required" <?php getpostvalue('email'); ?> /></br></div>

<label>Password :</label></br>
<input  type="password" name="password" id="password" placeholder="Password"  required="required"  <?php getpostvalue('password'); ?>/></br></br>        

 <label>Remember me for:</label>
 <select name="checkcookielength" id="checkcookielength">
   <option value="30days">30 Days</option>                            
   <option value="onehour">1 Hour</option>  
 </select><br><br>

php:

function userloggedin($rr)
{


global $logged_in;  
global $userid;
global $sessionid;
global $email;
global $password;
$saltpassword = $password . "5138hyh8g0ghg3h";
$encpassword = hash('sha256', $saltpassword

   $logged_in = true;
   $userid = $rr->userid;      
   setcookie("userid", $userid, time()+60*60*24*30);



   header('Location: index.php');
 }

Your help will be appreciated.

0 Answers0