LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   SET UP USER AUTHENTICATION with COOKIES - EASIEST METHOD\SOFTWARE?? (https://www.linuxquestions.org/questions/linux-security-4/set-up-user-authentication-with-cookies-easiest-method%5Csoftware-547970/)

JEFFPINCT 04-21-2007 09:52 PM

SET UP USER AUTHENTICATION with COOKIES - EASIEST METHOD\SOFTWARE??
 
This is important & I need an answer soon!

I have a linux hosted website. I need to be able to check existing users for a cookie or deny access completely. Also I need each placed cookie to expire 12 hrs after creation.

How do I do this the easiest way? Please be gentle - I am very NEW at this....

SlackDaemon 04-21-2007 11:31 PM

Was the site developed with a server side scripting language such as PHP? Best way to handle the cookies would be to manipulate cookies with the relevant language. For example, with PHP you can use the setcookie() function.

setcookie($name,$value,<expire time (epoch)>);

tniemela 05-04-2007 06:59 PM

Quote:

Originally Posted by JEFFPINCT
This is important & I need an answer soon!

I have a linux hosted website. I need to be able to check existing users for a cookie or deny access completely. Also I need each placed cookie to expire 12 hrs after creation.

How do I do this the easiest way? Please be gentle - I am very NEW at this....

I would not recommend any cookie authentication for any sensitive data. Cookie authentication can be easily bybassed and even your cookies can be stolen easily.

But here is simple example for PHP:

<?php
if(!isset($_COOKIE['mycookie']))
{

echo "<center><font color='666666'>No auth because no valid cookie found!</font></center>";
exit(0);
}
?>

Script expect user to have cookie set named: mycookie

Not set, no access :)


All times are GMT -5. The time now is 06:19 PM.