Skip to content

Instantly share code, notes, and snippets.

@resba
Created June 8, 2011 16:33
Show Gist options
  • Save resba/1014771 to your computer and use it in GitHub Desktop.
Save resba/1014771 to your computer and use it in GitHub Desktop.
Roll a d*
<?php /*
//
//
// Roll a d* Script
//
// Version: 1.0
//
// Author: resba [https://www.github.com/resba]
//
// Description: Just like rolling a dice! Roll a die virtually and get a return number!
//
// Disclaimer: This script can be used freely so long as credit is given when credit is due!
//
//
*/ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Roll a dNUMBER</title>
</head>
<body>
<?php if(isset($_GET['return'])) { ?>
<div id="class">Return: <?php
if($_GET['return']=="d2"){
echo(rand(1,2));
}
if($_GET['return']=="d4"){
echo(rand(1,4));
}
if($_GET['return']=="d6"){
echo(rand(1,6));
}
if($_GET['return']=="d8"){
echo(rand(1,8));
}
if($_GET['return']=="d10"){
echo(rand(1,10));
}
if($_GET['return']=="d12"){
echo(rand(1,12));
}
if($_GET['return']=="d14"){
echo(rand(1,14));
}
if($_GET['return']=="d16"){
echo(rand(1,16));
}
if($_GET['return']=="d18"){
echo(rand(1,18));
}
if($_GET['return']=="d20"){
echo(rand(1,20));
}
if($_GET['return']=="d100"){
echo(rand(1,100));
}
?>
</div>
<?php } ?>
<table width="100%" border="1" align="center">
<tr>
<td align="center"><a href="mathfloor.php?return=d2">Roll a d2.</a>
<a href="rollengine.php?return=d4">Roll a d4.</a>
<a href="rollengine.php?return=d6">Roll a d6.</a>
<a href="rollengine.php?return=d8">Roll a d8.</a>
<a href="rollengine.php?return=d10">Roll a d10.</a>
<a href="rollengine.php?return=d12">Roll a d12.</a>
<a href="rollengine.php?return=d14">Roll a d14.</a>
<a href="rollengine.php?return=d16">Roll a d16.</a>
<a href="rollengine.php?return=d18">Roll a d18.</a>
<a href="rollengine.php?return=d20">Roll a d20.</a>
<a href="rollengine.php?return=d100">Roll a d100.</a></td>
</tr>
</table>
<p>script by <a href="https://www.github.com/resba">resba</a></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment