Members Area site

liunx

Guest
how do i make a members area site?
for example, somebody joins by signing up on a form, then once that person is registered, they are able to do any member activity. and when they leave, and come back.. they can log back in.

btw.. everybody says i need cookies and sessions for this, but HOW IN DETAIL TO I DO THIS?i'm digging a hole where i can bury a similar bone. here's what you and i are going to have to do:

learn a server-side language (i chose PHP), plus databasing (i use MySQL).

it's a *****, bro.

what you are talking about, specifically, is called user authentication. google that term plus "tutorial" and "(insert your method -PHP or ASP- here)", and you'll get a lot of good stuff on it.plenty of "member area" type of scripts available on script archive sites, figure out which script you will want to use (PHP or CGI/PERL) and start searching. Or go the better but longer route, and learn how to do the programming.oh yeah, you'll also have to have the proper scripting support with your host. you don't really NEED to have database, but i'd recommend it.i have already chosen PHP and MySQL.. i have used MySQL and PHP before, just not cookies and sessions.what should my first step be? i want to learn it all so i can do it myself next time i need to.<!-- m --><a class="postlink" href="http://www.snippetlibrary.com/tutorials.php?kid=14&catname=Sessions%20/%20Cookies">http://www.snippetlibrary.com/tutorials ... %20Cookies</a><!-- m -->

they are not too hard to understand.

you need a form on the front page. it has name password or whatever you want. then when they submit it checks the DB for a similar name if it doesn't find one it adds it to the DB. you could also have the passwrod encrypted too.

once they are in the DB they get redirected to another page (members page) and there you have it. but you need a check on the members page so if the user goes directly to the members page without logging in it sends them to the log in page. so the script will need to check for the cookie or session.wow those tutorials are really helpful.. though the php versions werent up to date... i'm having trouble with the MySQL part.. i use phpMyAdmin, and i need SQL code for the table, but the tutorial doesnt supply it. heres the table i want to make:


mysql> select * from user;
+----+----------+------------------+
| id | username | password |
+----+----------+------------------+
| 1 | john | 2ca0ede551581d29 |
| 2 | joe | 7b57f28428847751 |
| 3 | tom | 675bd1463e544441 |
| 4 | bill | 656d52cb5d0c13cb |
+----+----------+------------------+
4 rows in set (0.16 sec)why do you want the SQL for that table? if you have phpMyAdmin then it is easy to do it without knowing sql. just go into it and make a table. then just add as many rows as you want. and yes most of the tutorials you find on the net are not up to date, but it is not hard to figure out what the difference is if any.ok now i made the table.. how do i add entries?insert into Table_name (id, username, password) VALUES ('', $username, $password);

that is a generic way of doing it. I would recommend adding some security to it like addslashes() and making the password encrypted. also if it is being submitted by a form then you will need to use the super global $_POST[].<!-- m --><a class="postlink" href="http://jeremy.resource-locator.com/members/">http://jeremy.resource-locator.com/members/</a><!-- m -->

thats my members area page.

what i meant was how do i add a user name and password to the table. the table is empty. but the fields are already in it. also i have an php error..

<!-- m --><a class="postlink" href="http://jeremy.resource-locator.com/members/error.php?e=0">http://jeremy.resource-locator.com/memb ... or.php?e=0</a><!-- m -->

that i want to get rid of. also why is it that when you submit the form blank you enter the 'members area page'.Originally posted by jeremy
<!-- m --><a class="postlink" href="http://jeremy.resource-locator.com/members/">http://jeremy.resource-locator.com/members/</a><!-- m -->

thats my members area page.

what i meant was how do i add a user name and password to the table. the table is empty. but the fields are already in it.
I just showed you in my last post.

also i have an php error..

<!-- m --><a class="postlink" href="http://jeremy.resource-locator.com/members/error.php?e=0">http://jeremy.resource-locator.com/memb ... or.php?e=0</a><!-- m -->

that i want to get rid of. also why is it that when you submit the form blank you enter the 'members area page'.
I can't tell you what the error is without seeing the code. and when you push submit you should be checking for it in the php page you just submitted to. like login.php is what you have. so post the code for that page and I will help you through it.
 
Back
Top