0

I am creating a website.It is not a wordpress website.I want to create username and Password for the Users who visit my site .to get Register. Whether I should use Database for this? or the Accounts provided by the Web-server?.I don't have any knowledge regarding that. Moreover how should I show a different page for each user showing his name and Profile stuff when he login successfully I know that need PHp but how.? I searched over the internet bu didn't find anything helpful

hakre
  • 193,403
  • 52
  • 435
  • 836
Sharpzain120
  • 365
  • 3
  • 9
  • 18

1 Answers1

0

You should definitely use a database for this. There are a number of php libraries and frameworks that offer this kind of functionality, look at this question Role Based Access Control for some helpful pointers.

There are numerous tutorials on the web that show you how these mechanisms work, and of course there are the sample pages of the different libraries referred to in the answers of the SO question.

A complete example that can help you understand the entire mechanism can be found here, with an extended version here.

For storage, aside from a database you could use files. Linux for example typically uses files to store user credentials (/etc/passwd for identifying data, /etc/shadow for passwords and etc/groups for user group info). It's harder to do right than a database though - concurrent write access needs to be managed, you have to secure the files against downloading, etc.

There is one constant though, for both files and databases: never ever store passwords in plaintext, but use a "salted hash". That way, if your system ever gets cracked at least your user's passwords will be safe.

Community
  • 1
  • 1
fvu
  • 32,488
  • 6
  • 61
  • 79
  • But how will i show different page for each user? – Sharpzain120 Sep 11 '11 at 10:02
  • Once a user is logged in his identity will be available through eg the session variables and by fetching those your program can know who the user is and decide what to show. – fvu Sep 11 '11 at 10:08
  • Ok I got that..but kinldy tell me how many possible ways of creating account? through database and...? – Sharpzain120 Sep 11 '11 at 10:14
  • I mean that when we register a domain the webserver give us 50 accounts.can we use them? – Sharpzain120 Sep 11 '11 at 10:40
  • It seems most odd to me that a website hosting package would include some access control mechanism (at least I never saw such a package). I'm guessing here but I think these are 50 mailboxes with the accompanying accounts. No you cannot use those. – fvu Sep 11 '11 at 10:48
  • Exactly Tanks alot fvu for your help...:) – Sharpzain120 Sep 11 '11 at 10:49
  • Glad I could help Sharpzain :-) – fvu Sep 11 '11 at 10:55