Jump to content

Member Profile Pages


Scion

Recommended Posts

Hi, I have a client who wants to make member profile pages for each registered website member. How would I go about automatically generating a profile page for each member, which can be updated when a member edits his/her information?

 

Any help is greatly appreciated  :D

Link to comment
Share on other sites

Well the profile itself would just contain basic information about the account, and the user profile that the user has designed themselves.

 

So basically you want to have some main fields in your database:

 

-username

-age

-email

[other info they would show on their page]

 

then their actually profile make a text field named "description"

 

Say you wanted to have the profile URL look something like: /users/profile:username

 

MOD Rewrite does the trick there: [put into your .htaccess]

RewriteEngine On
RewriteRule ^users/profile\[^*]*)$ /profile.php?username=$1 [L]

 

Then profile.php would consist of something as such:

 

<?php
$username = $_GET[username];
//you can protect it later

$sql = "SELECT * FROM `users` WHERE `username`= '$username'";
$res = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($res) == 0){
echo "<b>This user does not exist!</b>\n";
}else {
$row = mysql_fetch_assoc($res);

echo "<table border=0 cellspacing=3 cellpadding=3 width=600>\n";
echo "<tr><td align=center>Welcome to <b>$username's</b> profile</td></tr>\n";
echo "<tr><td valign=top>$row[description</td></tr>\n";
echo "<tr><td valign=top>$username's Stats:<br>Age: $row[age]<br>E-Mail: <a href=\"mailto:$row[email]\">$row[email]</a></td></tr>\n";
echo "</table>\n";
}

?>

 

Now of course you could easily edit it to make it your own.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.