init
This commit is contained in:
30
random-password-generator.php
Normal file
30
random-password-generator.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$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> <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>
|
||||
Reference in New Issue
Block a user