DA API + One2xs API

Gestart doorKlaasie7 reacties92 weergaven

8 berichten · pagina 1 van 1

Klaasie

Lid · Topicstarter

Berichten
5.498
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik heb 2 APIs.

De One2xs API
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/*******
 * Voorbeeldscript voor de werking met de Wallie API voor one2xs
 * Meer informatie: http://www.one2xs.com/wallieinfo
 * Versie        1.0.0
 * Copyright    one2apps 2010
 * Datum        15 juni 2010
 * Alle rechten voorbehouden.
 * Gebruik op eigen risico.
 * Misbruik wordt bestraft.
 ***
 * Dit is een voorbeeldscript; je bent vrij om je eigen draai aan het systeem te geven, op voorwaarde dat je je aan de regels houdt.
 * Succes ermee.
 **/[/COLOR]

[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]lennard[/COLOR][COLOR= #007700];[/COLOR]                                        [COLOR= #FF8000]// gebruikersnaam op one2xs voor wie gebeld moet worden[/COLOR]
[COLOR= #0000BB]$bedrag[/COLOR] [COLOR= #007700]= .[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700];[/COLOR]                                                [COLOR= #FF8000]// bedrag in euros; minimaal 0.10, maximaal 500.00; gebruik geen kommas maar punten[/COLOR]
[COLOR= #0000BB]$terugstuur[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]http://localhost/wallieapi_o2x/example.php[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// de url waar de gebruiker terug moet komen na de betaling[/COLOR]

[URL="http://www.php.net/error_reporting"]error_reporting[/URL][COLOR= #007700]([/COLOR]E_ALL[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include_once"]include_once[/URL] [COLOR= #DD0000]api.cls.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]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]transkey[/COLOR][COLOR= #007700]]))[/COLOR] [COLOR= #FF8000]// betaling voorbereiden als er geen transactiecode is opgegeven[/COLOR]
[COLOR= #007700]{[/COLOR]
    
    [COLOR= #0000BB]$api[/COLOR] [COLOR= #007700]= new[/COLOR] api[COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]init[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bedrag[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$terugstuur[/COLOR][COLOR= #007700]);[/COLOR][COLOR= #FF8000]// api instantie maken[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]doTransaction[COLOR= #007700]() ===[/COLOR] TRUE[COLOR= #007700])
    {[/COLOR]
        
        [COLOR= #0000BB]$content[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]getMessages[COLOR= #007700]();[/COLOR] [COLOR= #FF8000]// berichten ophalen[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]done[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]true[/COLOR][COLOR= #007700])
        {[/COLOR]
            
            [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/urldecode"]urldecode[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]]));[/COLOR] [COLOR= #FF8000]// gebruiker doorsturen; gebruik meta redirect als je hier een headers already sent-foutmelding krijgt[/COLOR]
            [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
            
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Er is wat fout gegaan![/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// neem even contact op met de one2xs-support als dit verschijnt[/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]API fout.[/COLOR][COLOR= #007700];
        
    }
    
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #FF8000]// als er wel een transactiecode is opgegeven: checken of die klopt[/COLOR]
[COLOR= #007700]{[/COLOR]
    
    [COLOR= #0000BB]$api[/COLOR] [COLOR= #007700]= new[/COLOR] api[COLOR= #007700]([/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]volt[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$bedrag[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$terugstuur[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// verwerking van de betaling[/COLOR]
    
    [COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]addParam[COLOR= #007700]([/COLOR][COLOR= #DD0000]transkey[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]transkey[/COLOR][COLOR= #007700]]);[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]doTransaction[COLOR= #007700]() ===[/COLOR] TRUE[COLOR= #007700])
    {[/COLOR]
        
        [COLOR= #0000BB]$ret[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]getMessages[COLOR= #007700]();[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ret[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]betaald[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]0[/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]$ret[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]betaald[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
        
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt betaald![/COLOR][COLOR= #007700];
        
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ret[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]betaald[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])
        {[/COLOR]
            
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze betaling is al eerder verwerkt.[/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]Onbekende fout. Neem contact op met de beheerders voor meer informatie.[/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]API fout.[/COLOR][COLOR= #007700];
        
    }
    
}[/COLOR]
?>
En een Directadmin API (Gevonden op een site)
Spoiler tonen
[COLOR= #0000BB]<?
 
$server_ip[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"11.22.33.44"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$server_login[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$server_pass[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"yourpass"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$server_ssl[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"N"[/COLOR][COLOR= #007700];[/COLOR]
 
 
[COLOR= #0000BB]$username[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$domain[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]domain[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$email[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$package[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]package[/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]action[/COLOR][COLOR= #007700]]) &&[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"add"[/COLOR][COLOR= #007700])
{[/COLOR]
 
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Creating user $username on server $ip.... <br>
"[/COLOR][COLOR= #007700];[/COLOR]
 
 [COLOR= #0000BB]$sock[/COLOR] [COLOR= #007700]= new[/COLOR] HTTPSocket[COLOR= #007700];[/COLOR]
 [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$server_ssl[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]Y[/COLOR][COLOR= #007700])
 {[/COLOR]
  [COLOR= #0000BB]$sock[/COLOR][COLOR= #007700]->[/COLOR]connect[COLOR= #007700]([/COLOR][COLOR= #DD0000]"ssl://"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server_ip[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2222[/COLOR][COLOR= #007700]);
 }[/COLOR]
 [URL="http://www.php.net/else"]else[/URL]
 [COLOR= #007700]{[/COLOR] 
  [COLOR= #0000BB]$sock[/COLOR][COLOR= #007700]->[/COLOR]connect[COLOR= #007700]([/COLOR][COLOR= #0000BB]$server_ip[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2222[/COLOR][COLOR= #007700]);
 }[/COLOR]
 
 [COLOR= #0000BB]$sock[/COLOR][COLOR= #007700]->[/COLOR]set_login[COLOR= #007700]([/COLOR][COLOR= #0000BB]$server_login[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$server_pass[/COLOR][COLOR= #007700]);[/COLOR]
 
 [COLOR= #0000BB]$sock[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]/CMD_API_ACCOUNT_USER[/COLOR][COLOR= #007700],[/COLOR]
     [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR]
  [COLOR= #DD0000]action[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]create[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]add[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]Submit[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]username[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$username[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]email[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]passwd[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]passwd2[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$pass[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]domain[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$domain[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]package[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$package[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]ip[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$server_ip[/COLOR][COLOR= #007700],[/COLOR]
  [COLOR= #DD0000]notify[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]yes[/COLOR]
     [COLOR= #007700]));[/COLOR]
 
 [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$sock[/COLOR][COLOR= #007700]->[/COLOR]fetch_parsed_body[COLOR= #007700]();[/COLOR]
 
 [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]error[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000]"0"[/COLOR][COLOR= #007700])
 {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>Error Creating user $username on server $server_ip:<br>
"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$result[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]text[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"<br>
"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$result[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]details[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"<br></b>
"[/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]"User $username created on server $server_ip<br>
"[/COLOR][COLOR= #007700];
 }[/COLOR]
 
 [URL="http://www.php.net/exit"]exit[/URL] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];
}[/COLOR]
 
?>
 
 
<form action=? method="POST">
<input type=hidden name=action value="add">
Username: <input type=text name=username><br>
Domain:<input type=text name=domain><br>
Email: <input type=text name=email><br>
Pass: <input type=password name=pass><br>
Packge: <input type=text name=package><br>
</form>
Maar hoe zorg ik nu dat je eerst moet betalen voordat de gebruiker word aangemaakt?

Alvast bedankt,

Klaasie.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
elseif($ret[betaald] == 1)
{

echo Je hebt betaald!;

}

= Betaald

Edit:
WTF FAIL exit 0; emo
0
Klaasie

Lid · Topicstarter

Berichten
5.498
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nielsie schreef:
elseif($ret[betaald] == 1)
{

echo Je hebt betaald!;

}

= Betaald

Edit:
WTF FAIL exit 0; emo


Ik heb dat script niet gemaakt emoIk weet dat het daar moet komen maar ik snap niet precies WAT er moet komen.
Het moet zo worden dat de POST functie wordt uitgevoerd als je hebt betaald maar ik weet niet precies hoe ik dat doe.
0
Berichten
1.560
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Na je hebt betaald gewoon de DA api..
0
Klaasie

Lid · Topicstarter

Berichten
5.498
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Timbox schreef:
Na je hebt betaald gewoon de DA api..
Dat dacht ik eerst ook,
Dan is het zo;
Je betaald
En dan pas gegevens invoeren emoDat klopt volgensmij niet helemaal?
En als je dan perongeluk de pagina refresht dan moet je opnieuw betalen emo
0
Berichten
665
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Klaasie schreef:
Eerdere citaten tonen
Timbox schreef:
Na je hebt betaald gewoon de DA api..
Dat dacht ik eerst ook,
Dan is het zo;
Je betaald
En dan pas gegevens invoeren emoDat klopt volgensmij niet helemaal?
En als je dan perongeluk de pagina refresht dan moet je opnieuw betalen emo
Ehm, je moet dat allemaal beveiligen ik help je wel effe ermee is niet zo moeilijk yummie
0
Klaasie

Lid · Topicstarter

Berichten
5.498
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke, ik word geholpen door Lwebdesign biggrin
0
Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Misschien is het handig eerst eens PHP en MySQL te leren. Ik heb nog wel een volledige API. Alle functies, zelf geschreven...
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