75 lines
3.4 KiB
PHP
75 lines
3.4 KiB
PHP
<?php
|
|
$time = time();
|
|
$gen_pass = rand(100, 360) . $time . rand(100, 999);
|
|
$rand_pass = base_convert($gen_pass, 10, 36);
|
|
?>
|
|
|
|
<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>
|
|
<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>
|