forumsudhir Posted July 18, 2008 Share Posted July 18, 2008 i want to create page where is link if user click the link and user is not singin so show the page to enter user name and password............. Link to comment https://forums.phpfreaks.com/topic/115378-user-authentication/ Share on other sites More sharing options...
Stephen Posted July 18, 2008 Share Posted July 18, 2008 Assuming you're using cookies for logging in (and the cookie names are "username" and "password", you could do something like: if (!isset($_COOKIE["username"]) || !isset($_COOKIE["password"])) { include("mylogin.php"); } else { //your member page info } That's very simple though. You should also check if the username is correct, if the password is correct for that username, and so on. Link to comment https://forums.phpfreaks.com/topic/115378-user-authentication/#findComment-593160 Share on other sites More sharing options...
waynew Posted July 18, 2008 Share Posted July 18, 2008 Should you really store passwords in cookies? Link to comment https://forums.phpfreaks.com/topic/115378-user-authentication/#findComment-593190 Share on other sites More sharing options...
awpti Posted July 18, 2008 Share Posted July 18, 2008 You shouldn't store usernames or passwords in a cookie. It's just bad juju. Link to comment https://forums.phpfreaks.com/topic/115378-user-authentication/#findComment-593200 Share on other sites More sharing options...
Stephen Posted July 18, 2008 Share Posted July 18, 2008 Change $_COOKIE to $_SESSION and add session_start, and bam. Link to comment https://forums.phpfreaks.com/topic/115378-user-authentication/#findComment-593228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.