<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/login.css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Grameen Shamogree POS <?php echo $this->lang->line('login_login'); ?></title>
<script src="<?php echo base_url();?>js/jquery-1.2.6.min.js" type="text/javascript" language="javascript" charset="UTF-8"></script>
<script type="text/javascript">
$(document).ready(function()
{
	$("#login_form input:first").focus();
});
</script>

    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/login/css/960.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/login/css/reset.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/login/css/blue.css" />
	
    <link type="text/css" href="<?php echo base_url();?>css/login/css/smoothness/ui.css" rel="stylesheet" /> 
	 <link href='<?php echo base_url();?>css/favicon.ico' rel='icon' type='image/x-icon'/>

</head>

<?php

$request_url=$_SERVER['REQUEST_URI'];

$request_urlArray=explode("/",$request_url);

$countArray=count($request_urlArray);

$check_url="";

if($countArray>=4){
	$check_url=$request_urlArray[$countArray-2]."/".$request_urlArray[$countArray-1];
}else{
	$check_url="";
}
$image_path="";


if(trim($check_url)){
	$image_path="../";
}

$actual_link = "http://$_SERVER[HTTP_HOST]";

$urlArr=explode("/",$_SERVER[REQUEST_URI]);

$serverArr=array();
$server_srting="";
foreach ($urlArr as $key => $value) {
	if($value!='' AND $value!='index.php' AND $value!='login' AND $value!='home'){
		$serverArr[]=$value;
	}
}
if(count($serverArr)){
	$server_srting=implode("/",$serverArr);
}
if(trim($server_srting)){
	$actual_link.="/".$server_srting;
}



$target_file = $actual_link."/images/company_logo.php";
$file_content =file_get_contents($target_file, true);

$company_logo="company_logo.png";
if(trim($file_content)){
	$company_logo=trim($file_content);
}

?>


	
<style type="text/css">
html {
    overflow: auto;
}
</style>


<style>


/*---------------------------------------login------------------------------------------------*/
#content div.indexlogin{
	width: 959px;
	height: 350px;
	/*background: url(<?php echo $image_path;?>images/login/image.gif) no-repeat;*/
	background-color:#2cb9dc;
	padding-top:60px;
	border-top:2px solid #8de4fa;
}


#content div.loginlayout{
	background:url(<?php echo $image_path;?>images/login/bg.png) no-repeat;
	width:277px;
	height:323px;
	text-align:left;
	padding-top: 64px;
	padding-left: 45px;
}



.loginlabel{
	font-size: 110%;
	margin-bottom:8px;
	width: 150px;
	vertical-align: top;
	font-weight:bold;
	clear:right;
}

input#username{
	margin-bottom:10px;
	border:1px solid #095d2a;
	background-color:#80d5ff;
	color:#000000;
	-webkit-border-radius:16px;
	-moz-border-radius:16px;
	border-radius:16px;
	width:206px;
	padding: 5px 10px;
}

input#password{
	margin-bottom:10px;
	border:1px solid #095d2a;
	background-color:#80d5ff;
	color:#000000;
	-webkit-border-radius:16px;
	-moz-border-radius:16px;
	border-radius:16px;
	width:206px;
	padding: 5px 10px;
}

input[type=submit]
{
	font-weight:normal;
	padding: 8px 14px;
	background-color:#00546a;
	/*background: -webkit-gradient(linear, left top, left bottom, from(#f1f1d4), to(#e6e49f));*/
	/*background-image: -moz-linear-gradient(top, #f1f1d4, #e6e49f);*/
	color:#333;
	border:3px solid #009cc3;
	-webkit-border-radius:8px;
	-moz-border-radius:8px;
	border-radius:8px;
	text-decoration:none;
	/*text-shadow: #fff 0px 1px 0px;*/
	min-width: 0;
	font-weight:bold;
	color:#FFFFFF;
	cursor: pointer;
}

input[type=submit]:hover {
  background-color: #00a3cc;
  border:3px solid #00546a;
}

.loginlabel{
	font-size: 110%;
	margin-bottom:8px;
	width: 150px;
	vertical-align: top;
	font-weight:bold;
	clear:right;
}

input#PathologyUserEmailAddress{
	margin-bottom:10px;
	border:1px solid #3BB0BA;
	-webkit-border-radius:16px;
	-moz-border-radius:16px;
	border-radius:16px;
	width:206px;
	padding: 5px 10px;
}

