<? 

include("../includes/site_config.php");
include("../editor/fckeditor.php");
include("../includes/tab_functions.js");
include('paginate.php');
include('../lib/lib.Functions.php');


$option_manager = new OptionManager();
$CONST_MAIL=$option_manager->GetValue('mail');
$area = 'member';

$Sess_UserId=$_SESSION['Sess_UserId'];

if(isset($_REQUEST['submit'])){
		if(isset($_REQUEST['app']))
	{	
		$quePic=mysql_fetch_object(mysql_query("SELECT * from members where mem_userid='".form_get('userid')."'"));
		$upd=mysql_query("update adverts set bio_approved='".form_get('app')."' where adv_userid='".form_get('userid')."'");
		if($_REQUEST['app']=='1'){
				
      			send_mail ("$quePic->mem_email", "$CONST_MAIL", "$CONST_COMPANY ".BIO_APR, MAIL_APPROVEDBIO,$type,"ON");
		}else{
				send_mail ("$quePic->mem_email", "$CONST_MAIL", "$CONST_COMPANY ".BIO_UNAPR, MAIL_UNAPPROVEDBIO,$type,"ON");
		}
	}
		
	
}

$sel=mysql_query("SELECT * from adverts where adv_bio!='' AND bio_approved=0");
$no=mysql_num_rows($sel);

?>
<?php include("include/header.php"); ?>



<?php include('approve_menu.php'); ?>

<div class="mainwidth">
<div class="admin-page-header"><div class="admin-page-heading">&nbsp;&nbsp;<?=APPROVE_BIOS2?></div></div>
<div class="clear"></div>
<div class="admin-page">
<table border="0" cellspacing="0" cellpadding="0">

    <? 
	
	if($no < 1){?>

<tr > 


            <td>&nbsp;</td>


 <td  align="left"> <font color="#CC0000" size="+2">Nothing To Approve!</font></td>



 <td align="center"></td>

          </tr>

<? }?>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
   <? while($adv=mysql_fetch_object($sel)){?>
   <form action="<?=$_SERVER['PHP_SELF']?>?type=ab" method="post">
  <tr><td class="admin-head2" style="padding:5px"><b><?=$adv->adv_username?></b></td></tr>

  <tr>
    <td width="50%"><div class="terms">
 
 <?=$adv->adv_bio?>
</div></td>
  </tr>
  <tr>
    <td>Approve <input type="hidden" name="userid" value="<?=$adv->adv_userid?>" />
      <input name="app" type="radio" value="1">
    &nbsp;&nbsp;Reject 
      <input name="app" type="radio" value="2">
	  
    </td>
  </tr>
 
   <tr>
    <td><input name="submit" type="submit" value="Save"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
   </form>
  <? } ?>
  <tr>
    <td>&nbsp;</td>
  </tr>
 
</table>
</div><div class="admin-page-bottom"></div></div>
<br /><br />
<!-- Approved Bios code starts here-->
<div class="mainwidth">
<div class="admin-page-header"><div class="admin-page-heading">&nbsp;&nbsp;Approved Bios</div></div>
<div class="clear"></div>
<div class="admin-page">
<table border="0" cellspacing="0" cellpadding="0">
<div class="admin-head"> </div>

<?
$quer="SELECT * from adverts where adv_bio!='' AND bio_approved='1'";
$record_per_page='20';

$pager = new PS_Pagination($link,$quer,$record_per_page,5);
$rs = $pager->paginate();

//$no=mysql_num_rows($sel);

 ?>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
   <? while($bio_apprv=mysql_fetch_object($rs)){?>
   <form action="<?=$_SERVER['PHP_SELF']?>?type=ab" method="post">
  <tr><td class="admin-head2" style="padding:5px"><b><?=$bio_apprv->adv_username?></b></td></tr>

  <tr>
    <td width="50%"><div class="terms">
 
 <?=$bio_apprv->adv_bio?>
</div></td>
  </tr>
  <tr>
    <td>
    &nbsp;&nbsp;Delete 
      <input name="app" type="radio" value="2">
	  <input type="hidden" name="userid" value="<?=$bio_apprv->adv_userid?>" />
    </td>
  </tr>
 
   <tr>
    <td><? if($DEMO==false){?><input name="submit" type="submit" value="Save"><? }?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
   </form>
  <? }?>
  <tr>
    <td>&nbsp;</td>
  </tr>
 <tr align="right"><td><? echo $pager->renderNext(); ?></td></tr>
</table>



<!--Code ends here -->

</div><div class="admin-page-bottom"></div></div>
<?php include("include/footer.php"); ?>