<?php
error_reporting(0);
ob_start();
session_start();
include_once("../dbconnect.php");
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
     <style type="text/css">

      /* Sticky footer styles
      -------------------------------------------------- */

     

    </style>
<?php include_once("title.php"); ?>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/logo-nav.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
     <div id="wrap">
    <!-- Navigation -->
      <?php include_once("header.php"); ?>
<br><br><br>
    <!-- Page Content -->
    <div class="container">
        <div class="row">
            <div class="col-lg-12">


             

         <div class="row">
        <h1> Admin Setting </h1>

              <!------------------------------------Edit User------------------------------------>
               <?php if($_GET['edit']=="edit")

					{

		$sql1="Select * from mec_admin where mec_admin_id=".$_GET['admid']; 

			$sqlexe1=mysql_query($sql1);

			$admin1=mysql_fetch_array($sqlexe1);

						

						?>
                <div class="row">
	<div class="col-lg-12"> <form class="form-horizontal" method="post" name="frm" action="custmerinsert.php?action=adminsettings" enctype="multipart/form-data" onsubmit="return changepass(this);">
<fieldset>

<!-- Form Name -->
<legend>Edit User</legend>

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="username">User Name</label>  
  <div class="col-md-4">
  <input id="username" name="username" type="text"  value="<?php echo $admin1['mec_username'];?>" placeholder="Username" class="form-control input-md" required>

 <input type="hidden" name="admid" value="<?php echo $admin1['admin_id']; ?>" />
  
      
  </div>
</div>
<div class="form-group">
  <label class="col-md-4 control-label" for="username">Email Id</label>  
  <div class="col-md-4">
  <input id="username" name="email" type="text"  value="<?php echo $admin1['mec_email'];?>" placeholder="Username" class="form-control input-md" required>

 <input type="hidden" name="admid" value="<?php echo $admin1['mec_admin_id']; ?>" />
  <br>
       <button class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-user"></span>Submit</button>
  </div>
</div>

</fieldset>
</form>

  </div>
</div>
<?php } ?>
<?php if($_GET['up']=="up")

					{?>
                    <div class="row">
	<div class="col-lg-12" style="text-align:center"> <h3 style="color:#16A765; font-weight:bold">Modified successfully!!</h3>
</div></div>
                    <?php } ?>
              <!---------------------------------Edit User Ends---------------------------------->


              <!------------------------------------Edit Password------------------------------------>
              
              <?php if($_GET['reset']=="reset"){ 

					 $QUERYADMIN="Select * from mec_admin where mec_admin_id=".$_GET['adminid'];

					  $EXEADMIN=mysql_query($QUERYADMIN);

			         $ROWADMIN=mysql_fetch_array($EXEADMIN); 

					

					   ?>
                <div class="row">
	<div class="col-lg-12"> 
        
      <form class="form-horizontal" method="post" name="frm" action="custmerinsert.php?action=password" enctype="multipart/form-data" onsubmit="return password(this);">
<fieldset>

<!-- Form Name -->
<legend>Reset Admin Password</legend>

     <div class="form-group">
  <label class="col-md-4 control-label" for="singlebutton">Current Password :</label>
  <div class="col-md-4">
    <label class="col-md-4 control-label" for="singlebutton"><?php echo $ROWADMIN['mec_password']; ?></label>
  </div>
</div>  

<!-- Password input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="passwordinput">New Password :</label>
  <div class="col-md-4">
    <input id="new_password" name="new_password" type="password" placeholder="placeholder" class="form-control input-md"  required>
  

						  <input type="hidden" name="admid" value="<?php echo $ROWADMIN['mec_admin_id']; ?>" />
    
  </div>
</div>

<!-- Password input-->
<!--<div class="form-group">
  <label class="col-md-4 control-label" for="passwordinput">Confirm Password :</label>
  <div class="col-md-4">
    <input id="passwordinput" name="passwordinput" type="password" placeholder="placeholder" class="form-control input-md">
   
  </div>
</div>-->


   

<!-- Button -->
<div class="form-group">
  <label class="col-md-4 control-label" for="singlebutton"></label>
  <div class="col-md-4">
    <button id="singlebutton" name="singlebutton" class="btn btn-primary">Submit</button>
  </div>
</div>

</fieldset>
</form>

  </div>
</div>
<?php } ?>
<?php if($_GET['cp']=="cp")

					{?>
                    <div class="row">
	<div class="col-lg-12" style="text-align:center"> <h3 style="color:#16A765; font-weight:bold">Modified successfully!!</h3>
</div></div>
                    <?php } ?>
              <!---------------------------------Edit User Ends--------------------------------------->


            


        <div class="col-lg-12"><div class="well">
          <table class="table table-striped table-bordered">
              <thead>
              <tr><th>User Name</th><th>Emai Id</th><th>Action</th></tr>
              </thead>

              <tbody>
                 <?php

			$sql="Select * from mec_admin"; 

			$sqlexe=mysql_query($sql);

										

			while($admin=mysql_fetch_array($sqlexe))

		      {

					 ?>

                  <tr><td><?php echo $admin['mec_username'] ?></td>
                  <td><?php echo $admin['mec_email'] ?></td>
                  <td> <a href="adminsettings.php?edit=edit&admid=<?php echo $admin['mec_admin_id']; ?>"><button class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit User Name</button></a> 

		<a href="adminsettings.php?reset=reset&adminid=<?php echo $admin['mec_admin_id']; ?>" > <button class="btn btn-warning"><span class="glyphicon glyphicon-retweet"></span>  Reset Password</button></a></td></tr>
                             <?php } ?>       
              </tbody>
          </table>
        </div>
        </div>
        
       
    </div>

                
               
    </div>

        </div>

  

            </div>
            
         <div id="push"></div>
    </div>

     <?php include_once("footer.php"); ?>
   

    
    <!-- /.container -->

    <!-- jQuery -->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>


</body>

</html>
