I have a login script for members only and have some members only content but the couple pages that i have made can be accessed by anyone if they know the url.
The point of the members only area was to have pages members only not public even if they know the url.
I need to know how to add a new php script that checks to see if a user is logged in and if their not it redirects them to the registration page.
But i don't know how. I have a session script up but that dosnt seem to be working all it does is check to see how many guests and registered users go to the page and that's fine but i need something to add to it that makes people register and login before being able to view the page.
Thats all i need to know so that i can add it to my pages and then i can complete the member system.
if(!$_SESSION['uname'])
{
header("Location:register.php");
}
YOUR CODE HERE
}
Well i thought it worked. smilie i got this when i tryed this code if(!$_SESSION['uname'])
{
header("Location:register.php");
}
YOUR CODE HERE
}
this is what happened if(!$_SESSION['uname']) { header("Location:register.php"); }
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dsialex/public_html/member/userinfo.php:5) in /home/dsialex/public_html/member/include/session.php on line 46
and on SBP tonex script i got this Parse error: syntax error, unexpected T_INCLUDE, expecting ',' or ';' in /home/dsialex/public_html/member/userinfo.php on line 22 and then it just goes on and on throughout the coding. even if i fix something.
if(!$_SESSION['uname']) { header("Location:register.php"); }
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dsialex/public_html/member/userinfo.php:5) in /home/dsialex/public_html/member/include/session.php on line 46
GRRRR I HATE THIS I HATE IT...........smilie smilie smilie smilie smilie stupid stupid darned scripts......Its bugged it works one time and i try again on another and it dosnt work.
Yea now i have everyones script working but it redirects me to the login page when im logged in so in a way it dosnt work. Really starting to make me mad