<?php
	include "db_connection/db_connection.php";
	include "config/config.php";
	
	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title><?php echo $PROJECT_TITLE ?></title>

<script type="text/javascript" src="js/log_det_pwd_change_JS.js"></script>
<script type="text/javascript" src="js/cnt_chkbox_JS.js"></script>

<link href="css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

<script type="text/javascript" src="js/plugins/forms/ui.spinner.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.mousewheel.js"></script>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<script type="text/javascript" src="js/plugins/charts/excanvas.min.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.pie.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.sparkline.min.js"></script>

<script type="text/javascript" src="js/plugins/tables/jquery.dataTables1.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.sortable.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.resizable.js"></script>

<script type="text/javascript" src="js/plugins/forms/autogrowtextarea.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.uniform.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.inputlimiter.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.autotab.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.chosen.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.dualListBox.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.cleditor.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.ibutton.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine.js"></script>

<script type="text/javascript" src="js/plugins/uploader/plupload.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html4.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html5.js"></script>
<script type="text/javascript" src="js/plugins/uploader/jquery.plupload.queue.js"></script>

<script type="text/javascript" src="js/plugins/wizards/jquery.form.wizard.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.form.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.breadcrumbs.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.tipsy.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.progress.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.colorpicker.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.jgrowl.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fileTree.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.sourcerer.js"></script>

<script type="text/javascript" src="js/plugins/others/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="js/plugins/others/jquery.elfinder.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="js/files/bootstrap.js"></script>
<script type="text/javascript" src="js/files/functions.js"></script>

<script type="text/javascript" src="js/charts/chart.js"></script>
<script type="text/javascript" src="js/charts/hBar_side.js"></script>

<!-- Shared on MafiaShare.net  --><!-- Shared on MafiaShare.net  --></head>

<body onload="document.getElementById('listpage').focus();">

<!-- Top line begins -->
<?php include "header_footer/header.php"; ?>
<!-- Top line ends -->


<!-- Sidebar begins -->
<?php include "menus/left_menu.php"; ?>
<!-- Sidebar ends -->
    
    
<!-- Content begins -->
<div id="content">
    
