Script werkt niet..

Gestart doorDylan7 reacties27 weergaven

8 berichten · pagina 1 van 1

Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$userid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM users WHERE username = $username"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$ebcheck[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"http://www.eurobellen.nl/bel/check.php?userid=XXXXX&ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"&ebpin="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]0199[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze pincode is een test code en niet geldig.[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"OK"[/COLOR] [COLOR= #007700]) {[/COLOR]
  [COLOR= #FF8000]// Hier echo en mysql query, het betalen is gelukt. [/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Het betalen is gelukt ;D , je bent nu GOLD MEMBER[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET rank_betaald = 1 WHERE username = $username"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET vip = 1 WHERE username = $username"[/COLOR][COLOR= #007700]);

}[/COLOR]

[COLOR= #FF8000]// errors[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR1"[/COLOR] [COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]je hebt niet betaald[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR3"[/COLOR] [COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]één code werkt niet.[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR4"[/COLOR] [COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000](één) code is al gebruikt.[/COLOR][COLOR= #007700]);
}
}[/COLOR]
?>


Als iemand heeft betaald werkt tie niet.

Zelf al heb ik een test code erin, hij zegt de heletijd: Je hebt niet betaald.
0
Berichten
10.409
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
"Werkt tie niet" Wat werkt er niet? Wat gebeurt erg, geef eens wat meer info.
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Krijg je een error of dergelijk?
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$userid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM users WHERE username = $username"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$ebcheck[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"http://www.eurobellen.nl/bel/check.php?userid=XXXXX&ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"&ebpin="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]0199[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze pincode is een test code en niet geldig.[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"OK"[/COLOR] [COLOR= #007700]) {[/COLOR]
  [COLOR= #FF8000]// Hier echo en mysql query, het betalen is gelukt. [/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Het betalen is gelukt ;D , je bent nu GOLD MEMBER[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET rank_betaald = 1, vip = 1 WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);

}[/COLOR]

[COLOR= #FF8000]// errors[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR1"[/COLOR] [COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]je hebt niet betaald[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR3"[/COLOR] [COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]één code werkt niet.[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR4"[/COLOR] [COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000](één) code is al gebruikt.[/COLOR][COLOR= #007700]);
}
}[/COLOR]
?>


Misschien zo?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dus je gaat eerst maar bepalen of het gelukt is, en dan maar de actie uitvoeren.
Lekker riskant, en vooral in een betaalsysteem.

Pas gewoon foutafhandeling toe, er hoeft maar iets met je tabel te gebeuren en je zet je gebruikers op een verkeerd spoor....
0
Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Kingunit schreef:
"Werkt tie niet" Wat werkt er niet? Wat gebeurt erg, geef eens wat meer info.
Ik heb het getest met de test code die hun geven (0199), ik had gewoon die goldmember ontvangen, toen (zostrax) was er iemand die zei dat ie het niet had ontvangen, dat klopt want bij eurobellen staat;
20:56:49 Goldmember (?) xxx (?) Nee € 0,85
Aarclay schreef:
Dus je gaat eerst maar bepalen of het gelukt is, en dan maar de actie uitvoeren.
Lekker riskant, en vooral in een betaalsysteem.

Pas gewoon foutafhandeling toe, er hoeft maar iets met je tabel te gebeuren en je zet je gebruikers op een verkeerd spoor....
Ik heb het heus wel getest hoor.

toevoeging op 4 maart 2012, 13:36:03:
Ik zou hem nog eens testen..

Zelf al heb ik een test code erin, hij zegt de heletijd: Je hebt niet betaald.
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
IPV kan je om te beginnen niet steeds nieuwe ifs aan maken, maar elseif gebruiken. Dit is al wat beter:

[COLOR= #0000BB]<?php
$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$userid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM users WHERE username = $username"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$ebcheck[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"http://www.eurobellen.nl/bel/check.php?userid=XXXXX&ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"&ebpin="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]0199[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze pincode is een test code en niet geldig.[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"OK"[/COLOR] [COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Het betalen is gelukt ;D , je bent nu GOLD MEMBER[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET rank_betaald = 1 WHERE username = $username"[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET vip = 1 WHERE username = $username"[/COLOR][COLOR= #007700]);

    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR1"[/COLOR] [COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]je hebt niet betaald[/COLOR][COLOR= #007700];

    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR3"[/COLOR] [COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]één code werkt niet.[/COLOR][COLOR= #007700];

    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ebcheck[/COLOR][COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"ERR4"[/COLOR] [COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000](één) code is al gebruikt.[/COLOR][COLOR= #007700];
    }
}[/COLOR]
?>


En ik heb het vermoeden dat het hier aan ligt:

[COLOR= #0000BB]<?php
$ebcheck[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"http://www.eurobellen.nl/bel/check.php?userid=XXXXX&ip="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"&ebpin="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ebpin[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
?>


We zijn hier niet met MySQL bezig, en ik denk niet dat ze willen dat er haakjes rond de meegezonden GET waarden ip en ebpin willen hebben.

IPV
&ip=".$_SERVER[REMOTE_ADDR]."&ebpin=".$_GET[ebpin]."
moet je
&ip=".$_SERVER[REMOTE_ADDR]."&ebpin=".$_GET[ebpin]."
dus eens proberen
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Getest of niet. Foutafhandeling hoort er gewoon in.
Wat nou als je structuur is veranderd, of je tabel gecrashed is? Als je foutmeldingen uit staan, lieg je in feite je gebruikers dus voor dat ze betaald hebben, terwijl dat niet zo is.
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