<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

ob_start();ob_flush();
error_reporting(1);
session_start();

 if(!empty($_SESSION["UserId"]) && $_SESSION["UserId"]!='' && $_REQUEST['err']!='ses'){
	header("location:dashboard.php");
	exit();
 }

?>
<!DOCTYPE html>
<html> 
<head>
<?php 
extract($_POST);
$error="";
if(isset($_REQUEST['err'])) {
	$err=$_REQUEST['err'];
	
	if($err=="invup"){
		$error = '<div class="alert alert-danger alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Invalid Username/Password!  </div>';
	}
	else if($err=="invu"){
		$error = '<div class="alert alert-danger alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Invalid Username!  </div>';
	}
	else if($err=="lo"){
		$error = '<div class="alert alert-success alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> You have Successfully logged out !  </div>';
	}
	else if($err=="invp"){
		$error = '<div class="alert alert-danger alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Invalid Password!  </div>';
	}
	else if($err=="ac"){
		$error = '<div class="alert alert-info alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Not Activated Your account!  </div>';
	}
	else if($err=="ses"){
		$error = '<div class="alert alert-info alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Session Time Out! Please ReLogin. </div>';
	}
	else if($err=="rstpwdsucc"){
		$error = '<div class="alert alert-success alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Your Password Reset Successfully!  </div>';
	}
	else if($err=="rstpwdfail"){
		$error = '<div class="alert alert-info alert-dismissable"> <button class="close" aria-hidden="true" data-dismiss="alert" type="button">X</button> Your Password Reset Not to be Done Please Try Again! </div>';
	}
	else{
		$error="";
	}	
}
?>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <meta name="description" content="Billing App - Admin Panel">
        <meta name="author" content="WIT Billing App">

        <!-- App Favicon 
        <link rel="shortcut icon" href="images/favicon.png">-->

        <title>SRI SARASWATHI SILKS | Admin Panel</title>

         <!-- App CSS -->
        <link href="assets/css/style.css" rel="stylesheet" type="text/css" />

        <!-- HTML5 Shiv and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[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]-->

        <script src="assets/js/modernizr.min.js"></script>
		
    </head>
    <body>

        <div class="account-pages"></div>
        <div class="clearfix"></div>
        <div class="wrapper-page">

        	<div class="account-bg">
                <div class="card-box m-b-0">
                    <div class="text-xs-center m-t-20">
                        <a href="javascript:;" class="logo">
                           <!--<span>Uplon</span>-->
							<img src="images/logo.png" alt="logo" class="img-responsive" style="width:190px;" />
                        </a>
                    </div>
                    <div class="m-t-30 m-b-20">
                        <div class="col-xs-12 text-xs-center">
                            <h6 class="text-muted text-uppercase m-b-0 m-t-0">Sign In</h6>
                        </div>
                        <form class="form-horizontal m-t-20" id="jvalidate" action="dashboard.php" method="post" >
							<div class="form-group">
								<div class="col-xs-12">
									<?php if($error != '' && !empty($error)) { 
										echo $error;
									}
									?>										
								</div>
							</div>
					
                            <div class="form-group ">
                                <div class="col-xs-12">
                                    <input name="username" id="username" class="form-control" type="text" required="" placeholder="Username">
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-xs-12">
                                    <input name="password" id="password" class="form-control" type="password" required="" placeholder="Password">
                                </div>
                            </div>

                            <div class="form-group ">
                                <div class="col-xs-12">
                                    <div class="checkbox checkbox-custom">
                                        <input id="checkbox-signup" type="checkbox">
                                        <label for="checkbox-signup">
                                            Remember me
                                        </label>
                                    </div>

                                </div>
                            </div>

                            <div class="form-group text-center m-t-30">
                                <div class="col-xs-12">
									<input type="hidden" name="submt" id="submt" value="login" /> 
                                    <button class="btn btn-success btn-block waves-effect waves-light" type="submit">Log In</button>
                                </div>
                            </div>

                            <div class="form-group m-t-30 m-b-0">
                                <div class="col-sm-12">
                                    <a href="pages-recoverpw.html" class="text-muted"><i class="fa fa-lock m-r-5"></i> Forgot your password?</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <!-- end card-box-->

        </div>
        <!-- end wrapper page -->


        <script>
            var resizefunc = [];
        </script>

        <!-- jQuery  -->
        <!-- jQuery  -->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/tether.min.js"></script><!-- Tether for Bootstrap -->
        <script src="assets/js/bootstrap.min.js"></script>
        <script src="assets/js/waves.js"></script>
        <script src="assets/js/jquery.nicescroll.js"></script>
        <script src="assets/plugins/switchery/switchery.min.js"></script>

        <!-- App js -->
        <script src="assets/js/jquery.core.js"></script>
        <script src="assets/js/jquery.app.js"></script>

    </body>
	
</html>