Home » Scripting » PHP User Management with custom directories questi Messages in this topic - RSS
|
1/11/2011 10:53:30 PM
simy202
simy202
Posts 1
Yet another PHP/MySQL user management question. It's for an image editor, and so each user should have their own "space" i.e. user directory (USERDIR) upon signing up, and anything under that directory should be accessible to the relevant user only. Fairly simple step up but I can't seem to find the right keywords to search for a tutorial.

The way I was thinking of implementing it is having a "USERDIR" column in the MySQL db along side "USERID" and "PASSWORD" (md5 hashed) (although I understand USERDIR is a redundant key if USERIDs are also unique - is this an issue to be worried about? i.e. I could just assign the USERID as the directory name instead of generating a unique random directory name). How do I then "check" whether the user has the privileges to access their directory (i.e. how do I code it to check the sessionID/cookie checking to stop another user from going to mysite.com/USERID or mysite.com/USERDIR). I appreciate this is really basic and repetitive for some of you but I can't seem to find the relevant tutorials anywhere! Any help much appreciated.

--
PHP User Management
1/31/2011 11:50:24 AM
admin
admin
Posts 331
Hi,

There are a number of different ways you can do this. I'm not an expert in PHP programming, so for the best advice I would recommend asking you question on a dedicated PHP or web programming forum. I did a quick google search and I came up with these two:

http://www.devnetwork.net/
http://www.phpfreaks.com/forums/index.php

If your developing a website you have a lot of control over how you implement security. Many sites will use an authentication mechanism similar to what you described. Hashing passwords is a good idea, but you should also include a salt value that is different for each user. I know .NET has some built-in features you can use so your not re-inventing the wheel, but I'm not that familiar with PHP so I'm unable to offer any specific advice.

Hope this helps,

David

PS

It would be best to use an autonumber/identity as your tables primary key and create a unique index on the username column. This will give you a smaller primary key that will never need to be updated.
pages: 1
|

Home » Scripting » PHP User Management with custom directories questi