Hey,
Ik vond een oud scriptje van mij terug op mijn laptop.
Hierbij release ik hem maar, heb er verder toch niets aan.
Code:Groetjes,
Sebastiaan
Ik vond een oud scriptje van mij terug op mijn laptop.
Hierbij release ik hem maar, heb er verder toch niets aan.Code:
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/*
* @author: Sebastiaan H
* @product: Steen, papier, schaar
*/[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])
{[/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]keuze[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er gaat iets fout![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]steen[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>steen</b>, het is dus gelijk spel.[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]papier[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]2[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>papier</b>, het is dus gelijk spel[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]schaar[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]3[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>schaar</b>, het is dus gelijk spel[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]steen[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]2[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>papier</b>, dus je hebt verloren![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]papier[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]3[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>schaar</b>, dus je hebt verloren![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]schaar[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>steen</b>, dus je hebt verloren![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]steen[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]3[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>schaar</b>, dus je hebt gewonnen![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]papier[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>steen</b>, dus je hebt gewonnen![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]schaar[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]2[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had <b>papier</b>, dus je hebt gewonnen![/COLOR][COLOR= #007700];
}
}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<form action="#" method="post">
<select name="keuze">
<option value="steen">Steen</option>
<option value="papier">Papier</option>
<option value="schaar">Schaar</option>
</select>
<input type="submit" value="Gok" />
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>Sebastiaan