<?php include "menus/top_menu.php"; ?>    
    <!-- Breadcrumbs line -->
    <div class="breadLine">
        <div class="bc">
            <ul id="breadcrumbs" class="breadcrumbs">
                <li><a href="home.php">Dashboard</a></li>
                <li><a href="javascript:">Login Details</a></li>
                <li><a href="javascript:">Change Password</a></li> 
                    
            </ul>
        </div>
	<?php include "menus/top_left_menu.php"; ?>            
        
    </div>
    
    <!-- Main content -->
    <div class="wrapper">
    
        <ul class="middleNavR">
            <!--<li><a href="#" title="Add an article" class="tipN"><img src="images/icons/middlenav/create.png" alt="" /></a></li>
            <li><a href="#" title="Upload files" class="tipN"><img src="images/icons/middlenav/upload.png" alt="" /></a></li>-->  
          <!--<li><a href="design_add.php" title="Add Design" class="tipN"><img src="images/icons/middlenav/add.png" alt="" /></a></li>-->
            <!--<li><a href="#" title="Messages" class="tipN"><img src="images/icons/middlenav/dialogs.png" alt="" /></a><strong>8</strong></li>-->
            <li><a href="login_det_list.php" title="Login Deatails List" id="addpage" class="tipN"><img src="images/new_login.png" alt="" style="margin-top:-20px" /></a></li>
          <li><a href="login_det_pwd_change.php" title="Change Password" id="addpage" class="tipN"><img src="images/chng_pwd.png" style="margin-top:-20px" /></a></li>
		  <li><a href="login_log_list.php" title="Client & Admin Log List" id="addpage" class="tipN"><img src="images/icons/mainnav/log_list.png" /></a></li>
		  <li><a href="guest_login_log_list.php" title="Guest Log List" id="addpage" class="tipN"><img src="images/icons/mainnav/guest_user.png" /></a></li>
          <li><a href="emp_login_log_list.php" title="Employee Log List" id="addpage" class="tipN"><img src="images/icons/mainnav/emp_hk.png" style="margin-top:-20px" /></a></li>
            <!--<li><a href="login_det_list.php" id="listpage" title="List Login Details" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>-->
    	</ul>            
  		<?php 
			$page_id= base64_encode(base64_encode(base64_encode(3))); 
				if(isset($_GET['cli_emp_id']))
				{
					$cli_emp_id =	$_GET['cli_emp_id'];	
				}
				else
				{
					$cli_emp_id = '';
				}
				
			$emp_name= base64_encode(base64_encode(base64_encode('Employee')));
			$cli_name= base64_encode(base64_encode(base64_encode('Client')));
			//echo $cli_name;
	?>

    	<!-- Chart --><!-- 6 + 6 -->
        <form id="validate" name="checklist" class="main" method="post" action="bl/login_det_BL.php?page_id=<?php echo $page_id; ?>" onsubmit="checkTheBox();">
         <fieldset>
        <div class="fluid">
		<div class="widget">
        
        <div class="formRow">
            <div class="grid3"><label>Login For:<span class="req">*</span></label></div>
            <div class="grid6 searchDrop ">
			<select data-placeholder="" class="select" style="width:350px;" name="login_for" id="login_for"  data-rel="chosen" onChange="reload_page();">
				<option value=""></option>
				<option <?php if($emp_name == $cli_emp_id){ ?> selected="selected" <?php }?>value="<?php echo $emp_name;?>">Employee</option>
				<option <?php if($cli_name == $cli_emp_id){ ?> selected="selected" <?php }?>value="<?php echo $cli_name;?>">Client</option>
			</select>
            </div>
            <div class="clear"></div>
        </div>
                        
        </div>
        </div>
        		
		<?php
		if(isset($_GET['cli_emp_id']))
		{
			$cli_emp_id		=	base64_decode(base64_decode(base64_decode($_GET['cli_emp_id'])));
			//echo  $cli_emp_id;
			if($cli_emp_id	=='Employee') 
			{
				$user_list = "Employee's List";
				
				$head_1 = 'Employee Name';
				$head_2 = 'Designation';
				$head_3 = 'User Name';
				$head_4 = 'Password';
				$head_5 = 'Email ID';				
				
				$SLCT = "SELECT * FROM login_details,admin WHERE admin.admin_id = login_details.admin_id AND emp_det_id!='0' ORDER BY login_details.login_details_id ASC";
			}
			else if($cli_emp_id	=='Client') 
			{
				$user_list = "Client's List";
				
				$head_1 = 'Party Code';
				$head_2 = 'Client Name';
				$head_3 = 'User Name';
				$head_4 = 'Password';
				$head_5 = 'Email ID';		
				
				$SLCT = "SELECT * FROM login_details,admin WHERE admin.admin_id = login_details.admin_id AND party_det_id!='0' ORDER BY login_details.login_details_id ASC";
			}			
			?>
         <input name="log_for" id="log_for" type="hidden" value="<?php echo $cli_emp_id; ?>" />
    	 <div class="widget">
            <div class="whead"><span class="titleIcon check"><input type="checkbox" id="titleCheck" name="titleCheck" onclick="ckall()" onfocus="foc(this.id)" onblur="stnon(this.id)"/></span>
            <h6><?php echo $user_list; ?></h6>
			<h6 style="float:right; margin-right:50px"><input type="text" id="cnt_chk" name="cnt_chk" value="" readonly="readonly" disabled="disabled" style="width:50px; font-size:12px; text-align:center;" /></h6>
			<div class="clear"></div></div>
			<div id="dyn" class="hiddenpars">
<a href="javascript:0" id="searchlink" onfocus="foc(this.id)" onblur="stnon(this.id)" class="tOptions" title="Options"><img src="images/icons/options.png" alt="" /></a>
            <div style="max-height:700px; overflow-y:auto;">
            <table cellpadding="0" cellspacing="0" width="100%" class="dTable check" id="checkAll">
            <thead>
            <tr>
            <td width="20"><img src="images/elements/other/tableArrows.png" alt="" /></td>
            <th width="113">S.No</th>
            <th width="134"><?php echo $head_1; ?></th>
            <th width="133"><?php echo $head_2; ?></th>
            <th width="124"><?php echo $head_3; ?></th>
           <th width="71"><?php echo $head_4; ?></th>
		   <th width="71"><?php echo $head_5; ?></th>
            
           
            </tr>
            </thead>
            <tbody>
            <?php
			$loop=1;
						
			
			//echo $SLCT;
			$QURY = mysqli_query($connect,$SLCT);
			if(mysqli_num_rows($QURY)>0)
			{			
			while($FTCH = mysqli_fetch_object($QURY))
			{
				//$design_id	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH->design_det_id))));
				
				if($cli_emp_id	=='Employee') 
				{
					$SLCT_emp = "SELECT * FROM master_dept,emp_det WHERE master_dept.master_dept_id = emp_det.master_dept_id AND emp_det.emp_det_id='$FTCH->emp_det_id'";
					$QURY_emp = mysqli_query($connect,$SLCT_emp);
					$FTCH_emp = mysqli_fetch_object($QURY_emp);
					
					$tdata_1 = $FTCH_emp->name; $tdata_2 = $FTCH_emp->master_dept_name; $tdata_3 = $FTCH->user_name; $tdata_4 = $FTCH->pass_word; $tdata_5 = $FTCH_emp->email_id;
					
					$user_id = $FTCH->emp_det_id;
				}
				else if($cli_emp_id	=='Client') 
				{
					$SLCT_cli = "SELECT * FROM party_det WHERE party_det_id='$FTCH->party_det_id'";
					$QURY_cli = mysqli_query($connect,$SLCT_cli);
					$FTCH_cli = mysqli_fetch_object($QURY_cli);
					
					if($FTCH_cli->email_id_1!=''){ $pa_mail_id = $FTCH_cli->email_id_1; }else if($FTCH_cli->email_id_2!=''){ $pa_mail_id = $FTCH_cli->email_id_2; }else if($FTCH_cli->email_id_3!=''){ $pa_mail_id = $FTCH_cli->email_id_3; }
					
					$tdata_1 = $FTCH_cli->party_code; $tdata_2 = $FTCH_cli->cmp_name; $tdata_3 = $FTCH->user_name; $tdata_4 = $FTCH->pass_word; $tdata_5 = $pa_mail_id;
					
					$user_id = $FTCH->party_det_id;
				}				
			
				if($loop%2 != "0")
					$bg = "gradeX";
				else
					$bg = "class='gradeC'";
									
			?>
            
            <tr <?php echo $bg ?>>
            <td align="center" style="display:table-cell;vertical-align:middle">
			<input type="checkbox" name="category[]" id="category<?php echo $loop ?>" onclick="cnt_chk_fn(<?php echo $loop ?>);" value="<?php echo $user_id; ?>" onfocus="foc(this.id)" onblur="stnon(this.id)"/>
			</td>
            <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $loop ?></td>
            <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $tdata_1; ?></td>
            <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $tdata_2; ?></td>
            <td class="center" align="center"><?php echo $tdata_3; ?></td>
            <td class="center" align="center"><?php echo $tdata_4; ?></td>
			<td class="center" align="center"><?php echo $tdata_5; ?></td>
			
            </tr>
            
            <?php
			$loop ++;
		
			 }
			 }
		
		?>
          				
            </tbody>
            </table> 
            </div>
			</div>
        </div>         
        
        <?php } ?>
       <?php
	   if(isset($_GET['cli_emp_id']))
		{
	    if(mysqli_num_rows($QURY)>0){ ?>
        
        <div class="fluid">
		<div class="widget">
        
        <!--<div class="formRow">
            <div class="grid3"><label>Usual radio :</label> </div>
            <div class="grid9">
                <input type="radio" id="radio1" name="question1" value="cam" /><label for="radio1"  class="mr20">Cam</label>
                <input type="radio" id="radio2" name="question1" value="rtv" /><label for="radio2"  class="mr20">RTV</label>
                
            </div>
            <div class="clear"></div>
        </div>-->
        
           <div class="formRow">
                <input type="button" value="Submit" class="buttonM bBlack formSubmit" onclick="checkTheBox();" style="float: right; margin-left:20px;"/>
                <input type="button" value="Reset" class="buttonM bRed" style="float: right; margin-left:20px;" onclick="form_rest();"/>
                <div class="clear"></div></div>
                <div class="clear"></div>
            </div>
        </div>
       
       <?php } } ?>
       
       
        </fieldset>
        </form>
        
        <div class="fluid"><!-- Media table --></div>
        
        
        
    </div>
    <!-- Main content ends -->
    
</div>
<!-- Content ends -->
<?php /*?><?php include "header_footer/footer.php"; ?><?php */?>
</body>
</html>
