Skip to content

Instantly share code, notes, and snippets.

@0xAether
Created May 30, 2013 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xAether/5681981 to your computer and use it in GitHub Desktop.
Save 0xAether/5681981 to your computer and use it in GitHub Desktop.
A simple PHP page to display server-side generated UUIDs
<!doctype html>
<head>
<meta charset="UTF-8">
<title>UUID Generator</title>
<style>
body {
background-color: #e8e8f0;
}
h1 {
font-family: georgia, sans-serif, verdana, helvetica;
font-size: 22px;
font-weight: bold;
}
h2 {
font-family: georgia, sans-serif, verdana, helvetica;
font-size: 12px;
font-weight: normal;
color: #aaaab8;
}
DIV.center {
text-align: center;
}
form {
display: inline;
}
</style>
<script>
function eraseText() {
document.getElementById("uuids").value = "";
}
</script>
</head>
<body>
<div class="center">
<h1>UUID Generator</h1>
<h2>These UUIDs are generated server-side using entropy from /dev/random</h2>
<input type="button" value="Clear" onclick="javascript:eraseText();">
<form action="index.php" method='POST'>
<select name="number">
<optgroup label="How many UUIDs?">
<option>1</option>
<option>2</option>
<option>5</option>
<option>10</option>
<option>20</option>
<option>50</option>
<option>75</option>
<option>100</option>
</optgroup>
</select>
<input type="submit" value="Generate"/>
</form>
<br />
<textarea id="uuids" rows="21" cols="37">
<?php
$number = $_POST['number'];
if ( $number <= 100 && $number >= 0 ) {
for ( $number=$number; $number >= 1; $number-- ){
echo shell_exec("/usr/bin/uuidgen");
}
}
?>
</textarea>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment