0% found this document useful (0 votes)
4 views15 pages

Mega0304 Game Login Page

This document is an HTML login page for the 'mega0304 game' that includes a form for user login and guest access options. It features a responsive design with CSS styling, JavaScript for handling login attempts, session management, and error/success messages. The page also records login attempts and provides a link to view login logs.

Uploaded by

yusant0304
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views15 pages

Mega0304 Game Login Page

This document is an HTML login page for the 'mega0304 game' that includes a form for user login and guest access options. It features a responsive design with CSS styling, JavaScript for handling login attempts, session management, and error/success messages. The page also records login attempts and provides a link to view login logs.

Uploaded by

yusant0304
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - mega0304 game</title>
<style>
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}

.login-container {
background: rgba(255, 255, 255, 0.95);
padding: 40px;
border-radius: 15px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 400px;
text-align: center;
}

.login-header {
margin-bottom: 30px;
}

.login-header h1 {
color: #333;
margin: 0;
font-size: 2.5em;
}

.login-header p {
color: #666;
margin: 10px 0 0 0;
}

.form-group {
margin-bottom: 20px;
text-align: left;
}

.form-group label {
display: block;
margin-bottom: 8px;
color: #333;
font-weight: bold;
}

.form-group input {
width: 100%;
padding: 15px;
border: 2px solid #ddd;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.3s ease;
box-sizing: border-box;
}

.form-group input:focus {
outline: none;
border-color: #667eea;
}

.login-btn {
width: 100%;
padding: 15px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s ease;
margin-bottom: 15px;
}

.login-btn:hover {
transform: translateY(-2px);
}

