first create a table
CREATE TABLE PVIBES_user2foto (
user2foto_id int(11) NOT NULL auto_increment,
username varchar(25) NOT NULL,
foto_id tinyint(11),
PRIMARY KEY (user2foto_id),
KEY username (username)
);it's better to work with user - ID's but not with the old database stuff @ partyvibes.nl

\
###################################################################
# thatsme.php #
session_start();
require('connection file.php'); // change to your connection file!
if($_SESSION['userlevel'] <= '0') { // SIMPLE LOGIN CHECK
?> <a href="../becomemember.php" target="_top"><img src="../images/thatsme.jpg" border="0"></a><? }
else { // MEMBERS ONLY
$pid = $HTTP_GET_VARS[pic];
$user = $_SESSION['username'];
// Let's see if the user and picture are linked
mysql_select_db(your connection);
$sql_event_check = mysql_query("SELECT username, foto_id FROM PVIBES_user2foto WHERE username = '$user' AND foto_id = '$pid'");
$event_check = mysql_num_rows($sql_event_check);
if($event_check >= 1){ ?>
<a href="../member.php?username=<? echo $user; ?>" target="_top"><img src="../images/added2yourprofile.jpg" border="0"></a> <? }
else {
if($HTTP_GET_VARS[url] == '1') { // if clicked then...
$insertSQL = "INSERT INTO PVIBES_user2foto (username, foto_id) VALUES ('$user', '$pid')";
$Result1 = mysql_query($insertSQL, $your connection info) or die(mysql_error()); ?>
<a href="../member.php?username=<? echo $user; ?>" target="_top"><img src="../images/added2yourprofile.jpg" border="0"></a>
<? } else { ?>
<a href="thatsme.php?url=1&pic=<? echo $pid; ?>" target="_self"><img src="../images/thatsme.jpg" border="0"></a>
<? }
} }##################################################
# displayimage.php - edit
// find:
if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
$info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['addFav'] . '</a>';
} else {
$info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['remFav'] . '</a>';
}
// add:
$pic = $CURRENT_PIC_DATA['pid'];
$info ?><div id="Layer2" style="position:absolute; left:0px; top:250px; width:89px; height:58px; z-index:2"><iframe src="thatsme.php?pic=<? echo $pic; ?>" frameborder="0" width="89" height="58" scrolling="no"></iframe></div><? ;
$info ?><div id="Layer3" style="position:absolute; left:0px; top:320px; width:89px; height:58px; z-index:2"><iframe src="setasavatar.php?pic=<? echo $pic; ?>" frameborder="0" width="89" height="58" scrolling="no"></iframe></div><? ;
note: you need to change the layer style for working with the latest Mozilla
########################################
# setasavater.php
session_start();
require('your connection file');
if($_SESSION['userlevel'] <= '0') { // LOGIN CHECK
?> <a href="../becomemember.php" target="_top"><img src="../images/setasavatar.jpg" border="0" alt="You need to register / login to use this function"></a><? }
else { // MEMBERS ONLY
$pid = $HTTP_GET_VARS[pic];
mysql_select_db(your connection info);
$query_topimage = "SELECT * FROM cpg11d_pictures WHERE pid = '$pid'";
$topimage = mysql_query($query_topimage, $connection info) or die(mysql_error());
$row_topimage = mysql_fetch_assoc($topimage);
$avatar = "http://www.partyvibes.nl/pictures/albums/" . $row_topimage['filepath'] . "thumb_" . $row_topimage['filename']; // url to albums dir
$user = $_SESSION['username'];
if($HTTP_GET_VARS[url] == '1') { // WHEN CLICKED, so changed iframe url in displayimage.php
$insertSQL = "UPDATE YOUR_MEMBERS_TABLE SET user_avatar='$avatar', pictures_avatar='1' WHERE username = '$user'";
$Result1 = mysql_query($insertSQL, $connection info) or die(mysql_error());
$query_createavatar = "SELECT username, user_avatar FROM YOUR_MEMBERS_TABLE WHERE username = '$user'";
$createavatar = mysql_query($query_createavatar, $connection info) or die(mysql_error());
$row_createavatar = mysql_fetch_assoc($createavatar);
session_register('useravatar');
$_SESSION['useravatar'] = $row_createavatar['user_avatar']; // update session
?>
<a href="../member.php?username=<? echo $user; ?>" target="_top"><img src="../images/createdavatar.jpg" border="0" alt="Click here to view your updated profile"></a>
<? } else { ?>
<a href="setasavatar.php?url=1&pic=<? echo $pid; ?>" target="_self"><img src="../images/setasavatar.jpg" border="0" alt="Set this picture as avatar (little picture next to your comments)"></a>
<? }
}#
Thats about it... please note that i've wrote this for partyvibes.nl so a lot of url's and files are not standard within coppermine or phbb
It was one off my first codes so please don't flame me for bad coding

If you have any questions just let me know
Tim