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

$WUserID = $_SESSION['Sess_UserId'];

$timeout = time()-900;
$myhahaper_query=mysql_query("SELECT DISTINCT mem_userid, mem_username FROM my_friends LEFT JOIN members ON (friend_uid=mem_userid)  WHERE approved='1' and timestamp > $timeout and mem_userid!=$WUserID",$link) or die(mysql_error());

$new_query=mysql_query("SELECT * FROM adverts LEFT JOIN members ON (adv_userid=mem_userid) WHERE adv_approved='1' and adv_paused='N' ORDER BY mem_userid DESC");

?>

<div id="top_panel" class="darkpink_row_back">
	<?php include ("panel_top_main.php"); ?>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td valign="top"><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>
							Who's Online</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><?php 
	 while ($ret_pic = mysql_fetch_object($myhahaper_query)) {
if ($WUserID==$ret_pic->mem_userid) {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$ret_pic->mem_userid' and pic_default='Y'") or die(mysql_error()); 
} else {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$ret_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 = "$SITE_MAIN_WWW_ROOT/members/$ret_pic->mem_username/picture/$medium";
             }else{
$male1_picture1=$CONST_LINK_ROOT."/".$picture->GetProfilePicture($ret_pic->mem_userid);
}
?>
									<div class="left padding_5 grey_10 w66_h66"><a href="javascript:;" onclick="javascript: callprofileInfo(<?=$ret_pic->mem_userid?>);"><img src="<?=$male1_picture1?>" class="img_b_p3" title="Name:&nbsp;<?=ucwords($ret_pic->mem_username)?>"/></a><br />
										<?=ucwords($ret_pic->mem_username)?>
									</div>
									<?php 
				$i++;
				} ?></td>
							</tr>
						</table></td>
				</tr>
				<tr>
					<td><div class="light_orang_h"><div style="background-color:#0000FF; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"></div> Who's New </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><?php 
	 while ($ret_pic = mysql_fetch_object($new_query)) {
if ($WUserID==$ret_pic->adv_userid) {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$ret_pic->adv_userid' and pic_default='Y'") or die(mysql_error()); 
} else {
$photo_query=mysql_query("SELECT * FROM pictures WHERE pic_userid = '$ret_pic->adv_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 = "$SITE_MAIN_WWW_ROOT/members/$ret_pic->adv_username/picture/$medium";
             }else{
$male1_picture1=$CONST_LINK_ROOT."/".$picture->GetProfilePicture($ret_pic->adv_userid);
}

?>
               <div class="left grey_10 padding_5 w66_h66"><a href="javascript:;" onclick="javascript: callprofileInfo(<?=$ret_pic->adv_userid?>);"><img src="<?=$male1_picture1?>" class="img_b_p3" title="Name:&nbsp;<?=ucwords($ret_pic->adv_username)?>"/></a><br><?=ucwords($ret_pic->adv_username)?></div>
                <? 
				$i++;
				} ?></td>
				</tr>
				<tr>
					<td>&nbsp;</td>
				</tr>
			</table></td>
	</tr>
</table>
