Click to See Complete Forum and Search --> : How to do button Remember my ID on this computer


toplisek
09-30-2005, 05:40 AM
I would like to have Check box with Remember my ID on this computer.
How can I make this with PHP
if I have login page and it should also be tracked
on server in log file with encryption? Please help.

bathurst_guy
09-30-2005, 05:43 AM
set a cookie if the checkbox is checked containing the ID

toplisek
09-30-2005, 05:46 AM
Have you suggestion how to do it right?

bathurst_guy
09-30-2005, 08:03 AM
that is my suggestion, set a cookie (http://php.planetmirror.com/manual/en/function.setcookie.php)

toplisek
09-30-2005, 01:26 PM
I would like to put in logOUT page:

<?PHP
function user_logout()
{
setcookie ('usernamelogin','',(time()+2592000),'/','',1));
setcookie ('id_hash','',(time()+2592000),'/','',1));
}

function user_set_tokens ($user_name_in)
{
global $supersecret_hash_padding;
if (!$usern_name_in)
{$feedback = 'ERROR - No username';return false;}
$username = strtolower ($user_name_in);
$id_hash= md5 ($username.$supersecret_hash_padding);
setcookie ('username','',(time()+2592000),'/','',1));
setcookie ('id_hash','',(time()+2592000),'/','',1));

}
?>


I would like to put in logIN page:

<?
function user_isloggedin()
{
if ($_COOKIE ['username'] && $_COOKIE ['id_hash']

{
$hash =md5 ($_COOKIE['username']
.$supersecret_hash_padding);
if ($hash ==$_COOKIE['id_hash'] {return true;}
else{return false;}
}

else {return false;}

}

?>


I have already on each page start session:

session_start();
if(!isset($_SESSION['logged']) or $_SESSION['logged'] != TRUE)
{
$_SESSION['caller'] = $_SERVER['PHP_SELF'];
header('Location: index.php');
}