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
-
There are free and paid Wordpress plugins for this; consider looking in the Plugin repository – Pekka Sep 11 '11 at 10:14
-
1No, you don't need PHP. You could also use Python for example. – ThiefMaster Sep 11 '11 at 10:24
-
@Pekka It is not a WP site .I had mentioned – Sharpzain120 Sep 11 '11 at 10:26
-
@Sharpzain ah, I overread the "not". – Pekka Sep 11 '11 at 10:26
1 Answers
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.
-
-
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
-
-