This commit is contained in:
Suvodip
2024-07-11 12:45:10 +05:30
parent d368213568
commit 040c4b87c1
33 changed files with 1042 additions and 867 deletions

View File

@@ -1,30 +1,74 @@
<?php
$time=time();
$gen_pass=rand(100,360).$time.rand(100,999);
$rand_pass = base_convert($gen_pass,10,36);
$time = time();
$gen_pass = rand(100, 360) . $time . rand(100, 999);
$rand_pass = base_convert($gen_pass, 10, 36);
?>
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; margin-top: 20px;">
<h1 style="font-size: 25px;">Get a random password</h1>
<div style="display: flex; flex-direction: row; margin-top: 20px;">
<p style="border: 2px solid #ddd; border-radius: 6px; padding: 5px;">Password: <span id="randPassword"> <?php echo $rand_pass; ?></span></p>&nbsp; <button id="copyButton" style="background-color: #7d7d7d; border-radius: 6px; padding: 0px 10px 0px 10px;">Copy</button>
</div>
<P style="display: none; text-align: center;" id="copied-notice"></P>
</div>
<!-- <div id="copyText">This text will be copied when clicked.</div> -->
<script>
document.getElementById("copyButton").addEventListener("click", function() {
// Select the text
var copyText = document.getElementById("randPassword");
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(copyText);
selection.removeAllRanges();
selection.addRange(range);
// Copy to clipboard
document.execCommand("copy");
document.getElementById('copied-notice').style.display = 'block';
document.getElementById('copied-notice').innerHTML = 'Text copied to clipboard!';
});
</script>
<section class="diZContainer diZmxAuto diZmy8">
<h1 class="diZBorderBottom">Get a random password</h1>
<p class="diZTextJustify">This tool generates a random password consisting of alphanumeric characters, ideal for creating secure credentials quickly. It combines a random numeric value with the current timestamp, converting the result into a base-36 string format for enhanced security and uniqueness.</p>
<div class="diZMaxW600 diZmxAuto diZmy20 diZFlexColumn toolsSection">
<p class="diZDisplayNone" id="copied-notice"></p>
<div class="diZFlexRow diZItemsCenter diZJustifyCenter">
<h2>Password: <span id="randPassword"><?php echo $rand_pass; ?></span></h2>&nbsp;
<span class="diZCursorPointer" onclick="copyToClipboard()"><img src="/assets/svg/copy.svg" alt="Copy to Clipboard"></span>
</div>
</div>
<div>
<h3>Usage:</h3>
<ul>
<li><strong>Generate Random Password:</strong> Click the "Get a random password" button to generate a new, unique password.</li>
<li><strong>Copy Password to Clipboard:</strong> Once generated, the password will display below the button.</li>
<li><strong>Click the Copy Icon:</strong> Click the copy icon next to the password to copy it to your clipboard.</li>
<li><strong>Paste and Use:</strong> Paste the copied password into any application, login form, or document where a secure password is required.</li>
</ul>
<h3>Features:</h3>
<ul>
<li><strong>Randomized Generation:</strong> Each password is dynamically generated using random numbers and timestamps.</li>
<li><strong>Secure Base-36 Conversion:</strong> Converts the generated value into a base-36 string format for enhanced security.</li>
<li><strong>Clipboard Integration:</strong> Allows easy copying of the generated password with a single click.</li>
</ul>
<h3>Example Use Cases:</h3>
<ul>
<li><strong>User Accounts:</strong> Quickly generate secure passwords for new user registrations or account setups.</li>
<li><strong>Password Resets:</strong> Provide users with randomly generated passwords for password recovery processes.</li>
<li><strong>Secure Access:</strong> Ideal for securing sensitive information and access credentials across various platforms.</li>
</ul>
</div>
</section>
<script>
function copyToClipboard() {
var copyText = document.getElementById('randPassword').innerText; // Get the text content
var textArea = document.createElement('textarea');
// Place the text in the textarea
textArea.value = copyText;
// Make the textarea hidden
textArea.style.position = 'fixed';
textArea.style.opacity = 0;
// Append the textarea to the body
document.body.appendChild(textArea);
// Select and copy the text
textArea.select();
document.execCommand('copy');
// Remove the textarea from the DOM
document.body.removeChild(textArea);
// Show copied notice
var notice = document.getElementById('copied-notice');
notice.style.display = 'block';
notice.textContent = 'Text copied to clipboard!';
// Hide notice after 1 second
setTimeout(function() {
notice.style.display = 'none';
}, 1000);
}
</script>