He
ik heb een script gemaakt (met heel veeeel hulp) en daarbij kun je credits winnen
maar je kunt gewoon blijven f5,en
weet iemand hoe je dat beveiligd?
ik heb een script gemaakt (met heel veeeel hulp) en daarbij kun je credits winnen
maar je kunt gewoon blijven f5,en
weet iemand hoe je dat beveiligd?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"boven.php"[/COLOR][COLOR= #007700]);[/COLOR]
?>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/*
WAT NUTTIGE INFO
De getallen om te weten of je gewonnen, verloren of gelijkspel had.
(0) = Verloren
(1) = Gewonnen
(2) = Gelijkspel
De getallen van steen, papier en schaar.
(0) = Steen
(1) = Schaar
(2) = Papier
Als je echo spelen($jij, $computer); doet, krijg je de values terug van
gewonnen, verloren of gelijkspel terug.
Dit kan handig zijn als je het in de database wilt zetten.
*/[/COLOR]
[COLOR= #007700]function[/COLOR] spelen[COLOR= #007700]([/COLOR][COLOR= #0000BB]$speler_1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$speler_2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$gewonnen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])){[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$speler_1[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]$speler_2[/COLOR][COLOR= #007700]) ? ([/COLOR][COLOR= #0000BB]$gewonnen[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$speler_1[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]$speler_2[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]2[/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]submit[/COLOR][COLOR= #007700]])){[/COLOR]
[COLOR= #0000BB]$jij[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]keuze[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$computer[/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]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<strong>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De computer had [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]steen[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]schaar[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$computer[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]papier[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000] en jij had [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$jij[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]steen[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$jij[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]schaar[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$jij[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]papier[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</strong>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br /><br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]spelen[COLOR= #007700]([/COLOR][COLOR= #0000BB]$jij[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$computer[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<span style="color: red;">Verloren</span>[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR]spelen[COLOR= #007700]([/COLOR][COLOR= #0000BB]$jij[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$computer[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$queryToevoeg[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * from users WHERE id="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uid[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$rowToevoeg[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$queryToevoeg[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$creditshDB[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$rowToevoeg[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]credits[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$credituDB[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$creditshDB[/COLOR] [COLOR= #007700]+[/COLOR] [COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET credits="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$credituDB[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" WHERE id="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]uid[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=green>Gewonnen, er zijn 10 credits aan je account toegevoegd.</font>"[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR]spelen[COLOR= #007700]([/COLOR][COLOR= #0000BB]$jij[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$computer[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<span style="color: black;">Gelijkspel</span>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br /><br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<a href="[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]">Speel nog eens!</a>[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
?>
<form method="post" action="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]];[/COLOR] ?>">
<h3>Steen, papier, schaar!</h3>
<br />
Maak je keuze:
<br /><br />
<select name="keuze">
<option value="0">Steen</option>
<option value="1">Schaar</option>
<option value="2">Papier</option>
</select>
<br />
<input type="submit" name="submit" value="Ok!">
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>
hem dan naar een andere pagina waar je die melding weergeeft, als je dan refresht krijg je alleen weer die melding, en word de code niet openieuw uitgevoerd!
, stond op PHPHulp he
