<?   session_start();ob_start();

	include("head.php");
	include("../include/db.inc.php");
	include("../include/mail.php");
	
	$db1=new db;
    $db1->open();mysql_query("SET NAMES 'utf8'");

		if($_SESSION['uname']=='' || $_SESSION['pwd']=='')
		{
			header("location:login.php");
		}
		if($_GET['sendid'])
			{
				$del_id=$_GET['sendid'];
				if($_GET['bid'])
				{
				$bid_user=mysql_fetch_array(mysql_query("select no_bids from user where id=".$_GET['bid']));
				$bid_refer=mysql_fetch_array(mysql_query("select no_bids from admin_referfriend_bid "));
				$total_bid=$bid_user['no_bids'] + $bid_refer['no_bids'];
				mysql_query("update user set no_bids='$total_bid' where id=".$_GET['bid']);
				
				send_refer_bids($_GET['bid']);
				}
				mysql_query("delete from invite_friend where id='$del_id'");
				
			}
		
		if($_GET['delid'])
			{
				$delid=$_GET['delid'];
				mysql_query("delete from invite_friend where id='$delid'");
				header("location:refer_friend.php?id='1'#pending");
				
			}
		
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Money Auctions | Admin Controls</title>
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");	?></div>
<div class="top_links_show"><? include("belowleft1.php");	?></div></div>
<div style="float:left; width:800px">
<div class="maximum">

     <? 
	
if(!$_GET['id']){?><a name="confirm">
		<? 
		
		$confirm=mysql_query("select * from invite_friend where status='1'");
		
		?>
      <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
  <tr> 
    <td width="15" valign="top">&nbsp;</td>
          <td valign="top"><br> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="33" valign="top"><img src="img/03.gif" width="33" height="23"></td>
                <td background="img/bg01.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="42%"><strong>CONFIRM REFER FRIEND</strong> </td>
                      <td width="32%">&nbsp;</td>
                      <td width="26%" align="right">
					  <a href="refer_friend.php?id='1'#pending" class="link5">Pending Refer Friend</a>
					  </td>
                    </tr>
                  </table></td>
          <td width="35"><img src="img/04.gif" width="35" height="23"></td>
        </tr>
      </table>
      <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="22" valign="top" background="img/tbl-left04.gif"><img src="img/tbl-left04.gif" width="22" height="13"></td>
          <td valign="top" align="center">		 
        <table width="93%" border="1" cellspacing="1" cellpadding="1" style="border-collapse:collapse; border-color:#FED267">
              <tr bgcolor="#FED267"> 
                        <td width="50" ><strong><font color="#FFFFFF">S.No.</font></strong></td>
                    <td width="129" ><strong><font color="#FFFFFF">Name</font></strong></td>
                    <td width="167" align="center"><strong><font color="#FFFFFF">Email</font></strong></td>
                    <td width="106" ><strong><font color="#FFFFFF">Send User Bid</font></strong></td>
					    <td width="151" ><strong><font color="#FFFFFF">Delete Refer Friend</font></strong></td>
                  </tr>
                     <? 
					 	$i=1;
					 	while($row=mysql_fetch_array($confirm))
						{
					 $namearr=explode('@',$row['email']);
					 	?>
                      <tr  onMouseOver="this.style.backgroundColor='#FFECBF'" onMouseOut="this.style.backgroundColor='#ffffff'"> 
                        <td ><?=$i;?></td>
                        <td ><?=$namearr[0];?></td>
                        <td align="center"><?=$row['email']?></td>
                       <td ><a href="refer_friend.php?sendid=<?=$row['id']?>&bid=<?=$row['uid']?>">Send Bid</a></td>
					    <td ><a href="refer_friend.php?sendid=<?=$row['id']?>" onClick="return confirm('Are you sure to delete this refer friend ?');"><img src="../images/category/imgdelete.gif" border="0"></a></td>
						
                      </tr>
                      <? $i++;}?>
                    </table>
        </td>
          <td width="19" valign="top" background="img/tbl-right04.gif"><img src="img/tbl-right04.gif" width="19" height="9"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="33" valign="top"><img src="img/tbl-bot01.gif" width="33" height="12"></td>
          <td width="672" valign="bottom" align="right" background="img/tbl-bg.gif">&nbsp;</td>
          <td width="15" valign="top" ><img src="img/tbl-right05.gif" width="" height="12"></td>
        </tr>
      </table>

    </td>
    <td width="15" valign="top">&nbsp;</td>
  </tr>
</table></a>
      <? }else if($_GET['id']){?><a name="pending">
	  <? 
		
		$pending=mysql_query("select * from invite_friend where status='0'");
		
		?>
      <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
  <tr> 
    <td width="15" valign="top">&nbsp;</td>
          <td valign="top"><br> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="33" valign="top"><img src="img/03.gif" width="33" height="23"></td>
                <td background="img/bg01.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="32%"><strong>PENDING REFER FRIEND</strong> </td>
                      <td width="42%">&nbsp;</td>
                      <td width="26%" align="right">
					  <a href="refer_friend.php#confirm" class="link5">Confirm Refer Friend</a>
					  </td>
                    </tr>
                  </table></td>
          <td width="35"><img src="img/04.gif" width="35" height="23"></td>
        </tr>
      </table>
      <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="22" valign="top" background="img/tbl-left04.gif"><img src="img/tbl-left04.gif" width="22" height="13"></td>
          <td valign="top" align="center">	
	 
        <table width="95%" border="1" cellspacing="1" cellpadding="1" style="border-collapse:collapse; border-color:#FED267">
               <tr bgcolor="#FED267"> 
                       <td width="70" ><strong><font color="#FFFFFF">S.No.</font></strong></td>
                    <td width="167" ><strong><font color="#FFFFFF">Name</font></strong></td>
                    <td width="224" align="center"><strong><font color="#FFFFFF">Email</font></strong></td>
                    <td width="161" ><strong><font color="#FFFFFF">Delete Refer Friend</font></strong></td>
                  </tr>
                     
                       <? $i=1;
					 	while($row1=mysql_fetch_array($pending))
						{
					  $namearr=explode('@',$row1['email']);
					 	?>
                      <tr  onMouseOver="this.style.backgroundColor='#FFECBF'" onMouseOut="this.style.backgroundColor='#ffffff'"> 
                        <td ><?=$i;?></td>
                        <td ><?=$namearr[0];?></td>
                        <td align="center"><?=$row1['email']?></td>
                       <td ><a href="refer_friend.php?delid=<?=$row1['id']?>" onClick="return confirm('Are you sure to delete this refer friend ?');"><img src="../images/category/imgdelete.gif" border="0"></a></td>
                      </tr>
                     <? $i++;}?>
                    </table>
     </td>
          <td width="19" valign="top" background="img/tbl-right04.gif"><img src="img/tbl-right04.gif" width="19" height="9"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="33" valign="top"><img src="img/tbl-bot01.gif" width="33" height="12"></td>
          <td width="672" valign="bottom" align="right" background="img/tbl-bg.gif">&nbsp;</td>
          <td width="15" valign="top" ><img src="img/tbl-right05.gif" width="" height="12"></td>
        </tr>
      </table>
    </td>
    <td width="15" valign="top">&nbsp;</td>
  </tr>
</table></a>
      <? }?>

</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>

</html>
</div>
</body>
</html>
