Ik heb een Steenpapier schaar spel gevonden maar nu wil ik weten hoe ik het verder kan beveiligen en als je gewonnen hebt dat je muntjes krijgt.
Je krijgt er een vergoeding voor.
<!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=iso-8859-1" />
<title>Rock, Paper, scissors</title>
</head>
<body>
<center>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]])){[/COLOR]
[COLOR= #0000BB]$actions[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"paper"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"rock"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"scissors"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$mogelijkheden[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"paper"[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"rock"[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"scissors"[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$speler[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mogelijkheden[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rps[/COLOR][COLOR= #007700]]];[/COLOR]
[COLOR= #0000BB]$c[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$actions[/COLOR][COLOR= #007700][[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700])];[/COLOR]
[COLOR= #0000BB]$comp[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mogelijkheden[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$c[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$gewonnen[/COLOR] [COLOR= #007700]= ((([/COLOR][COLOR= #0000BB]$speler[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]$comp[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$comp[/COLOR] / [COLOR= #0000BB]$speler[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]0.5[/COLOR][COLOR= #007700]) ||[/COLOR] [COLOR= #0000BB]$speler[/COLOR] / [COLOR= #0000BB]$comp[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0.5[/COLOR][COLOR= #007700]) &&[/COLOR] [COLOR= #0000BB]$comp[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]$speler[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gewonnen[/COLOR][COLOR= #007700]){[/COLOR]
?>
<font color="green">
Je hebt gewonnen!<br />
Gefeliciteerd
</font>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$speler[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]$comp[/COLOR][COLOR= #007700]){[/COLOR]
?>
Jullie hadden dezelfde actie,<br />
Gelijkspel
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
?>
<font color="red">Je hebt verloren!</font>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>
<br /><br />
<table>
<tr>
<td width="50%">Jouw actie:</td>
<td><?=ucfirst($_POST[rps]); ?></td>
</tr>
<tr>
<td>Pc actie:</td>
<td><?=ucfirst($c); ?></td>
</tr>
</table>
<br /><br />
<a href="<?=$_SERVER[HTTP_REFERER]; ?>">Begin opnieuw</a>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]
?>
Welkom bij Rock, paper, scissors<br />
<br />
<table>
<form name="rps" action="?action" method="post">
<tr>
<td><input type="radio" name="rps" value="paper" /></td>
<td align="left">Paper</td>
</tr>
<tr>
<td width="50%"><input type="radio" name="rps" value="rock" /></td>
<td align="left">Rock</td>
</tr>
<tr>
<td><input type="radio" name="rps" value="scissors" /></td>
<td align="left"><label for="scissors">Scissors</label></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Strijd" /></td>
</tr>
</form>
</table>
</center>
</body>
</html> Je krijgt er een vergoeding voor.


