URGANT - Please help with members area

Hey all, I just found out today that my members area is coming up in the search results. Well when people click on the link it takes them directly to the members section without having to login.

What can I do to make it to where they have to login when going to that section of my site from search engines.

make sure your authentication script sets a session variable when a user logs in.

then at the top of every member page, check if that session variable exists and is set to the correct value before proceeding with the rest of the page load.

when a visitor from a search engine clicks a member page link the session variable won’t exist and so the page will not load.

Check if the user has a logged in session before showing the content of those pages. If they do not, redirect them to a page they are allowed access to.

Gotcha, Which piece of the code do I put on the members index page?

Would I need to put something like this on the page

//check that the form fields are not empty, and redirect back to the login page if they are
elseif (empty($username) || empty($password)) {
header( "Location: http://www.researchanyone.com/login.html" );

You can write the code in a separate file and then use PHP include to put it in the member index page. So have it check if there is an active session on that user’s browser in which a member in the database is logged on. If it is, display the page normally. If it isn’t, don’t display the page and just redirect the user to the regular index page or something using PHP header.

I have the check_login.php page, and sorry for the newb question, but how can I put that in a members page.

Like an include tag?