<?php
include("../dbConnect.php");
include('session.php');

$result=mysqli_query($hookup, "SELECT COUNT(*) AS id FROM Users");
$num = mysqli_fetch_array($result);
$users = $num["id"];


$result=mysqli_query($hookup, "SELECT COUNT(*) AS id FROM Accounts");
$num = mysqli_fetch_array($result);
$accounts = $num["id"];


$result=mysqli_query($hookup, "SELECT COUNT(*) AS id FROM Users WHERE subscribed = 1");
$num = mysqli_fetch_array($result);
$subscribed = $num["id"];

$today= date('Y-m-d', strtotime("now"));
$result=mysqli_query($hookup, "SELECT COUNT(*) AS id FROM Daily_Hits WHERE login_date = '$today'");
$num = mysqli_fetch_array($result);
$unique = $num["id"];

?>

<!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.0" />
	<meta name="description" content="World Numerology Admin Panel" />
	<meta name="author" content="" />

	<title>World Numerology | Dashboard</title>


	<link rel="stylesheet" href="assets/js/jquery-ui/css/no-theme/jquery-ui-1.10.3.custom.min.css">
	<link rel="stylesheet" href="assets/css/font-icons/entypo/css/entypo.css">
	<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic">
	<link rel="stylesheet" href="assets/css/bootstrap.css">
	<link rel="stylesheet" href="assets/css/neon-core.css">
	<link rel="stylesheet" href="assets/css/neon-theme.css">
	<link rel="stylesheet" href="assets/css/neon-forms.css">
	<link rel="stylesheet" href="assets/css/custom.css">
	<link rel="stylesheet" href="assets/css/skins/white.css">

	<script src="assets/js/jquery-1.11.0.min.js"></script>

	<!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!--[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 class="page-body skin-white" data-url="http://neon.dev">

<div class="page-container"><!-- add class "sidebar-collapsed" to close sidebar by default, "chat-visible" to make chat appear always -->

	<div class="sidebar-menu">


		<header class="logo-env">

			<!-- logo -->
			<div class="logo">
				<a href="index.php">
					<img src="assets/images/logo@2x.png" width="100" alt="" />
				</a>
			</div>

						<!-- logo collapse icon -->

			<div class="sidebar-collapse">
				<a href="#" class="sidebar-collapse-icon with-animation"><!-- add class "with-animation" if you want sidebar to have animation during expanding/collapsing transition -->
					<i class="entypo-menu"></i>
				</a>
			</div>



			<!-- open/close menu icon (do not remove if you want to enable menu on mobile devices) -->
			<div class="sidebar-mobile-menu visible-xs">
				<a href="#" class="with-animation"><!-- add class "with-animation" to support animation -->
					<i class="entypo-menu"></i>
				</a>
			</div>

		</header>






		<ul id="main-menu" class="">
			<!-- add class "multiple-expanded" to allow multiple submenus to open -->
			<!-- class "auto-inherit-active-class" will automatically add "active" class for parent elements who are marked already with class "active" -->
			<!-- Search Bar -->
			<!--<li id="search">
				<form method="get" action="">
					<input type="text" name="q" class="search-input" placeholder="Search something..."/>
					<button type="submit">
						<i class="entypo-search"></i>
					</button>
				</form>
			</li>-->
			<li class="active opened active">
				<a href="index.php">
					<i class="entypo-gauge"></i>
					<span>Dashboard</span>
				</a>
			</li>
			<li>
				<a href="users.php">
				<i class="entypo-users"></i>
					<span>Users</span>
				</a>

			</li>
			<li>
				<a href="admin_extras.php">
					<i class="entypo-users"></i>
					<span>Admin Extras</span>
				</a>

			</li>
			<li>
				<a href="blog_posts.php">
					<i class="entypo-users"></i>
					<span>Blog Posts</span>
				</a>
			</li>
			<li>
				<a href="admin_links.php">
					<i class="entypo-users"></i>
					<span>Admin Links</span>
				</a>
			</li>
		</ul>

	</div>
<div class="main-content">

<div class="row">

	<!-- Profile Info and Notifications -->
	<div class="col-md-6 col-sm-8 clearfix">

		<ul class="user-info pull-left pull-none-xsm">

						<!-- Profile Info -->
			<li class="profile-info dropdown"><!-- add class "pull-right" if you want to place this from right -->


					<img src="assets/images/thumb-1@2x.png" alt="" class="img-circle" width="44" />
					Hans Decoz<br/><br/><a href="logout.php">Logout</a>
			</li>
			

		</ul>

	</div>

</div>

<hr />

<script type="text/javascript">
jQuery(document).ready(function($)
{
	// Sample Toastr Notification

        /* setTimeout(function()
	{
		var opts = {
			"closeButton": true,
			"debug": false,
			"positionClass": rtl() || public_vars.$pageContainer.hasClass('right-sidebar') ? "toast-top-left" : "toast-top-right",
			"toastClass": "black",
			"onclick": null,
			"showDuration": "300",
			"hideDuration": "1000",
			"timeOut": "5000",
			"extendedTimeOut": "1000",
			"showEasing": "swing",
			"hideEasing": "linear",
			"showMethod": "fadeIn",
			"hideMethod": "fadeOut"
		};

		toastr.success("You have been awarded with 1 year free subscription. Enjoy it!", "Account Subcription Updated", opts);
	}, 3000);
        */

	// Sparkline Charts
	$('.inlinebar').sparkline('html', {type: 'bar', barColor: '#ff6264'} );
	$('.inlinebar-2').sparkline('html', {type: 'bar', barColor: '#445982'} );
	$('.inlinebar-3').sparkline('html', {type: 'bar', barColor: '#00b19d'} );
	$('.bar').sparkline([ [1,4], [2, 3], [3, 2], [4, 1] ], { type: 'bar' });
	$('.pie').sparkline('html', {type: 'pie',borderWidth: 0, sliceColors: ['#3d4554', '#ee4749','#00b19d']});
	$('.linechart').sparkline();
	$('.pageviews').sparkline('html', {type: 'bar', height: '30px', barColor: '#ff6264'} );
	$('.uniquevisitors').sparkline('html', {type: 'bar', height: '30px', barColor: '#00b19d'} );

	// Line Charts
	var line_chart_demo = $("#line-chart-demoY");
	line_chart_demo.parent().show();

	var line_chart = Morris.Line({
		element: 'line-chart-demoY',
		data: [
			{ y: 'Jan', a: 40, b: 90 },
			{ y: 'Feb', a: 25,  b: 65 },
			{ y: 'Mar', a: 50,  b: 40 },
			{ y: 'Apr', a: 100,  b: 65 },
			{ y: 'May', a: 50,  b: 40 },
			{ y: 'Jun', a: 75,  b: 65 },
			{ y: 'Jul', a: 55,  b: 65 },
			{ y: 'Aug', a: 25,  b: 65 },
			{ y: 'Sep', a: 15,  b: 65 },
			{ y: 'Oct', a: 65,  b: 65 },
			{ y: 'Nov', a: 75,  b: 65 },
			{ y: 'Dec', a: 100, b: 90 }
		],
		xkey: 'y',
		ykeys: ['a', 'b'],
                parseTime: false,
		labels: ['Unique', 'New'],
		redraw: true
	});

	line_chart_demo.parent().attr('style', '');


        /********************************************/
       var line_chart_demoM = $("#line-chart-demoM");
	line_chart_demoM.parent().show();

	var line_chartM = Morris.Line({
		element: 'line-chart-demoM',
		data: [
			{ y: '1', a: 100, b: 90 },
			{ y: '2', a: 75,  b: 65 },
			{ y: '3', a: 50,  b: 40 },
			{ y: '4', a: 75,  b: 65 },
			{ y: '5', a: 50,  b: 40 },
			{ y: '6', a: 75,  b: 65 },
			{ y: '7', a: 100, b: 90 }
		],
		xkey: 'y',
		ykeys: ['a', 'b'],
                parseTime: false,
		labels: ['Unique', 'New'],
		redraw: true
	});

	line_chart_demoM.parent().attr('style', '');

        var line_chart_demoW = $("#line-chart-demoW");
	line_chart_demoW.parent().show();


	var line_chartW = Morris.Line({
		element: 'line-chart-demoW',
		data: [
			{ y: 'Mon', a: 40, b: 90 },
			{ y: 'Tues', a: 25,  b: 65 },
			{ y: 'Wed', a: 50,  b: 40 },
			{ y: 'Thurs', a: 100,  b: 65 },
			{ y: 'Fri', a: 50,  b: 40 },
			{ y: 'Sat', a: 75,  b: 65 },
			{ y: 'Sun', a: 55,  b: 65 }
		],
		xkey: 'y',
		ykeys: ['a', 'b'],
                parseTime: false,
		labels: ['Unique', 'New'],
		redraw: true
	});

	line_chart_demoW.parent().attr('style', '');

        /*
	$(".monthly-sales").sparkline([1,2,3,5,6,7,2,3,3,4,3,5,7,2,4,3,5,4,5,6,3,2], {
		type: 'bar',
		barColor: '#485671',
		height: '80px',
		barWidth: 10,
		barSpacing: 2
	});


	// JVector Maps
	var map = $("#map");

	map.vectorMap({
		map: 'europe_merc_en',
		zoomMin: '3',
		backgroundColor: '#383f47',
		focusOn: { x: 0.5, y: 0.8, scale: 3 }
	});





	// Donut Chart
	var donut_chart_demo = $("#donut-chart-demo");

	donut_chart_demo.parent().show();

	var donut_chart = Morris.Donut({
		element: 'donut-chart-demo',
		data: [
			{label: "Download Sales", value: getRandomInt(10,50)},
			{label: "In-Store Sales", value: getRandomInt(10,50)},
			{label: "Mail-Order Sales", value: getRandomInt(10,50)}
		],
		colors: ['#707f9b', '#455064', '#242d3c']
	});

	donut_chart_demo.parent().attr('style', '');


	// Area Chart
	var area_chart_demo = $("#area-chart-demo");

	area_chart_demo.parent().show();

	var area_chart = Morris.Area({
		element: 'area-chart-demo',
		data: [
			{ y: '2006', a: 100, b: 90 },
			{ y: '2007', a: 75,  b: 65 },
			{ y: '2008', a: 50,  b: 40 },
			{ y: '2009', a: 75,  b: 65 },
			{ y: '2010', a: 50,  b: 40 },
			{ y: '2011', a: 75,  b: 65 },
			{ y: '2012', a: 100, b: 90 }
		],
		xkey: 'y',
		ykeys: ['a', 'b'],
		labels: ['Series A', 'Series B'],
		lineColors: ['#303641', '#576277']
	});

	area_chart_demo.parent().attr('style', '');

*/


	// Rickshaw
	/*var seriesData = [ [], [] ];

	var random = new Rickshaw.Fixtures.RandomData(50);

	for (var i = 0; i < 50; i++)
	{
		random.addData(seriesData);
	}

	var graph = new Rickshaw.Graph( {
		element: document.getElementById("rickshaw-chart-demo"),
		height: 193,
		renderer: 'area',
		stroke: false,
		preserve: true,
		series: [{
				color: '#73c8ff',
				data: seriesData[0],
				name: 'Upload'
			}, {
				color: '#e0f2ff',
				data: seriesData[1],
				name: 'Download'
			}
		]
	} );

	graph.render();

	var hoverDetail = new Rickshaw.Graph.HoverDetail( {
		graph: graph,
		xFormatter: function(x) {
			return new Date(x * 1000).toString();
		}
	} );

	var legend = new Rickshaw.Graph.Legend( {
		graph: graph,
		element: document.getElementById('rickshaw-legend')
	} );

	var highlighter = new Rickshaw.Graph.Behavior.Series.Highlight( {
		graph: graph,
		legend: legend
	} );

	setInterval( function() {
		random.removeData(seriesData);
		random.addData(seriesData);
		graph.update();

	}, 500 );
        */
});


function getRandomInt(min, max)
{
	return Math.floor(Math.random() * (max - min + 1)) + min;
}
</script>


<div class="row">
	<div class="col-sm-3">

		<div class="tile-stats tile-red">
			<div class="icon"><i class="entypo-users"></i></div>
			<div class="num" data-start="0" data-end=<?php echo $accounts ?> data-postfix="" data-duration="1500" data-delay="0">0</div>

			<h3>Registered Accounts</h3>
			<p>Total Unique Accounts</p>
		</div>

	</div>

	<div class="col-sm-3">

		<div class="tile-stats tile-green">
			<div class="icon"><i class="entypo-chart-bar"></i></div>
			<div class="num" data-start="0" data-end=<?php echo $users ?> data-postfix="" data-duration="1500" data-delay="600">0</div>

			<h3>Registered Users</h3>
			<p>Total Unique Users</p>
		</div>

	</div>

	<div class="col-sm-3">

		<div class="tile-stats tile-aqua">
			<div class="icon"><i class="entypo-mail"></i></div>
			<div class="num" data-start="0" data-end=<?php echo $unique ?> data-postfix="" data-duration="1500" data-delay="1200">0</div>

			<h3>Unique Hits</h3>
			<p>Total Unique App Views for Today</p>
		</div>

	</div>

	<div class="col-sm-3">

		<div class="tile-stats tile-blue">
			<div class="icon"><i class="entypo-rss"></i></div>
			<div class="num" data-start="0" data-end=<?php echo $subscribed ?> data-postfix="" data-duration="1500" data-delay="1800">0</div>

			<h3>Subscribers</h3>
			<p>Total Active Subscribers</p>
		</div>

	</div>
</div>

<br />
<div class="row">
	<div class="col-sm-8">

		<div class="panel panel-primary" id="charts_env">

			<div class="panel-heading">
				<div class="panel-title">App Stats</div>

				<div class="panel-options">
					<ul class="nav nav-tabs">
						<li class=""><a href="#line-chart_YR" data-toggle="tab">Year</a></li>
						<li class="active"><a href="#line-chart_MY" data-toggle="tab">Month</a></li>
						<li class=""><a href="#line-chart_WK" data-toggle="tab">Week</a></li>
					</ul>
				</div>
			</div>

			<div class="panel-body">

				<div class="tab-content">

					<div class="tab-pane" id="line-chart_YR">
						<div id="line-chart-demoY" class="morrischart" style="height: 300px"></div>
					</div>

					<div class="tab-pane active" id="line-chart_MY">
						<div id="line-chart-demoM" class="morrischart" style="height: 300px"></div>
					</div>

					<div class="tab-pane" id="line-chart_WK">
						<div id="line-chart-demoW" class="morrischart" style="height: 300px;"></div>
					</div>

				</div>

			</div>

			<table class="table table-bordered table-responsive">

				<thead>
					<tr>
						<th width="50%" class="col-padding-1">
							<div class="pull-left">
								<div class="h4 no-margin">Pageviews</div>
								<small>54,127</small>
							</div>
							<span class="pull-right pageviews">4,3,5,4,5,6,5</span>

						</th>
						<th width="50%" class="col-padding-1">
							<div class="pull-left">
								<div class="h4 no-margin">Unique Visitors</div>
								<small>25,127</small>
							</div>
							<span class="pull-right uniquevisitors">2,3,5,4,3,4,5</span>
						</th>
					</tr>
				</thead>

			</table>

		</div>

		<footer class="main">
			&copy; 2014 <strong>World Numerology</strong>
		</footer>	
	</div>
	





	<link rel="stylesheet" href="assets/js/jvectormap/jquery-jvectormap-1.2.2.css">
	<link rel="stylesheet" href="assets/js/rickshaw/rickshaw.min.css">

	<!-- Bottom Scripts -->
	<script src="assets/js/gsap/main-gsap.js"></script>
	<script src="assets/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js"></script>
	<script src="assets/js/bootstrap.js"></script>
	<script src="assets/js/joinable.js"></script>
	<script src="assets/js/resizeable.js"></script>
	<script src="assets/js/neon-api.js"></script>
	<script src="assets/js/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
	<script src="assets/js/jvectormap/jquery-jvectormap-europe-merc-en.js"></script>
	<script src="assets/js/jquery.sparkline.min.js"></script>
	<script src="assets/js/rickshaw/vendor/d3.v3.js"></script>
	<script src="assets/js/rickshaw/rickshaw.min.js"></script>
	<script src="assets/js/raphael-min.js"></script>
	<script src="assets/js/morris.min.js"></script>
	<script src="assets/js/toastr.js"></script>
	<script src="assets/js/neon-chat.js"></script>
	<script src="assets/js/neon-custom.js"></script>
	<script src="assets/js/neon-demo.js"></script>

</body>
</html>