<?php
include("includes/site_info.php");
include_once __INCLUDE_CLASS_PATH."/class.Picture.php";
$picture = new Picture();

$WUserID = $_SESSION['Sess_UserId'];
$VUserID = $_REQUEST['VUserID'];

$myhahaper_query=mysql_query("SELECT mem_userid, mem_profileid, mem_username, mem_fullname FROM my_friends LEFT JOIN members ON (friend_uid=mem_userid) WHERE uid='$VUserID' and approved='1' order by mem_username",$link) or die(mysql_error());
$myhahaper_TOTAL = mysql_num_rows($myhahaper_query);
if ($myhahaper_TOTAL > 0) { ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="white_back_t_xb">
	<tr>
		<td><div class="light_orang_h">
				<div style="background-color:#FF0000; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div>
				All Connections (<?=$myhahaper_TOTAL?>)</div>
			<div class="dot_line"><img src="images/spacer.gif" width="1" height="1" /></div>
			<div class="solid_line"><img src="images/spacer.gif" width="1" height="1" /></div></td>
	</tr>
	<tr>
		<td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="white_back_t_xb">
				<tr>
					<td><?php 
$h = 0;
while ($hahaper_pic = mysql_fetch_object($myhahaper_query)) {
$h++;
if ($WUserID==$hahaper_pic->mem_userid) {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$hahaper_pic->mem_userid' and pic_default='Y'") or die(mysql_error()); 
} else {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$hahaper_pic->mem_userid' and pic_default='Y' and pic_private='N'") or die(mysql_error()); 
}
$pics_count = mysql_num_rows($photo_query);
$aPicture = mysql_fetch_object($photo_query);
if ($pics_count > 0) {
	$medium = $aPicture->pic_picture."_ps.".$aPicture->ext;
	$male1_picture1 = "members/$hahaper_pic->mem_username/picture/$medium";
             }else{
$male1_picture1=$picture->GetProfilePicture($hahaper_pic->mem_userid);
}

if ($hahaper_pic->mem_profileid != null) { $male1_name1= $hahaper_pic->mem_profileid; }
else { $male1_name1= $hahaper_pic->mem_username; }

$fullname = $hahaper_pic->mem_username;
?>
						<div class="left p5"><a href="<?=$CONST_LINK_ROOT?>/<?=$male1_name1?>"><span class="img_b_p3 w50_h50"><img src="<?=$CONST_LINK_ROOT?>/<?=$male1_picture1?>" border="0" title="Name:&nbsp;<?=ucwords($fullname)?>"/></span>
							<?=$hahaper_pic->mem_username;?>
							</a> </div>
						<? 
				} ?>
					</td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
<?php } else {?>
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
	<tr>
		<td><div class="light_orang_h">
				<div style="background-color:#FF0000; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div>
				All Connections </div>
			<div class="dot_line"><img src="images/spacer.gif" width="1" height="1" /></div>
			<div class="solid_line"><img src="images/spacer.gif" width="1" height="1" /></div></td>
	</tr>
	<tr>
		<td><table width="100%" border="0" cellpadding="5" cellspacing="0" class="white_back_t_xb">
				<tr>
					<td>No connection yet for current!</td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
<?php } ?>
