<?php 
session_start(); 
include 'spaceship/krypton.php';
if(empty($_SESSION['username']) || $_SESSION['username'] == ''){
    header("Location: index.php");
    exit();
}

// set timeout period in seconds
$inactive = 900;
// check to see if $_SESSION['timeout'] is set
if(isset($_SESSION['timeout']) ) {
	$session_life = time() - $_SESSION['timeout'];
	if($session_life > $inactive)
        { session_destroy(); header("Location: logout.php"); }
}
$_SESSION['timeout'] = time();

?>
<!DOCTYPE html>
<html lang="en">
<head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title><?php include 'name.php'; ?> System</title>
    
        <!-- Bootstrap framework -->
            <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
        <!-- jQuery UI theme -->
            <link rel="stylesheet" href="lib/jquery-ui/css/Aristo/Aristo.css" />
        <!-- tooltips-->
            <link rel="stylesheet" href="lib/jBreadcrumbs/css/BreadCrumb.css" />
        <!-- tooltips-->
            <link rel="stylesheet" href="lib/qtip2/jquery.qtip.min.css" />
		<!-- colorbox -->
            <link rel="stylesheet" href="lib/colorbox/colorbox.css" />
        <!-- code prettify -->
            <link rel="stylesheet" href="lib/google-code-prettify/prettify.css" />    
        <!-- sticky notifications -->
            <link rel="stylesheet" href="lib/sticky/sticky.css" />    
        <!-- aditional icons -->
            <link rel="stylesheet" href="img/splashy/splashy.css" />
		<!-- flags -->
            <link rel="stylesheet" href="img/flags/flags.css" />	
        <!-- datatables -->
            <link rel="stylesheet" href="lib/datatables/extras/TableTools/media/css/TableTools.css">

        <!-- main styles -->
            <link rel="stylesheet" href="css/style.css" />
		<!-- theme color-->
            <link rel="stylesheet" href="css/dark.css" id="link_theme" />	
	
        <!-- favicon -->
            <link rel="shortcut icon" href="favicon.ico" />

    </head>
    <body class="full_width">
		
		<div id="maincontainer" class="clearfix">
			<header>
				<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
					<div class="navbar-inner">
						<div class="container">
							<a class="brand pull-left" href="dashboard.php"><?php include 'name.php'; ?> System</a>
							<ul class="nav navbar-nav user_menu pull-right">
								<li class="divider-vertical hidden-sm hidden-xs"></li>
								<li>
									<a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="img/user_avatar.png" alt="" class="user_avatar">Admin</a>
								</li>
								<li><a href="logout.php" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-log-out"></i> Logout</a></li>
							</ul>
						</div>
					</div>
				</nav>
</header>
	 <div id="contentwrapper">
     <div class="main_content">
	<div class="row">
		<div class="col">
			<h3>Ubah Password</h3>

			<form method="POST">
			<input name="pass1" type="password" placeholder="Password baru" class="inputmarket" required/>
	    <input name="pass2" type="password" placeholder="Konfirmasi Password" class="inputmarket" required/>
				<button type="submit" class="btn btn-primary" name="ubahpassword">Ubah Password</button>
			</form>
			
		<?php
			if($_SESSION['peran'] == 'admin') {
				echo '
			<div style="margin-top: 20px;">
				<h3>Ubah Password Keamanan User</h3>
				<form method="POST">
					<input type="password" name="passverif" class="inputmarket" required />
					<button name="updatepassv" class="btn btn-primary">Ubah Password</button>
				</form>
			</div>
		</div>
		
		</div>';
		
			}

		?>
		 
		 
<?php  

 if (isset($_POST['ubahpassword']))
	{
	$password_11 = mysqli_real_escape_string($krypton, $_POST['pass1']);
	$password_22 = mysqli_real_escape_string($krypton, $_POST['pass2']);
	
		if ($password_11 == $password_22)
			{
			$password1 = md5($password_11);//encrypt the password before saving in the database
			$update_pwd1 = mysqli_query($krypton,"update superman set password='".$password1."' WHERE name ='".$_SESSION['username']."' ");
			echo "<script>alert('Password Berhasil diubah');</script>";
			}
		  else
			{
			echo "<script>alert('Kedua Password tidak cocok');</script>";
			}

	}

	if(isset($_POST['updatepassv'])) {
		$vpass = mysqli_real_escape_string($krypton, $_POST['passverif']);
		$epass = md5($vpass);

		$ubah = "UPDATE protectfile SET pass_protect = '$epass'";
		$qubah = mysqli_query($krypton, $ubah);

		if($qubah) {
			echo "<script>alert('Password Berhasil diubah');</script>";
		} else {
			echo "<script>alert('Password GAGAL diubah');</script>";
		}

		
	}