.guest-btn {
width: 100%;
padding: 12px;
background: linear-gradient(135deg, #2ed573 0%, #17c0eb 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s ease;
margin-bottom: 10px;
}

.guest-btn:hover {
transform: translateY(-2px);
}

.divider {
text-align: center;
margin: 20px 0;
color: #666;
position: relative;
}

.divider::before {
content: '';
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 1px;
background: #ddd;
}

.divider span {
background: rgba(255, 255, 255, 0.95);
padding: 0 15px;
}

.error-message {
background: #ff4757;
color: white;
padding: 10px;
border-radius: 5px;
margin-bottom: 20px;
display: none;
}

.success-message {
background: #2ed573;
color: white;
padding: 10px;
border-radius: 5px;
margin-bottom: 20px;
display: none;
}

.info-box {
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 8px;
padding: 15px;
margin: 20px 0;
text-align: left;
}

.info-box h4 {
margin: 0 0 10px 0;
color: #333;
}
.info-box ul {
margin: 0;
padding-left: 20px;
color: #666;
font-size: 14px;
}

.info-box ul li {
margin: 5px 0;
}

.log-link {
position: fixed;
top: 10px;
right: 10px;
background: rgba(255, 255, 255, 0.9);
color: #333;
padding: 5px 10px;
border-radius: 5px;
text-decoration: none;
font-size: 12px;
border: 1px solid #ddd;
}

.log-link:hover {
background: white;
}

@media (max-width: 480px) {


.login-container {
margin: 20px;
padding: 30px 20px;
}

.login-header h1 {
font-size: 2em;
}
}
</style>
</head>
<body>
<!-- Link to view login logs -->
<a href="[Link]
class="log-link">View Login Logs</a>

<div class="login-container">
<div class="login-header">
<h1>Welcome</h1>
<p>Akses [Link]</p>
</div>

<div id="error-message" class="error-message">


Username atau password salah!
</div>

<div id="success-message" class="success-message">


Login berhasil! Mengalihkan...
</div>

<div class="info-box">
<h4>Pilih Mode Akses:</h4>
<ul>
<li><strong>Login:</strong> Akses penuh selama 1 jam</li>
<li><strong>Guest:</strong> Akses terbatas 10 menit</li>
</ul>
</div>

<form id="loginForm">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username"
placeholder="Masukkan username">
</div>

<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password"
placeholder="Masukkan password">
</div>
<button type="submit" class="login-btn">Login (1 Jam
Access)</button>
</form>

<div class="divider">
<span>atau</span>
</div>

<button type="button" class="guest-btn"


onclick="continueAsGuest()">
Continue as Guest (10 Menit)
</button>

<p style="font-size: 12px; color: #999; margin-top: 20px;">


Mode Guest: Akses terbatas ke [Link] saja
</p>
</div>

<script>
// Data login yang valid (hardcoded - paling reliable)
const validCredentials = [
{
username: "Alya",
password: "712"
},
{
username: "orang ganteng",
password: "gksigma"
}
];

// Timer settings
const LOGIN_SESSION_TIME = 60 * 60 * 1000; // 1 jam
const GUEST_SESSION_TIME = 10 * 60 * 1000; // 10 menit

// ENHANCED LOGGING FUNCTIONS WITH GOOGLE SHEETS SUPPORT


function recordLoginAttempt(username, status, userAgent = '',
ipInfo = '') {
const logs = [Link]([Link]('loginLogs') ||
'[]');
const logEntry = {
id: [Link]() + [Link](),
username: username || '[empty]',
status: status, // 'sukses', 'gagal', 'guest'
timestamp: new Date().toISOString(),
time: new Date().toLocaleString('id-ID'),
userAgent: [Link],
url: [Link],
sessionData: status === 'sukses' ? {
sessionType: 'logged',
sessionDuration: '1 hour'
} : status === 'guest' ? {
sessionType: 'guest',
sessionDuration: '10 minutes'
} : null
};

[Link](logEntry);

// Keep only last 100 logs to prevent storage overflow


if ([Link] > 100) {
[Link](0, [Link] - 100);
}

[Link]('loginLogs', [Link](logs));
[Link]('Login attempt recorded:', logEntry);

// SEND TO GOOGLE SHEETS


sendLogToGoogleSheets(logEntry);
}

// Function to send logs to Google Sheets via Google Apps Script


function sendLogToGoogleSheets(logData) {
// Disable Google Sheets logging for now due to Apps Script
issues
[Link]('Google Sheets logging disabled. Log data:',
logData);
return;
/*
const GOOGLE_SHEETS_URL =
'[Link]
_U8CxzGpvLo8WoY8yHgTRrk5Rqf4g6tKGN/exec';

const formData = new FormData();


[Link]('timestamp', [Link]);
[Link]('time', [Link]);
[Link]('username', [Link]);
[Link]('status', [Link]);
[Link]('userAgent', [Link]);
[Link]('url', [Link]);
[Link]('sessionData',
[Link]([Link] || {}));

fetch(GOOGLE_SHEETS_URL, {
method: 'POST',
body: formData
})
.then(response => [Link]())
.then(result => {
[Link]('Log sent to Google Sheets:', result);
})
.catch(error => {
[Link]('Error sending log to Google Sheets:', error);
});
*/
}

// Function to get user's approximate location (optional)


function getLocationInfo() {
return new Promise((resolve) => {
if ([Link]) {
[Link](
(position) => {
resolve({
latitude: [Link],
longitude: [Link],
accuracy: [Link]
});
},
() => resolve(null), // Fail silently
{ timeout: 5000, enableHighAccuracy: false }
);
} else {
resolve(null);
}
});
}

// Handle form submit untuk login


[Link]('loginForm').addEventListener('submit',
function(e) {
[Link]();

const username =
[Link]('username').[Link]();
const password =
[Link]('password').[Link]();
const errorMessage = [Link]('error-message');
const successMessage =
[Link]('success-message');

// Reset messages
[Link] = 'none';
[Link] = 'none';

// Debug: tampilkan credentials yang sedang digunakan


[Link]('Checking login with credentials:',
validCredentials);
[Link]('Input username:', username);
[Link]('Input password:', password);

// Record attempt regardless of validity


let isValidLogin = false;
let currentUser = "";

// Check credentials
for (let i = 0; i < [Link]; i++) {
if (username === validCredentials[i].username && password
=== validCredentials[i].password) {
isValidLogin = true;
currentUser = username;
[Link]('Login match found for:', username);
break;
}
}

if (isValidLogin) {
// Login berhasil
recordLoginAttempt(username, 'sukses');

[Link] = `Login berhasil! Selamat


datang ${currentUser}`;
[Link] = 'block';

// Set session dengan timer 1 jam


const currentTime = new Date().getTime();
[Link]('isLoggedIn', 'true');
[Link]('currentUser', currentUser);
[Link]('sessionStartTime',
[Link]());
[Link]('sessionType', 'logged');

// Redirect ke [Link] setelah 2 detik


setTimeout(function() {
[Link] = '[Link]';
}, 2000);

} else {
// Login gagal - TETAP REKAM
[Link]('Login failed for:', username);
recordLoginAttempt(username, 'gagal');

[Link] = `Login gagal untuk username:


"${username}"`;
[Link] = 'block';

// Shake animation untuk error


[Link]('.login-container').[Link]
= 'shake 0.5s ease-in-out';
setTimeout(function() {

[Link]('.login-container').[Link] = '';
}, 500);

// Clear password field only


[Link]('password').value = '';
}
});

// Fungsi continue as guest


function continueAsGuest() {
const currentTime = new Date().getTime();

// Record guest session


recordLoginAttempt('GUEST_USER', 'guest');

// Set guest session


[Link]('isLoggedIn', 'false');
[Link]('currentUser', 'Guest');
[Link]('sessionStartTime',
[Link]());
[Link]('sessionType', 'guest');

// Show success message


const successMessage =
[Link]('success-message');
[Link] = 'Melanjutkan sebagai Guest (10
menit akses)';
[Link] = 'block';

// Redirect setelah 1.5 detik


setTimeout(function() {
[Link] = '[Link]';
}, 1500);
}

