What is th best to keep trace of the password after someone logged to the site. I mean where sould i put the password to take it and check if it's valid each time a page is loaded.
Exept if you have a better idea.depends how many you have.
i always use a db but you use the .htaccess file or a flat file and encrypt the passwords
hthI mean the present password if the user is connected to the site right now. Is it better to put it in a temporary table or is there a better way?i always set cookies. then when the page loads it checks the info stored in the cookie with that of the database.Is it secure to use cookies like that?forget my last reply,I don't trust cookies enough. I decided to make a logged table and deny multiple same user connect.
My only problem now is how can I know if the user is not logged anymore to delete is entry?I got a problem ... again
I have to delete a cookie and recreate it after. Since I need to reload to resend the header, I used this function: header("Location:".$_SERVER['PHP_SELF']); , but it doesn't work, cause the cookie is not deleted.
Or can I just overwrite the informations in the cookie?Originally posted by SamKook
I got a problem ... again
I have to delete a cookie and recreate it after. Since I need to reload to resend the header, I used this function: header("Location:".$_SERVER['PHP_SELF']); , but it doesn't work, cause the cookie is not deleted.
Or can I just overwrite the informations in the cookie?
[edit: sorry,php3 only reference]
also,to check if a user is still logged in just set a timeout on the sessions....and store the last active time,update it every page...so when the user goes idle for x amount of time...delete the row.
basically compare the last active time to the current time...if it's difference is greater then the timeout...delete the row.That's what i'm already doing, i delete the row in the database and the cookie.why can't you delete a cookie and then recreate it and then send the header?
also you can be using sessions instead of cookies.Just because i'm too stupid to erase all the outputs i used for debugging.
Now it's working fine.
Thanks for letting me realise it.Now here is a new problem: I want my function to see variables in the main program. It should be easy, but i'm new to web programming and i'm used to develop classic apps.
Here is the code:
<?php
//Dé—ÂÂ弆aration de variables
$ID_Login = md5(microtime());
//Dé—ÂÂ弆aration des fonctions
Function CreerCookie()
{
if (setcookie("Login", $ID_Login, time()+60*60*12))//expire dans 12 heures
{
$InsertCookie = "INSERT INTO Logged VALUES (
'".$ID_Login."','','','".Date("Y-m-d H:i:s")."');";
//Faire un test et effacer le cookie si y?pas entr?dans db
mysql_query($InsertCookie,$db);
}
else
{
echo "Une erreur est survenue, assurez-vous que votre navigateur accepte les cookies";
//Informations de dé—ÂÂå·“ggage------------------A effacer
echo "<br />Bou P.S.on devrait pas voir la forme eventuellement";
}
}forget it, i think i'm getting stupider every day.
I just need to pass it to the function.
Exept if you have a better idea.depends how many you have.
i always use a db but you use the .htaccess file or a flat file and encrypt the passwords
hthI mean the present password if the user is connected to the site right now. Is it better to put it in a temporary table or is there a better way?i always set cookies. then when the page loads it checks the info stored in the cookie with that of the database.Is it secure to use cookies like that?forget my last reply,I don't trust cookies enough. I decided to make a logged table and deny multiple same user connect.
My only problem now is how can I know if the user is not logged anymore to delete is entry?I got a problem ... again
I have to delete a cookie and recreate it after. Since I need to reload to resend the header, I used this function: header("Location:".$_SERVER['PHP_SELF']); , but it doesn't work, cause the cookie is not deleted.
Or can I just overwrite the informations in the cookie?Originally posted by SamKook
I got a problem ... again
I have to delete a cookie and recreate it after. Since I need to reload to resend the header, I used this function: header("Location:".$_SERVER['PHP_SELF']); , but it doesn't work, cause the cookie is not deleted.
Or can I just overwrite the informations in the cookie?
[edit: sorry,php3 only reference]
also,to check if a user is still logged in just set a timeout on the sessions....and store the last active time,update it every page...so when the user goes idle for x amount of time...delete the row.
basically compare the last active time to the current time...if it's difference is greater then the timeout...delete the row.That's what i'm already doing, i delete the row in the database and the cookie.why can't you delete a cookie and then recreate it and then send the header?
also you can be using sessions instead of cookies.Just because i'm too stupid to erase all the outputs i used for debugging.
Now it's working fine.
Thanks for letting me realise it.Now here is a new problem: I want my function to see variables in the main program. It should be easy, but i'm new to web programming and i'm used to develop classic apps.
Here is the code:
<?php
//Dé—ÂÂ弆aration de variables
$ID_Login = md5(microtime());
//Dé—ÂÂ弆aration des fonctions
Function CreerCookie()
{
if (setcookie("Login", $ID_Login, time()+60*60*12))//expire dans 12 heures
{
$InsertCookie = "INSERT INTO Logged VALUES (
'".$ID_Login."','','','".Date("Y-m-d H:i:s")."');";
//Faire un test et effacer le cookie si y?pas entr?dans db
mysql_query($InsertCookie,$db);
}
else
{
echo "Une erreur est survenue, assurez-vous que votre navigateur accepte les cookies";
//Informations de dé—ÂÂå·“ggage------------------A effacer
echo "<br />Bou P.S.on devrait pas voir la forme eventuellement";
}
}forget it, i think i'm getting stupider every day.
I just need to pass it to the function.