<?php
include("includes/site_info.php");
include('session_handler.inc');

$WUserID = $_SESSION['Sess_UserId'];
$WUsername = $_SESSION['Sess_UserName'];

if ($_REQUEST['app']) { $app = $_REQUEST['app']; }
else { $app = 0; die;}
if ($_REQUEST['pic']) { $pic = $_REQUEST['pic']; }
else { $pic = 0; die;}
if ($app=="blog") {
$photoitem_query=mysql_query("SELECT blg_picture as picture, blg_ext as ext FROM blogs WHERE blg_userid = '$WUserID' AND blg_approved='Y' AND blg_id='$pic' LIMIT 1") or die(mysql_error());
$photoitem_TOTAL = mysql_num_rows($photoitem_query);
}
if ($app=="article") {
$photoitem_query=mysql_query("SELECT art_picture as picture, art_ext as ext FROM articles WHERE art_userid = '$WUserID' AND art_approved='Y' AND art_id='$pic' Limit 1") or die(mysql_error());
$photoitem_TOTAL = mysql_num_rows($photoitem_query);
}

?>
			<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">
            
<?php if ($photoitem_TOTAL > 0){ 
		while ($photo = mysql_fetch_object($photoitem_query) ) {

?>
            
            <tr class="solid_line_separator">
              <td align="center">
				<img src="<?=$SITE_MAIN_WWW_ROOT?>/members/<?=$WUsername?>/<?=$app?>/<?=$photo->picture?>.<?=$photo->ext?>" class="img_b_p3" border="0">
                       </td>
            </tr>
		  <?php }
		  } else {
?>
            
        <tr class="solid_line_separator">
          <td align="center"><div class="padding_10">Can't find a photo to view.</div></td>
        </tr>
<?php
	die;
}
?>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table></td>
  </tr>
</table>