// Check jika sudah ada session


function checkExistingSession() {
const sessionStartTime =
parseInt([Link]('sessionStartTime') || '0');
const sessionType = [Link]('sessionType');
const currentTime = new Date().getTime();

if (sessionStartTime && sessionType) {


const maxTime = sessionType === 'logged' ?
LOGIN_SESSION_TIME : GUEST_SESSION_TIME;
const timeElapsed = currentTime - sessionStartTime;

if (timeElapsed < maxTime) {


// Session masih valid
const isLoggedIn = [Link]('isLoggedIn')
=== 'true';
const currentUser =
[Link]('currentUser');
const remainingMinutes = [Link]((maxTime -
timeElapsed) / (60 * 1000));

if (isLoggedIn) {
showWelcomeBack(`${currentUser}
(${remainingMinutes} menit tersisa)`, 'logged');
} else {
showWelcomeBack(`Guest (${remainingMinutes} menit
tersisa)`, 'guest');
}
return true;
}
}
return false;
}

// Fungsi show welcome back


function showWelcomeBack(userInfo, sessionType) {
[Link]('.login-container').innerHTML = `
<div class="login-header">
<h1>Welcome Back!</h1>
<p>${userInfo}</p>
</div>
<div style="display: flex; flex-direction: column; gap:
15px;">
<button type="button" class="login-btn"
onclick="[Link]='[Link]'">
Continue to Home
</button>

${sessionType === 'guest' ? `


<button type="button" class="guest-btn"
onclick="[Link]()">
Upgrade to Full Login
</button>
` : ''}

<button type="button" onclick="logout()"


style="background: #ff4757; color: white; border: none; padding: 12px;
border-radius: 8px; cursor: pointer;">
Start New Session
</button>
</div>
`;
}

// Fungsi logout
function logout() {
[Link]();
[Link]();
}

// Check existing session saat page load


checkExistingSession();

// Shake animation CSS


const style = [Link]('style');
[Link] = `
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-10px); }
75% { transform: translateX(10px); }
}
`;
[Link](style);

// Record page visit


recordLoginAttempt('PAGE_VISIT', 'visit');
</script>
</body>
</html>

You might also like