?> 	
		 
	</div>	
 </div>	
			
</div>

		
<a href="javascript:void(0)" class="sidebar_switch on_switch ttip_r" title="Hide Sidebar">Sidebar switch</a>
<div class="sidebar">
	
	<div class="sidebar_inner_scroll">
		<div class="sidebar_inner">
			<form action="index.php?uid=1&amp;page=search_page" class="input-group input-group-sm" method="post">
				<input autocomplete="off" name="query" class="search_query form-control input-sm" size="16" placeholder="Search..." type="text">
				<span class="input-group-btn"><button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-search"></i></button></span>
			</form>
			<div id="side_accordion" class="panel-group">
				<div class="panel panel-default">
					<div class="panel-heading">
						<a href="#collapseOne" data-parent="#side_accordion" data-toggle="collapse" class="accordion-toggle">
							<i class="glyphicon glyphicon-lock"></i> Ubah Password
						</a>
					</div>
					<div class="accordion-body collapse" id="collapseOne">
						<div class="panel-body">
							<ul class="nav nav-pills nav-stacked">
								<li><a href="ubahpass.php">Ubah Password Admin</a></li>
							</ul>
						</div>
					</div>
				</div>

				<?php
					if($_SESSION['peran'] == 'admin') {
						echo '<div class="panel panel-default">
					<div class="panel-heading">
						<a href="#collapsetong" data-parent="#side_accordion" data-toggle="collapse" class="accordion-toggle">
							<i class="glyphicon glyphicon-trash"></i> Riwayat Periode
						</a>
					</div>
					<div class="accordion-body collapse" id="collapsetong">
						<div class="panel-body">
							<ul class="nav nav-pills nav-stacked">
								<li><a href="trash.php">Tongsampah</a></li>
							</ul>
						</div>
					</div>
						
						
						<div class="panel panel-default">
					<div class="panel-heading">
						<a href="#collapsetwo" data-parent="#side_accordion" data-toggle="collapse" class="accordion-toggle">
							<i class="glyphicon glyphicon-time"></i> Setting Website
						</a>
					</div>
					<div class="accordion-body collapse" id="collapsetwo">
						<div class="panel-body">
							<ul class="nav nav-pills nav-stacked">
								<li><a href="ubahjam.php">Ubah Jam Result Pasaran</a></li>
								<li><a href="contentweb.php">Content Website</a></li>
							</ul>
						</div>
					</div>

			</div>

				<div class="panel panel-default">
					<div class="panel-heading">
						<a href="#tambahanggota" data-parent="#side_accordion" data-toggle="collapse" class="accordion-toggle">
							<i class="glyphicon glyphicon-user"></i> Tambah Anggota
						</a>
					</div>
					<div class="accordion-body collapse" id="tambahanggota">
						<div class="panel-body">
							<ul class="nav nav-pills nav-stacked">
								<li><a href="tambahanggota.php">Tambah Anggota Pasaran</a></li>
							</ul>
						</div>
					</div>';
					}

					?>
			
			<div class="push"></div>
		</div>

	</div>
	

	
