Goudgrijp Script

Gestart doorShahiem9 reacties43 weergaven

10 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hi,

Ik zir met een probleem dat hij je aantaal galjoenen en het geld op bank niet weergeeft.

Code:

[COLOR= #0000BB]<?php[/COLOR]   
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"GREETING"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"Goudgrijp"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/header.php[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/config.php[/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]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]))
{[/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] 
  
    [COLOR= #0000BB]$Query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM leden WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Query[/COLOR][COLOR= #007700]))
    {[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]galjoenen[/COLOR][COLOR= #007700]] >[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]in1[/COLOR][COLOR= #007700]])
        {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<strong>Je hebt niet genoeg galjoenen in je kluis staan..</strong><br /><br />[/COLOR][COLOR= #007700];
        }[/COLOR]
        
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]in1[/COLOR][COLOR= #007700]]))
    {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je moet alle velden invullen.[/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]Je hebt succesvol <strong>bedag</strong> in je kluis gestort.[/COLOR][COLOR= #007700];[/COLOR]  
  [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden SET bank = bank+"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]in1[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]   
  [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden SET galjoenen = galjoenen-"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]in1[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]); 
        }  
    }
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]
    Je hebt [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]galjoenen[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] galjoenen op zak, en [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bank[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] in je kluis.
      <form method="post" action="">
      <table>   
     <tr>
        <td>Aantal:</td> <td><input type="text" name="in1"></td>
     </tr>   
     <tr>
        <td><input type="submit" value="Storten"></td>
    </tr>   
      </table>
      </form>[/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]<strong>Je moet ingelogd zijn om deze pagina te bekijken.</strong>[/COLOR][COLOR= #007700];
}[/COLOR]
 [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/footer.php[/COLOR][COLOR= #007700];[/COLOR]
?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Je maakt $fetch alleen aan als de pagina wordt aangeroepen door POST.
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
redface Ik snap het bedankt. En hoe kan je er voor zorgen dat mensen geen ongewone teken mogen gebruiken zoals: $#%^& enzo?
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ctype_alpha() (alleen a-z/A-Z)
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het werkt niet, heb dit:

elseif(ctype_alpha($_POST[in1]))
        {
        echo Je gebruikt een illigale teken.;
        }


En er mogen ook geen letters bij.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
! ervoor?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik gebruik nu !is_nummeric biggrin En dat werkt wel.
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Doe dan nog !ctype_digit() wink Die is beter.

PS. Kom op MSN.
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
inderdaad, bij ctype_digit mag ook geen negatief getal of gebroken getal ( - en . en , mogen dan dus ook niet).
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zal ik ook er bij zetten, bedankt biggrin
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