<?
ob_start();
session_start();
if($_SESSION['uname']=='' || $_SESSION['pwd']=='')
		{
			header("location:login.php");
		}
 include("../include/db.inc.php");
 include("../include/bit_functions.inc.php");
 include("../include/pager.php"); 
   $db1=new db;
   $db1->open();
    mysql_query("SET NAMES 'utf8'");


   
	if(isset($_POST['Addnew_btn']) && is_array($_POST['user_id']))
	{  
		$bids=$_POST['bids'];
		foreach($_POST['user_id'] as $userid)
		{
			$grow=mysql_query("select no_bids from user where id='".$userid."'");
			$gre=mysql_fetch_array($grow);
			$no_bids=$gre['no_bids'];
			$total_bid=$no_bids + $bids;
			$query1="update user set no_bids='".$total_bid."' where id='".$userid."'";
			mysql_query($query1);
			}
			header("location:user_list.php");
		}
		$uname_sql = "select id,uname from user where email!='' and confirm='1' and deactive='0' and blocked='0'";
$uname = mysql_query($uname_sql);
			?>
<!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>

<title>NEWADMIN</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/stylesheet.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="../scriptaculous/js/ajax.js"></script>
<? include("../scriptaculous/js/ajax-dynamic-list.php");?>
<script language="javascript">
function validate()
{

     if(document.addnewfrm.user_id[].value=='')
	{
		 alert("Select Username First");
		 document.addnewfrm.user_id[].focus();
		return false;

	} 
	  if(document.addnewfrm.bids.value=='0')
	{
		 alert("Select No. Of Bids");
		 document.addnewfrm.bids.focus();
		return false;

	} 
	}
	</script>
</head>
<body bgcolor="#ffffff">
<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">
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<div style="margin-top:5px"> 
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" style="border-collapse:collapse; border-color:#404193">
  <tr height="417">
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::left starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->   
    
	<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::left ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->    
<td width="81%" bgcolor="#FFFFFF" valign="top">
<br>
      
      <TABLE WIDTH="73%" BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center">
        <TR> 
          <TD> <img border='0' src="border_img/circle_01.gif" WIDTH=36 HEIGHT=35 ALT=""></TD>
          <TD width="626" height="34" valign="top" > <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="26%" ><strong><font color="#003366">Added User Bids</font></strong></td>
                <td width="69%" background="border_img/circle_02.gif">&nbsp;</td>
              </tr>
            </table></TD>
          <TD> <img border='0' src="border_img/circle_03.gif" WIDTH=35 HEIGHT=35 ALT=""></TD>
        </TR>
        <TR> 
          <TD width="36" background="border_img/circle_04.gif">&nbsp; </TD>
          <TD align="left" valign="top"> 
		  <form action="" method="post" enctype="multipart/form-data" name="addnewfrm" onSubmit="return validate();">
        	<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#003366" >
			<tr bgcolor="#E6E4E3">
                          <td width="19%" height="20">User Name</td>
                          <td><div style="margin-top:5px;">
                              <div style=" padding-left:7px;">
                                <div >
                                  <ul class="checklist cl1">
									<?
									  $i = 0;
									  
									  while($username = mysql_fetch_array($uname)){?>
									<li class="alt<?=($i%2)?"1":"2"?>">
                                      <label for="username<?=$i;?>">
                                      <input id="username<?=$i;?>" type="checkbox" name="user_id[]" value="<?=$username['id'];?>"/>
                                      <?=$username['uname'];?>
                                      </label>
                                    </li>
										<?
										   $i++;
										  }
											?>
                                  </ul>
                                </div>
                              </div>
                          </div></td>
                        </tr>
         	 <!--<tr bgcolor="#E6E4E3"> 
            <td width="19%" height="20">User Name</td>
            <td> 
            <input type="text" name="uname" class="whiteselectnew" size="20"  onkeyup="ajax_showOptions(this,'uname',event)" />
			</td>
          </tr>-->
          <tr bgcolor="#FFFFFF"> 
            <td height="20">No.of Bids</td>
             <td>  
 
             <select name="bids" >
                 <option value="0">--No. of Bids--</option>
				<option value="10">10</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
                <option value="200">200</option>
				<option value="250">250</option>
				<option value="500">500</option>
                <option value="750">750</option>
				<option value="1000">1000</option>
				</select></td>
          </tr>
          <tr bgcolor="#E6E4E3	"> 
            <td height="25">&nbsp;</td>
            <td><input name="Addnew_btn" type="submit" class="inputsubmit" value="Update"></td>
          </tr>
        </table>
        </form></TD>
          <TD width="35" background="border_img/circle_06.gif">&nbsp; </TD>
        </TR>
        <TR> 
          <TD> <img border='0' src="border_img/circle_07.gif" WIDTH=36 HEIGHT=34 ALT=""></TD>
          <TD height="34" background="border_img/circle_08.gif">&nbsp; </TD>
          <TD> <img border='0' src="border_img/circle_09.gif" WIDTH=35 HEIGHT=34 ALT=""></TD>
        </TR>
      </TABLE>
        </td>
  </tr>
</table>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center ends:::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</body>
</html>