Restrict pages to members only

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jbishop
Forum Newbie
Posts: 3
Joined: Sat Jul 03, 2010 2:18 pm

Restrict pages to members only

Post by jbishop »

Hi All,

I am attempting to figure out how to use PHP/MySQL to ensure that members are registered. I am very new to PHP and this is basically the issue. I am creating a new Social Network site. I have a successful join form, however, members aren't forced to join at this time. http://www.allcamchat.com is the site. If you look you can join but it wont link to the Members database to ensure that the member is registered. I basically want everything other then the Home tab members only. Any help is greatly appreciated.

The AllCamChat Communications Team
Last edited by califdon on Mon Jul 05, 2010 2:24 pm, edited 1 time in total.
Reason: Changed Subject, per OP
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: how to use if then statements to verify registered membe

Post by califdon »

Your Subject line is very misleading. I suggest that you change it to something like: Need code to limit pages to registered users.

What you are asking is a very broad question. There are dozens and dozens of ways to approach what you are asking. My best advice is to read up on PHP and MySQL in general, and search for tutorials on user registration using PHP. In any case, it's not something that can be answered in a simple forum post.
jbishop
Forum Newbie
Posts: 3
Joined: Sat Jul 03, 2010 2:18 pm

Re: how to use if then statements to verify registered membe

Post by jbishop »

your right that is what im looking for is how to RESTRICT areas to member only. Thanks for the post, I will read up on some tutorials and further post if needed.
jbishop
Forum Newbie
Posts: 3
Joined: Sat Jul 03, 2010 2:18 pm

Restrict pages to members only

Post by jbishop »

I am having issues finding a code code to restirct my website pages to members only. I am new to php and was just wondering would I go about this with with _SESSION or do i need to write a different code?? Please visit my site so you may see what I mean. allcamchat.com. Basically everything under the "HOME" tab is for public viewing then everything else I'd like members only (similar to myspace and facebook).
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Restrict pages to members only

Post by califdon »

Yes, you will use session variables so that once a user has authenticated themselves, they can view other restricted pages during that session. Here are a few selected tutorials and scripts that may help you (I obtained these by searching for 'php user authentication'):
http://www.devshed.com/c/a/PHP/User-Aut ... e-And-PHP/
http://www.developertutorials.com/scripts/3/261/
http://www.php-scripts.com/php_diary/071300.php3
http://hubpages.com/hub/User-Authentica ... -web-forms
Post Reply