Hi,
Ik ben atm bezig met de one2xs sms api alleen 1 probleem.. na je betaling update ben je geen premium om de één of andere reden.. (regel 84) zie hier mijn script:Ik weet dat het script niet 100% veilig is, dat boeit nu ff niet.
Iemand weet waar het aan ligt? Database connectie is gewoon goed.
Ik ben atm bezig met de one2xs sms api alleen 1 probleem.. na je betaling update ben je geen premium om de één of andere reden.. (regel 84) zie hier mijn script:
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/*******
* Voorbeeldscript voor de werking met de SMS API voor one2xs
* Meer informatie: http://www.one2xs.com/smsapiinfo
* Versie 1.1.0
* Copyright one2apps 2009 - 2012
* Datum 12 oktober 2009
* Laatste wijziging: 16 februari 2012
* 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.
* LET OP!!! WERKT ENKEL VOOR NEDERLANDSE BEZOEKERS; MENSEN UIT BELGIÀ‹ KUNNEN DUS MET DEZE API NIET SMSEN ZODAT JIJ ER PUNTEN VOOR KRIJGT.
**/[/COLOR]
[COLOR= #0000BB]$testmodus[/COLOR] [COLOR= #007700]=[/COLOR] false[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$db_host[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]localhost[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$db_username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]db[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$db_password[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]password[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$db_tabel[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]database[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Azdinnn[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// gebruikersnaam op one2xs voor wie gebeld moet worden[/COLOR]
[COLOR= #0000BB]$bedrag[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]2.20[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// het bedrag; je kunt kiezen uit 2.20 of 4.40[/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/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$db_username[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$db_password[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_tabel[/COLOR][COLOR= #007700]);
function[/COLOR] format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$bedrag[/COLOR][COLOR= #007700])[/COLOR] [COLOR= #FF8000]// functie om de bedragen (euros) netjes weer te geven (punten en kommas op de goede plek)[/COLOR]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/number_format"]number_format[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bedrag[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000],[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000].[/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]code[/COLOR][COLOR= #007700]]))[/COLOR] [COLOR= #FF8000]// betaling voorbereiden als er geen telnr en code 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= #FF8000]// api instantie maken voor een betaling van EUR 4,40[/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]
[COLOR= #0000BB]$user_id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]userid[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$user_query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT username FROM leden WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$user_id[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" LIMIT 1"[/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]
[COLOR= #0000BB]$user_fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user_query[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Hallo <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$user_fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong>!<br/>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]SMS <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong> naar <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]telnr[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong> en vul de code die je krijgt hieronder in.<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Dit kost je € [/COLOR][COLOR= #007700].[/COLOR]format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]per_eenheid[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000] per [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]per[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] (totaal dus € [/COLOR][COLOR= #007700].[/COLOR]format[COLOR= #007700]([/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bedrag[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000], want [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$content[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]extra[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]).<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form action="example.php" method="post">Code: <input type="text" name="code" /><input type="hidden" name="userid" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$user_fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /><br /><input type="submit" value="Ok" /></form>[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// Je bent VERPLICHT om het servicenummer, de prijs per eenheid (bijvoorbeel 1,10 euro per SMS) en het totaal aantal SMSjes weer te geven
// Zie http://www.one2xs.com/smsapiinfo 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]
[URL="http://www.php.net/else"]else[/URL]
[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= #FF8000]// verwerking van de betaling[/COLOR]
[COLOR= #0000BB]$api[/COLOR][COLOR= #007700]->[/COLOR]addParam[COLOR= #007700]([/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]);[/COLOR] [COLOR= #FF8000]// SMS code meezenden[/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]1[/COLOR] [COLOR= #007700]||[/COLOR] [COLOR= #0000BB]$testmodus[/COLOR] [COLOR= #007700]==[/COLOR] true[COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden SET premium = 1 WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]userid[/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/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]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]2[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Deze code is al gebruikt in de testmodus.[/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]
?>Iemand weet waar het aan ligt? Database connectie is gewoon goed.
?

