dean7 Posted November 15, 2009 Share Posted November 15, 2009 Hi all, i coded a login script yesterday and got it all working, but now i only want users to view the members page if they have logged in. <?php include ("config.php"); session_start(); $username = $_SESSION['username']; if ($username == ""){ echo ("You Must Login"); header ('Location: index.php'); }else{ echo (""); } ?> But with that code its not letting them login either though they have posted the correct detials. Anyone know why? Thanks For Your Help. Link to comment https://forums.phpfreaks.com/topic/181589-members-only/ Share on other sites More sharing options...
YourNameHere Posted November 15, 2009 Share Posted November 15, 2009 Is it not redirecting? if not: You cant echo something and then "header redirect". echo "Blah"; Header(loca.....); Cant do it. Use a meta refresh instead. There really isnt enough info to help with the "...not letting them login..." part. I doubt that issue is a result of the script you posted. Link to comment https://forums.phpfreaks.com/topic/181589-members-only/#findComment-957868 Share on other sites More sharing options...
FaT3oYCG Posted November 15, 2009 Share Posted November 15, 2009 Can we have a link to the site? Link to comment https://forums.phpfreaks.com/topic/181589-members-only/#findComment-957891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.