
Creating HTML pages dynamically is one half of what a content management system (CMS) does: it takes chunks of code (your content) and pieces them together into a single HTML page. The other function of a CMS is to provide an easy way for you, the user, to manage all those chunks of content.
In a login page, remember me feature is used to preserve the login name and password entered by the user. And it can be populated in the login form at the time of login. It minimizes the user effort by preventing to enter login details for each time.
Also Read: Limit WordPress Comments Length Manually
By default, “Remember Me” option in the login page will keep you logged in for 2 weeks which means 1209600 seconds (14*24*60*60).
If you want to stay logged-in for longer duration, then copy and paste the following code in your theme’s functions.php file. (Pastebin Link)
/**
* Stay Logged in (Powered by Yeahhub.com)
*/
add_filter( ‘auth_cookie_expiration’, ‘stay_longer’ );
function stay_longer( $expire ) {
return 17280000; // 200 days in seconds (200*24*60*60)
}
With the help of unitconverter, you can easily convert the days into seconds.
If you want to achieve the same thing in PHP then you can use the following code.
<?php
if($_POST[“remember_me”]==’1′ || $_POST[“remember_me”]==’on’)
{
$hour = time() + 3600 * 24 * 200;
setcookie(‘username’, $login, $hour);
setcookie(‘password’, $password, $hour);
}
?>