f5 beveileging

Gestart doorSmiegles19 reacties93 weergaven

20 berichten · pagina 1 van 2

Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
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?

[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]
     
?>
0
Berichten
4.213
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
laat het script na dat het spel is afgelopen linken naar de pagina waar steen papier schaar staat dan kan het namelijk niet
0
Berichten
1.674
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Euhm, je zou het antwoord tot een andere pagina kunnen leiden. Dat ie dan automatisch refresht naar die pagina.
bijv: mijnlink.nl/spel.php?=einduitslag
0
Berichten
4.213
Reputatie
0
Punten
0,02
Lid sinds
Laatst gezien
dat kan ook het kan ook dat hij na de uitslag gewoon doorlinkt naar de pagina steen panpier schaar dat is simpel intebouwen
0
Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
het gaat erom dat als je wint dat je kan f5en en steeds door gaat
0
Berichten
212
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
een sessie instellen misschien?

$_SESSION[gespeeld] = true;
0
Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik heb daar geen verstand van.
is er iemand die me daarmee kan helpen
0
Berichten
747
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Tijd opslaan in database en kijken of het een x aantal uur is geleden?
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maak, inplaats van de echo, een session aan met de melding, en header(Locationemo 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!
Wat je dan ook nog kan doen is iets met sessions doen waardoor hij bij een refresh ook aangeeft dat je niet nog een X magwink
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Dit scriptje heb ik gemaakt xd, stond op PHPHulp heyummie
0
Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet ik niet ik ben er erg tevreden mee
kun jij me hier mee verder helpen?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Als er iemand gewonnen is, stuur hem automatisch door met header(Location: winnendepage.php);

Dit doe je natuurlijk als je alle database dingen hebt gedaan.
En op winnendepage.php kan je dan een leuke tekst neerzetten smile

Dus in dit stuk:

}elseif(spelen($jij, $computer) == 1){
           $queryToevoeg = mysql_query("SELECT * from users WHERE id=".mysql_real_escape_string($_SESSION[uid])."");
           $rowToevoeg = mysql_fetch_array($queryToevoeg);
           $creditshDB = $rowToevoeg[credits];
           $credituDB = $creditshDB + 10;
           mysql_query("UPDATE users SET credits=".$credituDB." WHERE id=".mysql_real_escape_string($_SESSION[uid])."");
          header(Location: winnendepage.php);
       }elseif(spelen($jij, $computer) == 2){
0
Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
werkt niet
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Wat gaat er precies mis?
0
Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
foutmelding als je wint

Warning: Cannot modify header information - headers already sent by (output started at /home/smiegles/domains/smiegles.nl/public_html/style.php:1) in /home/smiegles/domains/smiegles.nl/public_html/steenpaierschaar.php on line 73
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