PageRenderTime 112ms CodeModel.GetById 81ms app.highlight 9ms RepoModel.GetById 20ms app.codeStats 0ms

/gui.php

https://github.com/Drakekin/aVDR
PHP | 99 lines | 97 code | 0 blank | 2 comment | 0 complexity | f29024886f9130a7bbd35e6595ec3405 MD5 | raw file
 1<?php
 2	// Main GUI file
 3	// Should be imported
 4	$bgr1 = mt_rand(0,15);
 5	$bgg1 = mt_rand(0,15);
 6	$bgb1 = mt_rand(0,15);
 7	$bgr2 = mt_rand(0,15);
 8	$bgg2 = mt_rand(0,15);
 9	$bgb2 = mt_rand(0,15);
10	$colour = "#" . dechex($bgr1) . dechex($bgr2) . dechex($bgg1) . dechex($bgg2) . dechex($bgb1) . dechex($bgb2);
11?>
12<html>
13	<head>
14		<title>aVDR - automagic Verifiable Dice Roller</title>
15		<style type="text/css">
16			body, html {
17				background-color: <?=$colour?>;
18				font-family: Georgia, Serif;
19				text-align: center;
20			}
21			div#wrapper {
22				width: 30em;
23				text-align: center;
24				background-color: #fff;
25				margin: 5% auto;
26				padding: 2%;
27				font-size: 0.9em;
28			}
29			.disabled {
30				color: #ccc;
31			}
32			h1 {
33				margin: 0px;
34				padding: 0px;
35			}
36			.small {
37				font-size: 0.6em;
38			}
39			.big {
40				font-size: 1.3em;
41			}
42			a {
43				text-decoration: none;
44				color: #99CCFF;
45			}
46		</style>
47	</head>
48	<body>
49		<div id="wrapper">
50			<h1>aVDR - automagic Verifiable Dice Roller</h1>
51			<span class="small">A <a href="http://random.org">random.org</a> based verifiable dice roller</span>
52			<p>aVDR is a verifiable (you can come back and check your rolls at any time, they don't change) dice roller. It uses <a href="http://random.org">random.org</a> to generate the random numbers using atmospheric noise. This means your dice rolls are truely random, unlike some other random number generators (such as PHP on Windows) which have a very low repeat rate. However, if our <a href="http://random.org">random.org</a> quota runs out, the dice roller will fall back to the built in linux random number generator, namely the PHP mt_rand() command.</p>
53			<p>Input a username (used to distinguish your rolls from everyone elses) and a dice roll (in the format <em>x</em>D<em>y</em> where <em>x</em> is the number of dice and <em>y</em> is the type up to a maximum of 20d100). There are several options. Any greyed out option is either out of order or not working yet.</p> 
54			<form action="index.php" method="GET">
55				<strong class="big">Roll New Dice</strong><br />
56				<strong>Required Fields:</strong><br />
57				Username: <input type="text" name="user" /><br />
58				Dice Roll: <input type="text" name="roll" /><br /><br />
59
60				<strong>Optional Fields:</strong><br />
61				<input type="checkbox" name="usetarget" value="true" /> Target Value: <input type="text" name="target" /><br />
62				<input type="checkbox" name="usemodifier" value="true" /> Modifier: <input type="text" name="modifier" /><br />
63				<input type="checkbox" name="usepickhighest" value="true" /> Pick the highest.<br />
64				<input type="checkbox" name="usepickhighestdoubles" value="true" /> Pick the highest with doubles.<br />
65				<input type="checkbox" name="usepicklowest" value="true" /> Pick the lowest.<br />
66				<input type="checkbox" name="usererollabove" value="true" /> Re-roll dice above: <input type="text" name="rerollabove" /><br />
67				<input type="checkbox" name="usererollbelow" value="true" /> Re-roll dice below: <input type="text" name="rerollbelow" /><br /><br />
68
69				<input type="submit" value="Roll" />
70			</form>
71
72			<form action="index.php" method="GET">
73				<strong class="big">Check Old Rolls</strong><br />
74				<strong>Required Fields:</strong><br />
75				Username: <input type="text" name="user" /><br />
76				Roll Timestamp: <input type="text" name="time" /><br /><br />
77
78				<strong>Optional Fields:</strong><br />
79				<input type="checkbox" name="useold" value="true" checked="true" disabled="true" /> History Length: <input type="text" name="old" value="8" /><br /><br />
80
81				<input type="submit" value="Check" />
82			</form>
83
84			<form action="index.php" method="GET">
85				<strong class="big">Browse Rolls</strong><br />
86				Enter the usernames you want to check. Seperate usernames with a comma (,).<br />
87				<strong>Required Fields:</strong><br />
88				Usernames: <input type="text" name="browse" /><br />
89
90				<strong>Optional Fields:</strong><br />
91				<input type="checkbox" name="browseall" value="true"/> Browse All<br />
92				<input type="checkbox" name="useoffset" value="true" checked="true" disabled="true" /> Offset: <input type="text" name="offset" value="0" /><br /><br />
93
94				<input type="submit" value="Check" />
95			</form>
96			<span class="small">aVDR v<?=$version?> - Copyright Connor Shearwood (a.k.a. Drake Andrews) 2010 - Code released under the GNU Public License. Your background colour today is <span style="color: <?=$colour?>;"><?=$colour?></span>. I have <?=$quota?> bits of random data and <?=$maxnoofdie?> dice rolls left. <?=gettotaldiceserved()?> rolls made and counting. Page generated in <?=round(microtime()-$starttime, 3)?> seconds.</span>
97		</div>
98	</body>
99</html>