Raad het getal script

Gestart doorShahiem4 reacties33 weergaven

5 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een raad het getal script maar hij is niet echt goed gescript.
Ik wil dat je alleen cijfer van 1 t/m 10 kan invullen.
En dat je geen letters kan invullen.
Ik heb ook iets gemaakt als je niet genoeg muntjes hebt dat je dan een melding krijgt maar dat wil neit echt werken.

Kan imenad me helpen?

Code:

[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]
[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.00[/COLOR][COLOR= #007700])
             {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt niet genoeg muntjes[/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][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][COLOR= #007700];
}[/COLOR]
?>
<div class="top">Raad het Getal</div><div class="mid">
<form action="" method="post">
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]
?>
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Ik zal even voor je kijken, heb zelf ook zon script moet het nog even aanpassen ook bij mij.
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Is goed, Tom smile
0
Berichten
364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/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]
[COLOR= #FF8000]// deze onderstaande teksten kun je aanpassen in wat je maar wilt...[/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]"Uw getal is helaas niet goed, het juiste antwoord was "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$te_raden_getal[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Uw getal is correct!"[/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]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"<br>"[/COLOR]
?>

<form method="GET" action="spel.php">
De bedoeling is dat je een getal van 1 t/m 10 invult en als je geluk hebt raad je hem. 
<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]?>">
<input type="submit" value="Go">
</form>
</body>
</html>
0
Tom

Lid

Berichten
3.868
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
Ik ga niet meer kijken, misschien iets met c_typdigit ofzo?
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