Mollie & Php

Gestart doorDigital1 reacties43 weergaven

2 berichten · pagina 1 van 1

Digital

Lid · Topicstarter

Berichten
326
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Code 1 :

[COLOR= #0000BB]<?php
$toegangscode[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"toegangscode"[/COLOR][COLOR= #007700]]) ==[/COLOR] true [COLOR= #007700]?[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"toegangscode"[/COLOR][COLOR= #007700]] :[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://www.mollie.nl/partners/api/micropayment/"[/COLOR][COLOR= #007700].[/COLOR]
       [COLOR= #DD0000]"?toegangscode="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/urlencode"]urlencode[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$toegangscode[/COLOR][COLOR= #007700]);[/COLOR] 
[COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]= @[/COLOR][URL="http://www.php.net/implode"]implode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR][URL="http://www.php.net/file"]file[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]));[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #DD0000]"OK"[/COLOR][COLOR= #007700])[/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"<center><strong><br />Je toegangscode was verkeerd of je hebt nog niet betaald. </strong></center>"[/COLOR][COLOR= #007700]);[/COLOR]
?>


Code 2

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE Gebruikers SET points = points + 10 WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" LIMIT 1"[/COLOR][COLOR= #007700]);[/COLOR]
?>


Hoe kan ik ervoor zorgen dat als De toegangscode corect is hij met een else of iets anders Code 2 uitvoert?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Waarom gebruik je die() geen enkel script gaat dood als er iets fouts gebeurt.

Even pseudocode:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"OK"[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #FF8000]// voer query uit.... let op foutafhandeling!!!!!!!!!!!!!!!!!!!![/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 toegangscode was verkeerd of je hebt nog niet betaald. </strong>"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
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