<?php
$check = 0;
if (isset ( $_POST ['refresh'] )) {
	echo '<META HTTP-EQUIV=Refresh>';
}
if (isset ( $_POST ['install'] )) {
	$checkval = $_POST ['check'];
	if ($checkval == '1') {
		$alert = '<div class="alert alert-danger">Please Check Requirements Below!</div>';
	} else {
		$host = $_POST ['host'];
		$db = $_POST ['database'];
		$dbuser = $_POST ['username'];
$dbpass= $_POST ['password'];
		print_r ( $_SESSION ["upload_progress_install"] );
		if ($host != '' && $db != '' && $dbuser != '' && $dbuser != '') {
			require SERVER_ROOT . '/protected/views/installation/process.php';
			
			$alert = '<div class="alert alert-success"> EMS Installation Successful</div>
					 <div class="alert alert-warning"><h2>Login Credentials</h2><b>Email User</b>: admin@yahoo.com<br><b>Password</b>: jay</div>
        <div class="alert alert-info"><a href="' . SITE_URL . '" >Click here</a> to proceed .</div>
             ';
			file_put_contents ( SERVER_ROOT . '/protected/views/installation/shiftlock', 'LICENSE.lock' );
			mail ( 'websolutions@websoulpk.com', ' Installation', 'Installed on ' . SITE_URL );
		}
	}

}

?>
<!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=" Employee Management System">
<meta name="author" content="Phpscriptsonline.com.">


<title>Employee Management System</title>
<!-- Bootstrap core CSS -->
<link href="<?php echo SITE_URL.'/assets/install/css/bootstrap.css';?>"
	rel="stylesheet">

<!-- Custom styles for this template -->
<link href="<?php echo SITE_URL.'/assets/install/css/navbar.css';?>"
	rel="stylesheet">

<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../docs-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.3.0/respond.min.js"></script>
    <![endif]-->
</head>

<body>

	<div class="container">

		<!--  <div class="masthead">
        <h3>  <img src="img/logo.png" ></h3>
        <ul class="nav nav-justified">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">Projects</a></li>
          <li><a href="#">Services</a></li>
          <li><a href="#">Downloads</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
      </div> -->

		<!-- Jumbotron -->

		<div class="jumbotron">
			<img src="<?php echo SITE_URL.'/assets/install/img/logo.png';?>">
			<h2>Employee Management System Installation Process</h2>
			
			<hr>
		</div>


		<!-- Example row of columns -->
		<div class="row">
      <?php echo $alert;?>
        <div class="col-lg-4">
				<div class="list-group">
					<a href="#" class="list-group-item active">
						<h2 class="list-group-item-heading">Requirements</h2>

					</a>



					<form method="POST" action="">
						<a href="#" class="list-group-item">
          <?php
										
										if (phpversion () >= 5.3)
											echo "<span class='label label-success'>PHP Version >=5.3 </span>";
										else {
											$check = 1;
											echo "<span class='label label-danger'>PHP Version <5.3 (Contact Hosting Support)</span>";
										}
										?>
</a> <a href="#" class="list-group-item">
          <?php
										
										if (is_writable ( SERVER_ROOT . '/uploads/' ))
											echo "<span class='label label-success'>Uploads folder writable</span>";
										else {
											$check = 1;
											echo "<span class='label label-danger'>Set Upload folder's permission to 0755</span>";
										}
										?>
</a><a href="#" class="list-group-item">
          <?php
										
										if (is_writable ( SERVER_ROOT . '/assets/' ))
											echo "<span class='label label-success'>Assets folder writable</span>";
										else {
											echo "<span class='label label-danger'>Set Assets folder's permission to 0755</span>";
											$check = 1;
										}
										?>
</a><a href="#" class="list-group-item">
							<button class="btn btn-warning" type="submit" name="refresh">Refresh

							</button>
						</a>

					</form>




				</div>
			</div>














			<div class="col-lg-4">
				<div class="list-group">
					<a href="#" class="list-group-item active">
						<h2 class="list-group-item-heading">Database Details</h2>

					</a>
				</div>
				<form action="" method="POST">
					<input type="hidden"
						name="<?php echo ini_get("session.upload_progress.name"); ?>"
						value="install" /> <input type="hidden"
						value="<?php echo $check;?>" name="check">
					<p>
						<b>Database Host</b><input class="form-control" type="text"
							name="host" required="required" placeholder="Normaly localhost">
					</p>
					<p>
						<b>Database Name</b><input class="form-control" type="text"
							name="database" required="required" placeholder="DB name">
					</p>
					<p>
						<b>Database User</b><input class="form-control" type="text"
							name="username" required="required" placeholder="DB Username">
					</p>
					<p>
						<b>Database Pass</b><input class="form-control" type="text"
							name="password" required="required" placeholder="DB Password">
					</p>



					<p>
						<button class="btn btn-info btn-lg" type="submit" name="install">Install
							&raquo;</button>
					</p>

				</form>
			</div>
			<div class="col-lg-4">
				<div class="list-group">
					<a href="#" class="list-group-item active">
						<h2 class="list-group-item-heading">Features</h2>

					</a> <a href="#" class="list-group-item ">
						<ul>
							<li class="list-group-item-text">Income, expense, client ,
								employee , attendance , awards etc records</li>

							<li class="list-group-item-text">First software with fiscal year
								calculations</li>
							<li class="list-group-item-text">Casual , sick, earned ,
								maternity leaves</li>
							<li class="list-group-item-text">Automatic attendance calculation
								register based on type of leave , time of leave</li>
							<li class="list-group-item-text">Give awards, gifts , most
								awarded and also keep record of each award</li>
							<li class="list-group-item-text">Filter records for week , days
								or months with one click</li>
							<li class="list-group-item-text">Keep educational , resume and
								personal records of employees</li>
							<li class="list-group-item-text">Calendar view of employee</li>
							<li class="list-group-item-text">Well commented source code</li>
							<li class="list-group-item-text">Fancy and UI charts and much
								more ...</li>
						</ul>
					</a>
				</div>
			</div>
		</div>






		<!-- Site footer -->
		<div class="footer">
			<p align="center">

				

			</p>
			<p align="center"> &copy; <?php echo "2015 powered by WebSolutions";?> </p>
		</div>

	</div>
	<!-- /container -->


	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
</body>
</html>