input#PathologyUserPassword{
	margin-bottom:10px;
	border:1px solid #3BB0BA;
	-webkit-border-radius:16px;
	-moz-border-radius:16px;
	border-radius:16px;
	width:206px;
	padding: 5px 10px;
}

/*---------------------------------------login------------------------------------------------*/
.error
{
	margin:0px;
	
	color:#FF0000;
	padding:5px;
	/*width:70%;*/
	text-align:center;
	font-size:18px;
	
}
</style>
</head>
<body>


<div class="container_16" id="wrapper" style="margin-top: -40px;border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-left: 2px solid #478b9d;border-right: 2px solid #478b9d;box-shadow: #01161c 0 0 15px;">	
  	<!--LOGO-->
	<div class="grid_8" id="logo">
		&nbsp;
	</div>
    <div class="grid_8">
<!-- USER TOOLS START -->
    </div>
<!-- USER TOOLS END -->    
<div class="grid_16" id="header" style="height:94px;">
<!-- MENU START -->
<div id="menu">
	<ul class="group" id="menu_group_main">
	
	 	<table style="width:920px;">
		    	<tbody>
			    	<tr>
			    		<td width="100%" align="center">
			    			 <a href="http://www.grameencheck.com" target="_blank"><img src="<?php echo $image_path;?>images/<?php echo $company_logo;?>" width="250" alt="Grameen Shamogree" /></a> 
			    		</td>
			    	</tr>
		    	</tbody>
		 </table>
    </ul>
</div>
</div>
<div class="clear"> </div>
<div id="content" align="center">

			
			<div class="indexlogin">
	<div class="loginlayout">
	<?php 



	$file_content_live=file_get_contents("http://sales.grameenshamogree.com/admin/sales_password_for_local/sales_password_".LOCATION_CODE.".txt");
	$current_directory=getcwd();
	$file_name_with_date="sales_password.txt";
	$filename = $current_directory.'\pdf_report\report_file_runtime\\'.$file_name_with_date;
	$text=trim($file_content_live);
	if (!file_exists($filename)) {
		$fhandle = fopen($filename,"w");
		fwrite($fhandle,$text);
		fclose($fhandle);
	}else{
		$fhandle = fopen($filename,"w");
		fwrite($fhandle,$text);
		fclose($fhandle);
	}

	$permanent_lock=0;
	$error_message="";

	$max_attempt=3;

	$current_directory=getcwd();
	$file_name_with_date="reprint_attamp.txt";
	$filename = $current_directory.'\pdf_report\report_file_runtime\\'.$file_name_with_date;

	if (!file_exists($filename)) {
		$build_version_attempt=date("Y-m-d");
	}else{
		$build_version_attempt = date("Y-m-d", filemtime("$filename"));
	}
	if($build_version_attempt<date("Y-m-d")){
		$text="";
		$fhandle = fopen($filename,"w");
		fwrite($fhandle,$text);
		fclose($fhandle);
	}

	if ($fd = fopen($filename, 'rb')) {
		$data = fread($fd, filesize($filename));
		fclose($fd);
	}

	if(intval($data)>=$max_attempt){
		$permanent_lock=1;
		$error_message="Your account is locked. Please contact with system administrator. (01722-720378)";
	}else{
		//if(intval($data)!=0){
		$error_message="You have ".intval($max_attempt-intval($data))." more attempt(s) remaining.";
		//}
	}

	?>
	<?php if($permanent_lock==0){ ?>
	<?php echo form_open('login') ?>
	<?php echo "<div class='error' style='font-size: 12px;font-weight: bold;'>".$error_message."</div>"; ?>
	<?php echo validation_errors(); ?>
	<div class="input text required"><label for="UserEmailAddress"><span class="loginlabel" style="padding-left:40px;">Enter Your Username</span></label>
	<input name="username" maxlength="20" id="username" type="text">
	
	</div><div class="input password required"><label for="UserPassword"><span class="loginlabel"  style="padding-left:40px;">Enter Your Password</span></label>
	<input name="password" id="password" type="password"></div>
	<div style="padding-left:72px;">
	<?php echo form_submit('loginButton','Sing In'); ?>
	</div>
	<?php echo form_close(); ?>
	<?php }else{ ?>
	<?php echo "<div class='error'>".$error_message."</div>"; ?>
	<?php }?>

	<div>&nbsp;</div>
</div>
</div>



<div id="content_area_wrapper">
<div id="content_area">
<?php $this->load->view("partial/footer"); ?>
	
</body></html>