</div>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="js/jquery-migrate.min.js"></script>
    <script src="lib/jquery-ui/jquery-ui-1.10.0.custom.min.js"></script>
    <!-- touch events for jquery ui-->
	<script src="js/forms/jquery.ui.touch-punch.min.js"></script>
    <!-- easing plugin -->
	<script src="js/jquery.easing.1.3.min.js"></script>
    <!-- smart resize event -->
	<script src="js/jquery.debouncedresize.min.js"></script>
    <!-- js cookie plugin -->
	<script src="js/jquery_cookie_min.js"></script>
    <!-- main bootstrap js -->
	<script src="bootstrap/js/bootstrap.min.js"></script>
    <!-- bootstrap plugins -->
	<script src="js/bootstrap.plugins.min.js"></script>
	<!-- typeahead -->
	<script src="lib/typeahead/typeahead.min.js"></script>
    <!-- code prettifier -->
	<script src="lib/google-code-prettify/prettify.min.js"></script>
    <!-- sticky messages -->
	<script src="lib/sticky/sticky.min.js"></script>
    <!-- tooltips -->
	<script src="lib/qtip2/jquery.qtip.min.js"></script>
    <!-- lightbox -->
	<script src="lib/colorbox/jquery.colorbox.min.js"></script>
    <!-- jBreadcrumbs -->
	<script src="lib/jBreadcrumbs/js/jquery.jBreadCrumb.1.1.min.js"></script>
	<!-- hidden elements width/height -->
	<script src="js/jquery.actual.min.js"></script>
	<!-- custom scrollbar -->
	<script src="lib/slimScroll/jquery.slimscroll.js"></script>
	<!-- fix for ios orientation change -->
	<script src="js/ios-orientationchange-fix.js"></script>
	<!-- to top -->
	<script src="lib/UItoTop/jquery.ui.totop.min.js"></script>
	<!-- mobile nav -->
	<script src="js/selectNav.js"></script>

	<!-- common functions -->
	<script src="js/gebo_common.js"></script>

    <!-- multi-column layout -->
    <script src="js/jquery.imagesloaded.min.js"></script>
    <script src="js/jquery.wookmark.js"></script>
    <!-- responsive table -->
	<script src="js/jquery.mediaTable.min.js"></script>
	<!-- small charts -->
	<script src="js/jquery.peity.min.js"></script>
	<!-- charts -->
	<script src="lib/flot/jquery.flot.min.js"></script>
    <script src="lib/flot/jquery.flot.resize.min.js"></script>
    <script src="lib/flot/jquery.flot.pie.min.js"></script>
    <!-- calendar -->
	<script src="lib/fullcalendar/fullcalendar.min.js"></script>
    <!-- sortable/filterable list -->
	<script src="lib/list_js/list.min.js"></script>
    <script src="lib/list_js/plugins/paging/list.paging.min.js"></script>
	<!-- dashboard functions -->
	<script src="js/gebo_dashboard.js"></script>
		
		
    <script>
        $(document).ready(function() {
			//* jQuery.browser.mobile (http://detectmobilebrowser.com/)
			//* jQuery.browser.mobile will be true if the browser is a mobile device
			(function(a){jQuery.browser.mobile=/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);
			//replace themeforest iframe
			if(jQuery.browser.mobile) {
				if (top !== self) top.location.href = self.location.href;
			}
        });
    </script>
		
	
		
<script>
		
	$(document).ready(function() {
    $("#strtdate").datepicker({
        dateFormat: "dd-mm-yy"
    });
    $("#strtdate").focus(function() {
        $("#strtdate").datepicker("show");
    });
		
   $("#enddate").datepicker({
        dateFormat: "dd-mm-yy"
    });
    $("#enddate").focus(function() {
        $("#enddate").datepicker("show");
    });
		
		
});	
		
	</script>
		
	

	
<!--<script type="text/javascript">

 $(document).ready(function() {
               
      $.ajax({ 
        type: "GET",
        url: "spaceship/showperiode.php",             
        dataType: "html",   //expect html to be returned                
        success: function(response){                    
            $("#display_info").html(response); 
            //alert(response);
        }

    });
});

</script> -->
<script>
function openPeriode(periodename) {
  var i;
  var x = document.getElementsByClassName("periode");
  for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";  
  }
  document.getElementById(periodename).style.display = "block";  
}

</script>
		
<script>

$(document).ready(function(){

 $('.load').click(function(){
   
   var userid = $(this).data('id');

   $.ajax({
    url: 'spaceship/common.php',
    type: 'post',
    data: {userid: userid},
    success: function(response){ 
      // Add response in Modal body
      $('.loadperiode1').html(response);

      // Display Modal
       $('#updatetheperiode').modal('show'); 
    }
  });
 });
});

</script>
		
<script>

$(document).ready(function(){

 $('.load').click(function(){
   
   var userid = $(this).data('id');

   $.ajax({
    url: 'spaceship/consolation.php',
    type: 'post',
    data: {userid: userid},
    success: function(response){ 
      // Add response in Modal body
      $('.loadperiode2').html(response);

    }
  });
 });
});

</script>
		
	

</body>
</html>
