58 lines
2.5 KiB
PHP
58 lines
2.5 KiB
PHP
<?php
|
|
// Function to generate a random name
|
|
function generateRandomName($length = 6) {
|
|
$vowels = array('a', 'e', 'i', 'o', 'u');
|
|
$consonants = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z');
|
|
|
|
$name = '';
|
|
$is_vowel = mt_rand(0, 1);
|
|
for ($i = 0; $i < $length; $i++) {
|
|
$source = $is_vowel ? $vowels : $consonants;
|
|
$name .= $source[mt_rand(0, count($source) - 1)];
|
|
$is_vowel = !$is_vowel;
|
|
}
|
|
return ucfirst($name);
|
|
}
|
|
|
|
$randomFirstName = generateRandomName(mt_rand(4, 8));
|
|
$randomLastName = generateRandomName(mt_rand(4, 8));
|
|
?>
|
|
<section class="diZContainer diZmxAuto diZmy8">
|
|
<h2 class="diZBorderBottom">Get a Random Name</h2>
|
|
<div class="diZMaxW500 diZFlexColumn diZItemsCenter diZJustifyCenter diZmxAuto toolsSection diZmy20">
|
|
<span class="diZDisplayNone" id="copiedNoticeName">Copied to clipboard</span>
|
|
<div class="diZFlexRow diZItemsCenter diZJustifyCenter">
|
|
<h2 id="randomName"><?php echo $randomFirstName . ' ' . $randomLastName; ?></h2>
|
|
<span class="diZCursorPointer" onclick="copyNameToClipboard()"><img src="/assets/svg/copy.svg" alt="Copy to Clipboard"></span>
|
|
</div>
|
|
</div>
|
|
<div class="">
|
|
<h3>Random Name Usage:</h3>
|
|
<ul>
|
|
<li class="diZTextJustify diZmt2">Generate random names for testing or placeholder purposes in applications or websites.</li>
|
|
<li class="diZTextJustify diZmt2">Use randomly generated names in mockups or design prototypes.</li>
|
|
<li class="diZTextJustify diZmt2">Create unique usernames or profile names in development environments.</li>
|
|
<li class="diZTextJustify diZmt2">Generate fictional character names for creative writing or gaming applications.</li>
|
|
<li class="diZTextJustify diZmt2">Provide random names for demo accounts or example data in presentations.</li>
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
|
|
<script>
|
|
function copyNameToClipboard() {
|
|
var copyText = document.getElementById('randomName');
|
|
var textArea = document.createElement('textarea');
|
|
textArea.value = copyText.textContent.trim();
|
|
document.body.appendChild(textArea);
|
|
textArea.select();
|
|
document.execCommand('copy');
|
|
document.body.removeChild(textArea);
|
|
|
|
var copiedNotice = document.getElementById('copiedNoticeName');
|
|
copiedNotice.style.display = 'block';
|
|
setTimeout(function() {
|
|
copiedNotice.style.display = 'none';
|
|
}, 1000);
|
|
}
|
|
</script>
|