Raadhetgetal

Gestart doorShahiem0 reacties42 weergaven

1 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Mijn raadhetgetal script moet nog wat beveiligd worden ,maar het wil m niet echt lukken.

Ik wil dat als je niet genoeg muntjes hebt dat er komt te staan: Je hebt niet genoeg muntjes
En als je een verkeerde getal invoert dat er komt te staan: Dat je een verkeerde getal hebt ingevoerd.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]is_auth[COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/srand"]srand[/URL][COLOR= #007700]((double)[/COLOR] [URL="http://www.php.net/microtime"]microtime[/URL][COLOR= #007700]() *[/COLOR] [COLOR= #0000BB]100000[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$te_raden_getal[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$antwoord[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]antwoord[/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]$antwoord[/COLOR][COLOR= #007700])){[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]uCoins [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]||[/COLOR] uCoins [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]10[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt niet genoeg muntjes[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$antwoord[/COLOR] [COLOR= #007700]<>[/COLOR] [COLOR= #0000BB]$te_raden_getal[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<div class="rederror"><br /><strong>Je hebt verloren, het goede antwoord was  

[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$te_raden_getal[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]</strong><br />Je verliest 10 muntjes.</div><meta http-equiv="refresh" 

content="3;url=index.php?p=raadhetgetal">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE member_accounts SET uCoins = uCoins-10 WHERE uId = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]] .[/COLOR] 

[COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<div class="rederror"><br /><strong>Je hebt gewonnen, je krijgt 10 

muntjes.</strong></div><meta http-equiv="refresh" content="3;url=index.php?p=raadhetgetal">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE member_accounts SET uCoins = uCoins+10 WHERE uId = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]] .[/COLOR] 

[COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());;[/COLOR]
[COLOR= #0000BB]$te_raden_getal[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700]);
}
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$bericht[/COLOR]
?>
<div class="top">Raad het Getal</div><div class="mid">
<form method="POST" action="">
De bedoeling is dat je een getal van 1 t/m 10 invult.
Als je wint krijg je 10 muntjes, als je verliest dan verlies je 10 muntjes.<br />
<br />
Antwoord <input name="antwoord" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$antwoord[/COLOR]?>"><br />
<input type="hidden" name="te_raden_getal" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$te_raden_getal[/COLOR]?>">
<br />
<input type="submit" value="Starten!">
</form>
</div>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="rederror"><br /><strong>U moet ingelogd zijn om deze pagina te 

bekijken.</strong><br> <a href="index.php?p=login">Log hier in</a> of <a 

href="index.php?p=registreer">maak een account aan.</a></div>[/COLOR][COLOR= #007700];
}[/COLOR]
?>


Misschien is het neit echt goed gescript
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren