views:

191

answers:

3

I am working on a social network, and I am doing it with php and mysql, I need to know how to make users have customizable profiles...

Like editing status, ect...

Also making it so only friends can veiw their profile..

Also how do I add a user's page/directory to the website directory(example: domainname.com/someonesprofile)

Thank You -Techy

+3  A: 

That's a pretty generic question, but I'll give it a whirl.

First of all, you need to determine what a profile should contain and so forth, such as status, relationships, name, addresses, .... The list goes on. You then need to write an interface to a service that provides this information; this can be a PHP function, a class, whatever, really.

Second, you need to access this interface from within your web application. A suitable course of action is probably to have a function that assures that whoever is trying to access the information is logged in, is in the relevant authorization group (friends list), and so on.

The editing part is done quite simply through an HTML form or similar; there's no magick[sic] involved. The function to parse this form would again assure that the logged in user has the appropriate rights to edit the profile (e.g. is the same user or a trustee of some kind, parent, lover, who knows...)

As for the last bit; here mod_rewrite is your friend. You probably would want to have URLs along the line of http://example.org/profile/username , which the server would translate to /?action=profile&user=username, or something to that effect.

The file /profile/username would as such not exist on the server file system in any real sense, but seem to be a completely normal HTML file when viewed from the outside.

Williham Totland
-1 -- no reference to data storage, which is the Heavy Golden Key here.
Smandoli
A: 

I know that there are very nice frameworks available which handle the whole profile/login/friends functionality. Pinax for Django springs to mind. Ime quite sure similar things are available in PHP but unfortunatiely I know very little about the PHP community, so I don't have a link.

mdorseif
my problem is my hosting plan doesnt provide python...
techy
A: 

You must start with the database. You will need a table for Person, obviously. You will need a table that joins Person to Person many-to-many, for viewing privileges. You will need a table for levels of authorization. And you will need other tables that serve up what privileges go where.

The interface is secondary. Some developers would use something simpler than PHP to develop the UI functions that rely on these database resources.

Smandoli
Oh man ... if you can take the advice of mdorseif and get a working framework, do it. I'd rather not built the above myself, certainly.
Smandoli