19-12-24, 10:21 PM
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Protected File Download</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
}
.container {
display: inline-block;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
input[type="password"] {
padding: 8px;
font-size: 16px;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>Password Protected File Download</h2>
<p>Enter the password to download the file:</p>
<input type="password" id="password" placeholder="Enter password">
<br><br>
<button onclick="checkPassword()">Download File</button>
<p id="error-message" style="color: red; display: none;">Incorrect password. Please try again.</p>
</div>
<script>
const correctPassword = "535011"; // The password you want to use
const fileUrl = "https://drive.google.com/file/d/1Yd3aEzFiRmL7QYQHiijGemZ9B4QwA7ak/view?usp=sharing"; // The URL of the file to be downloaded
function checkPassword() {
const enteredPassword = document.getElementById("password").value;
if (enteredPassword === correctPassword) {
// Redirect to file download (can be a direct link)
window.location.href = fileUrl;
} else {
// Display error message
document.getElementById("error-message").style.display = "block";
}
}
</script>
</body>
</html>
