templates/de/html/member/member_points_upgrade.tpl -text
templates/de/html/member/member_primera.tpl -text
templates/de/html/member/member_primera_form.tpl -text
-templates/de/html/member/member_primera_mode_choose.tpl -text
templates/de/html/member/member_primera_mode_list.tpl -text
templates/de/html/member/member_primera_mode_list_row.tpl -text
templates/de/html/member/member_primera_mode_pay.tpl -text
-templates/de/html/member/member_primera_mode_withdraw.tpl -text
templates/de/html/member/member_receive_table.tpl -text
templates/de/html/member/member_reflinks_row.tpl -text
templates/de/html/member/member_reflinks_table.tpl -text
templates/de/html/member/member_welcome_header.tpl -text
templates/de/html/member/member_wernis.tpl -text
templates/de/html/member/member_wernis_form.tpl -text
-templates/de/html/member/member_wernis_mode_choose.tpl -text
templates/de/html/member/member_wernis_mode_list.tpl -text
templates/de/html/member/member_wernis_mode_list_row.tpl -text
templates/de/html/member/member_wernis_mode_pay.tpl -text
-templates/de/html/member/member_wernis_mode_withdraw.tpl -text
templates/de/html/member/member_wernis_row.tpl -text
templates/de/html/message.tpl -text
templates/de/html/metadata.tpl -text
define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "312");
+define('CURR_SVN_REVISION', "313");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
define('PRIMERA_ADMIN_CONFIG_TITLE', "Einstellungen zum Primus-Portal:");
define('PRIMERA_ADMIN_MIN_PAYOUT', "Minimumguthaben für Auszahlungen.");
define('PRIMERA_ADMIN_MIN_WITHDRAW', "Minimumguthaben für Einzahlungen.");
-define('PRIMERA_ADMIN_API_NAME', "Primus-Nickname ()");
-define('PRIMERA_ADMIN_API_MD5', "Primera-Account Passwort (Wird als MD5-Hash gespeichert)");
+define('PRIMERA_ADMIN_API_NAME', "Primus-Nickname");
+define('PRIMERA_ADMIN_API_MD5', "Primera-Passwort (Wird als MD5-Hash gespeichert)");
define('PRIMERA_ADMIN_CONFIG_NOTE', "<A href=\"http://www.primusportal.de/r/Quix0r\" target=\"_blank\">Hier</A> können Sie sich ein Primus-Portal-Account holen. <strong>Geben Sie immer Ihren Usernamen von Primus-Portal ein und überprüfen Sie diesen mehrmals! Er wird zum Überweisen von Primera benötigt.");
define('PRIMERA_ADMIN_NO_TRANSFERS', "Derzeit keine Primera transferiert!");
define('PRIMERA_ADMIN_ACCOUNT', "Account bei Primus-Portal");
define('PRIMERA_ADMIN_TYPE', "Überweisungsrichtung");
define('PRIMERA_ADMIN_API_MESSAGE', "Nachricht von Primus-API");
define('PRIMERA_ADMIN_API_STATUS', "Status von Primus-API");
-define('MEMBER_PRIMERA_MODE_CHOOSE', "Möchten Sie Primera zu Ihrem Primus-Portal ausbezahlt bekommen oder Primera hier einzahlen?");
-define('MEMBER_PRIMERA_MODE_CHOOSE2', "Hier klicken um neue Überweisung zu starten...");
define('MEMBER_PRIMERA_MODE_WITHDRAW', "Primera einzahlen");
define('MEMBER_PRIMERA_MODE_PAYOUT', "Primera auszahlen");
define('PRIMERA_STATUS_UNKNWOWN', "Primera-Typ <u>%s</u> unbekannt.");
define('PRIMERA_API_REQUEST_FAILED_OWN', "Überweisung an eigenes Account nicht möglich.");
define('PRIMERA_API_REQUEST_FAILED_AMOUNT', "Konto weist nicht genügend Deckung auf.");
define('PRIMERA_API_REQUEST_FAILED_API_AMOUNT', "Primera-Account weist nicht genügend Deckung auf.");
-define('PRIMERA_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!})");
-define('PRIMERA_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!})");
+define('PRIMERA_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!}), ID: %s");
+define('PRIMERA_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!}), ID: %s");
// Error messages
define('PRIMERA_ERROR_STATUS', "Fehler-Status <u>%s</u> erhalten.");
define('PRIMERA_MEMBER_PAYOUT_MIN_POINTS', "Mindestens auszuzahlendes Primera-Guthaben");
define('PRIMERA_MEMBER_PAYOUT_SUBMIT', "Auszahlung durchführen");
define('PRIMERA_MEMBER_PAYOUT_NOTE', "Ihr Primera-Passwort wird bei {!MAIN_TITLE!} nicht gespeichert. Bitte bei Primera-Betrag nur gerade Beträge eingeben! Überprüfen Sie vor dem Absenden Ihren Primus-Usernamen.");
-define('PRIMERA_MEMBER_ID', "Username bei Primus-Portal: [<A href=\"http://www.primusportal.de/lost_password.php\" target=\"_blank\">Vergessen?</A>]");
+define('PRIMERA_MEMBER_NICKNAME', "Username bei Primus-Portal: [<A href=\"http://www.primusportal.de/lost_password.php\" target=\"_blank\">Vergessen?</A>]");
define('PRIMERA_MEMBER_PASSWORD', "Primera-Passwort (nicht Accountpasswort!): [<A href=\"http://www.primusportal.de/lost_password.php\" target=\"_blank\">Vergessen?</A>]");
define('PRIMERA_MEMBER_AMOUNT', "Zu überweisenden Betrag eingeben:");
define('PRIMERA_MEMBER_MODE_INVALID', "Ungültiger Modus <u>%s</u> erkannt! Bitte links im Menü fortfahren.");
define('WERNIS_ADMIN_TYPE', "Überweisungsrichtung");
define('WERNIS_ADMIN_API_MESSAGE', "Nachricht von WDS66-API");
define('WERNIS_ADMIN_API_STATUS', "Status von WDS66-API");
-define('MEMBER_WERNIS_MODE_CHOOSE', "Möchten Sie Wernis zu Ihrem WDS66-Hauptaccount ausbezahlt bekommen oder Wernis hier einzahlen?");
-define('MEMBER_WERNIS_MODE_CHOOSE2', "Hier klicken um neue Überweisung zu starten...");
define('MEMBER_WERNIS_MODE_WITHDRAW', "Wernis einzahlen");
define('MEMBER_WERNIS_MODE_PAYOUT', "Wernis auszahlen");
define('WERNIS_STATUS_UNKNWOWN', "Wernis-Typ <u>%s</u> unbekannt.");
define('WERNIS_API_REQUEST_FAILED_OWN', "Überweisung an eigenes Account nicht möglich.");
define('WERNIS_API_REQUEST_FAILED_AMOUNT', "Konto weist nicht genügend Deckung auf.");
define('WERNIS_API_REQUEST_FAILED_API_AMOUNT', "API-Konto weist nicht genügend Deckung auf.");
-define('WERNIS_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!})");
-define('WERNIS_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!})");
+define('WERNIS_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!}), ID: %s");
+define('WERNIS_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!}), ID: %s");
// Error messages
define('WERNIS_ERROR_STATUS', "Fehler-Status <u>%s</u> erhalten.");
<?php
/**
- * PrimusInterface
+ * PrimeraApi
* -------------------------------------------
* Mit dieser Klasse ist ein einfacher Primeratransfer von Ihrem Account
* zu dem Account eines bei Primusportal.de registrierten Mitglieds möglich.
* Die Einbindung des Interfaces geschieht folgendermaßen:
* 1. Einbindung der Klasse in Ihr PHP-Auszahlungsskript:
* CODE:
- * require_once( "PFAD/ZU/DER/KLASSE/PrimusInterface.class.php" );
+ * require_once( "PFAD/ZU/DER/KLASSE/PrimeraApi.class.php" );
* $PPUsername = "username"; // Ihr Username bei Primusportal
* $PPPassword = "passwort"; // Ihr Passwort bei Primusportal
*
- * $Interface = new PrimusInterface($PPUsername, $PPPassword);
+ * $Interface = new PrimeraApi($PPUsername, $PPPassword);
* 2. Durchführen einer Auszahlung:
* CODE:
* $Status = $Interface->payPrimera($PayReceiver, $PayAmount, $PayDescription);
/**
* URL für das Interface auf dem Primusserver:
*/
- private $host = "www.primusportal.de";
+ private $host = "http://www.primusportal.de";
private $path = "/transfer.interface.2.0.php";
private $errno = 0;
private $data = array();
+ private $headers = "";
+
/**
* Konstruktor
*/
/**
* Anfrage senden und Rückgabecode in Variable speichern
*/
- function queryApi ( $data = array() ) {
+ private function queryApi ( $data = array() ) {
+ // Base64-encode username and password hash
$data["PrimusInterface_Username"] = base64_encode($this->username);
- $data["PrimusInterface_Password"] = base64_encode(md5($this->password));
+ $data["PrimusInterface_Password"] = base64_encode($this->password);
// Send POST request
- $return = POST_URL($this->host.$this->path);
+ $return = POST_URL($this->host.$this->path, $data);
+
+ // Convert the array into a full string
+ $returnStr = implode("\n", $return);
+
+ // Extract the real content, strip header away
+ $content = explode("<!-- return-start -->", $returnStr);
- $content = explode("<!-- return-start -->", $return);
+ // Store headers away for debugging
+ $this->headers = $content[0];
+
+ // Return the content
return $content[1];
}
*/
public function payPrimera ($Receiver, $Amount, $Description = "") {
$valid = false;
- $PostData = array("PrimusInterface_Action" => "Pay",
+ $postData = array("PrimusInterface_Action" => "Pay",
"PrimusInterface_Receiver" => base64_encode($Receiver),
"PrimusInterface_Amount" => base64_encode($Amount),
"PrimusInterface_Description" => base64_encode($Description) );
- $PostReturn = $this->parseContent( $this->queryApi($PostData) );
+ $postReturn = $this->parseContent( $this->queryApi($postData) );
- $this->data = $PostReturn;
- if ($PostReturn["status"] == "200") {
+ $this->data = $postReturn;
+ if ($postReturn["status"] == "200") {
$valid = true;
}
return $valid;
* - ist er aktiv
* @param string/int $User Userid / Username
*/
- function CheckPrimusUser($User) {
+ public function CheckPrimusUser($User) {
$valid = false;
- $PostData = array("PrimusInterface_Action"=> "CheckPrimusUser",
+ $postData = array("PrimusInterface_Action"=> "CheckPrimusUser",
"PrimusInterface_CheckPrimusUser" => $User);
- $PostReturn = $this->parseContent( $this->queryApi($PostData) );
+ $postReturn = $this->parseContent( $this->queryApi($postData) );
- $this->data = $PostReturn;
+ $this->data = $postReturn;
- if ($PostReturn["status"] == self::PI_USER_CHECK_OK) {
+ if ($postReturn["status"] == self::PI_USER_CHECK_OK) {
$valid = true;
}
return $valid;
/**
* Die Funktion liefer den aktuellen Primerastand
*/
- function getPrimera() {
+ public function getPrimera() {
$primera = false;
- $PostData = array( "PrimusInterface_Action" => "GetPrimera" );
- $PostReturn = $this->parseContent( $this->queryApi($PostData) );
+ $postData = array( "PrimusInterface_Action" => "GetPrimera" );
+ $postReturn = $this->parseContent( $this->queryApi($postData) );
- $this->data = $PostReturn;
- if ($PostReturn["status"] == self::PI_GET_PRIMERA_DONE) {
- $primera = $PostReturn["primera"];
+ $this->data = $postReturn;
+ if ($postReturn["status"] == self::PI_GET_PRIMERA_DONE) {
+ $primera = $postReturn["primera"];
}
return $primera;
}
+ /**
+ * Getter fuer data
+ */
+ public function getData () {
+ return $this->data;
+ }
+}
+
+// Function to test the Primera API by getting the amount. If the returned value
+// is not false the API data is valid, else invalid
+function PRIMERA_TEST_API () {
+ // Get new instance
+ $api = new PrimeraApi($_POST['primera_api_name'], $_POST['primera_api_md5']);
+
+ // Was that fine?
+ return ($api->getPrimera() !== false);
}
+// Execute the withdraw of a sponsor only!
+function PRIMERA_EXECUTE_WITHDRAW ($primusNick, $userMd5, $amount) {
+ global $_CONFIG;
+ // Is the sponsor extension installed?
+ if (!EXT_IS_ACTIVE("sponsor")) {
+ // No, abort here
+ return false;
+ } elseif (!IS_SPONSOR()) {
+ // No sponsor, not allowed to withdraw!
+ return false;
+ }
+
+ // Get new instance
+ $api = new PrimeraApi($primusNick, $userMd5);
+
+ // Prepare purpose
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_WITHDRAW, $_COOKIE['sponsorid']))."\";";
+ eval($eval);
+
+ // Pay the Primera
+ return $api->payPrimera($primusNick, $amount, $purpose);
+}
+// Execute the payout
+function PRIMERA_EXECUTE_PAYOUT ($primusNick, $userMd5, $amount) {
+ global $_CONFIG;
+
+ // Get new instance
+ $api = new PrimeraApi($_CONFIG['primera_api_name'], $_CONFIG['primera_api_md5']);
+
+ // Prepare purpose
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";";
+ eval($eval);
+
+ // Pay the Primera
+ return $api->payPrimera($primusNick, $amount, $purpose);
+}
// [EOF]
-?>
\ No newline at end of file
+?>
// Widthdraw this amount
function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) {
global $_CONFIG;
+
+ // Is the sponsor extension installed?
+ if (!EXT_IS_ACTIVE("sponsor")) {
+ // No, abort here
+ return false;
+ } elseif (!IS_SPONSOR()) {
+ // No sponsor, not allowed to withdraw!
+ return false;
+ }
+
+ // Default is failed attempt
$result = false;
// Prepare the purpose
- $eval = "\$purpose = \"".COMPILE_CODE(WERNIS_API_PURPOSE_WITHDRAW)."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_WITHDRAW, $GLOBALS['userid']))."\";";
eval($eval);
// Prepare the request data
// Payout this amount
function WERNIS_EXECUTE_PAYOUT ($wdsId, $userMd5, $amount) {
global $_CONFIG;
+
+ // Default is failed attempt
$result = false;
// Prepare the purpose
- $eval = "\$purpose = \"".COMPILE_CODE(WERNIS_API_PURPOSE_PAYOUT)."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";";
eval($eval);
// Prepare the request data
$content = array(
'min_payout' => bigintval($_CONFIG['primera_min_payout']),
'min_withdraw' => bigintval($_CONFIG['primera_min_withdraw']),
- 'api_name' => bigintval($_CONFIG['primera_api_name']),
+ 'api_name' => $_CONFIG['primera_api_name'],
'api_md5' => $_CONFIG['primera_api_md5']
);
// Init the content array and points
$content = array(); $points = false;
-// Is the mode set (withdraw or payout)
-if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) {
- // Let the user choose what he wants to do
+// Is the mode set (payout only)
+if (!isset($_GET['mode'])) {
+ // Get referral id
$content['refid'] = bigintval($_CONFIG['primera_refid']);
// Get WDS66 id
// Are there some entries?
if (SQL_NUMROWS($result) == 1) {
// Fetch ID
- list($content['wds66_id']) = SQL_FETCHROW($result);
- }
+ list($content['primus_nickname']) = SQL_FETCHROW($result);
+ } // END - if
// Free result
SQL_FREERESULT($result);
// Is there an ID?
- if ((!empty($content['wds66_id'])) && (!isset($_GET['mode']))) {
+ if ((!empty($content['primus_nickname'])) && (!isset($_GET['mode']))) {
// Then use an other "mode"
$_GET['mode'] = "list";
// Free result
SQL_FREERESULT($result);
} else {
- // Mode chooser! ;-)
- $_GET['mode'] = "choose";
+ // Mode pay
+ $_GET['mode'] = "pay";
}
-} elseif ($_GET['mode'] == "pay") {
+} // END - if
+if ($_GET['mode'] == "pay") {
// Get total points and check if the user can request a payout
$points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
$content['min_points'] = TRANSLATE_COMMA($_CONFIG['primera_min_payout']);
// Get WDS66 id
- $content['wds66_id'] = "";
- $result = SQL_QUERY_ESC("SELECT primera_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
-
- // Are there some entries?
- if (SQL_NUMROWS($result) == 1) {
- // Fetch ID
- list($content['wds66_id']) = SQL_FETCHROW($result);
- }
-
- // Free result
- SQL_FREERESULT($result);
-} elseif ($_GET['mode'] == "withdraw") {
- // Get total points for just displaying them
- $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
-
- // Prepare data for the template
- $content['points'] = TRANSLATE_COMMA($points);
- $content['min_points'] = TRANSLATE_COMMA($_CONFIG['primera_min_withdraw']);
- $content['wds66_id'] = "";
-
- // Get WDS66 id
+ $content['primus_nickname'] = "";
$result = SQL_QUERY_ESC("SELECT primera_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
array($GLOBALS['userid']), __FILE__, __LINE__);
// Are there some entries?
if (SQL_NUMROWS($result) == 1) {
// Fetch ID
- list($content['wds66_id']) = SQL_FETCHROW($result);
+ list($content['primus_nickname']) = SQL_FETCHROW($result);
}
// Free result
if ((isset($_POST['ok'])) && (isset($_GET['mode']))) {
// Check input data depending on the mode and execute the requested mode
switch ($_GET['mode']) {
- case "withdraw": // Widthdraws WDS66 -> This exchange
- // Is the user ID and password set?
- if (empty($_POST['wds66_id'])) {
- // Nothing entered in WDS66 user ID
- LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_USERNAME);
- OUTPUT_HTML("<br />");
- } elseif (empty($_POST['wds66_password'])) {
- // Nothing entered in WDS66 password
- LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_PASSWORD);
- OUTPUT_HTML("<br />");
- } elseif (empty($_POST['amount'])) {
- // Nothing entered in amount
- LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) {
- // Only numbers in account ID!
- LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_USERNAME);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] != bigintval($_POST['amount'])) {
- // Only numbers in amount!
- LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_AMOUNT);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] < $_CONFIG['primera_min_withdraw']) {
- // Not enougth entered!
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_AMOUNT_SMALLER_MIN, bigintval($_CONFIG['primera_min_withdraw'])));
- OUTPUT_HTML("<br />");
- } else {
- // All is fine here so do the withdraw
- $success = PRIMERA_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
- if ($success) {
- // Add it to this amount
- $DEPTH = 0;
- ADD_POINTS_REFSYSTEM($GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct");
-
- // Update the user data as well..
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `primera_userid`=%s WHERE userid=%s LIMIT 1",
- array(bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__);
-
- // All done!
- LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_WITHDRAW_DONE);
- return;
- } elseif ((GET_PRIMERA_ERROR_CODE() == "user_failed") || (GET_PRIMERA_ERROR_CODE() == "own_failed") || (GET_PRIMERA_ERROR_CODE() == "amount_failed")) {
- // Wrong login data
- LOAD_TEMPLATE("admin_settings_saved", false, GET_PRIMERA_ERROR_MESSAGE());
- OUTPUT_HTML("<br />");
- } else {
- // Something went wrong
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_WITHDRAW_FAILED, GET_PRIMERA_ERROR_MESSAGE()));
- OUTPUT_HTML("<br />");
- }
- }
- break;
-
case "pay": // Payout this exchange -> WDS66
// Is the user ID and password set?
- if (empty($_POST['wds66_id'])) {
+ if (empty($_POST['primus_nickname'])) {
// Nothing entered in WDS66 user ID
LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_USERNAME);
OUTPUT_HTML("<br />");
- } elseif (empty($_POST['wds66_password'])) {
+ } elseif (empty($_POST['primera_password'])) {
// Nothing entered in WDS66 password
LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_PASSWORD);
OUTPUT_HTML("<br />");
// Nothing entered in amount
LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT);
OUTPUT_HTML("<br />");
- } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) {
+ } elseif ($_POST['primus_nickname'] != bigintval($_POST['primus_nickname'])) {
// Only numbers in account ID!
LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_USERNAME);
OUTPUT_HTML("<br />");
LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points)));
OUTPUT_HTML("<br />");
} else {
- // All is fine here so do the withdraw
- $success = PRIMERA_EXECUTE_PAYOUT($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
+ // All is fine here so do the payout
+ $success = PRIMERA_EXECUTE_PAYOUT($_POST['primus_nickname'], md5($_POST['primera_password']), $_POST['amount']);
if ($success) {
// Default is locked!
$locked = true;
if ($_CONFIG['ref_payout'] == "0") {
// Yes, "pay" it now
$locked = false;
- }
+ } // END - if
// Remove the points from the account
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `used_points` = `used_points` + %s, `primera_userid`=%s WHERE userid=%s LIMIT 1",
- array(bigintval($_POST['amount']), bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__);
+ array(bigintval($_POST['amount']), bigintval($_POST['primus_nickname']), $GLOBALS['userid']), __FILE__, __LINE__);
// All done!
LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_PAYOUT_DONE);
OUTPUT_HTML("<br />");
} else {
// Something went wrong
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_WITHDRAW_FAILED, GET_PRIMERA_ERROR_MESSAGE()));
+ LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_PAYOUT_FAILED, GET_PRIMERA_ERROR_MESSAGE()));
OUTPUT_HTML("<br />");
}
}
// Init the content array and points
$content = array(); $points = false;
-// Is the mode set (withdraw or payout)
-if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) {
- // Let the user choose what he wants to do
+// Is the mode set (payout only!)
+if (!isset($_GET['mode'])) {
+ // Get referal id
$content['refid'] = bigintval($_CONFIG['wernis_refid']);
// Get WDS66 id
// Free result
SQL_FREERESULT($result);
} else {
- // Mode chooser! ;-)
- $_GET['mode'] = "choose";
+ // Mode pay
+ $_GET['mode'] = "pay";
}
-} elseif ($_GET['mode'] == "pay") {
+}
+if ($_GET['mode'] == "pay") {
// Get total points and check if the user can request a payout
$points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
list($content['wds66_id']) = SQL_FETCHROW($result);
}
- // Free result
- SQL_FREERESULT($result);
-} elseif ($_GET['mode'] == "withdraw") {
- // Get total points for just displaying them
- $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
-
- // Prepare data for the template
- $content['points'] = TRANSLATE_COMMA($points);
- $content['min_points'] = TRANSLATE_COMMA($_CONFIG['wernis_min_withdraw']);
- $content['wds66_id'] = "";
-
- // Get WDS66 id
- $result = SQL_QUERY_ESC("SELECT wernis_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
-
- // Are there some entries?
- if (SQL_NUMROWS($result) == 1) {
- // Fetch ID
- list($content['wds66_id']) = SQL_FETCHROW($result);
- }
-
// Free result
SQL_FREERESULT($result);
} else {
if ((isset($_POST['ok'])) && (isset($_GET['mode']))) {
// Check input data depending on the mode and execute the requested mode
switch ($_GET['mode']) {
- case "withdraw": // Widthdraws WDS66 -> This exchange
- // Is the user ID and password set?
- if (empty($_POST['wds66_id'])) {
- // Nothing entered in WDS66 user ID
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_USERNAME);
- OUTPUT_HTML("<br />");
- } elseif (empty($_POST['wds66_password'])) {
- // Nothing entered in WDS66 password
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_PASSWORD);
- OUTPUT_HTML("<br />");
- } elseif (empty($_POST['amount'])) {
- // Nothing entered in amount
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_AMOUNT);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) {
- // Only numbers in account ID!
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_USERNAME);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] != bigintval($_POST['amount'])) {
- // Only numbers in amount!
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_AMOUNT);
- OUTPUT_HTML("<br />");
- } elseif ($_POST['amount'] < $_CONFIG['wernis_min_withdraw']) {
- // Not enougth entered!
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval($_CONFIG['wernis_min_withdraw'])));
- OUTPUT_HTML("<br />");
- } else {
- // All is fine here so do the withdraw
- $success = WERNIS_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
- if ($success) {
- // Add it to this amount
- $DEPTH = 0;
- ADD_POINTS_REFSYSTEM($GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct");
-
- // Update the user data as well..
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `wernis_userid`=%s WHERE userid=%s LIMIT 1",
- array(bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__);
-
- // All done!
- LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_WITHDRAW_DONE);
- return;
- } elseif ((GET_WERNIS_ERROR_CODE() == "user_failed") || (GET_WERNIS_ERROR_CODE() == "own_failed") || (GET_WERNIS_ERROR_CODE() == "amount_failed")) {
- // Wrong login data
- LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE());
- OUTPUT_HTML("<br />");
- } else {
- // Something went wrong
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_WITHDRAW_FAILED, GET_WERNIS_ERROR_MESSAGE()));
- OUTPUT_HTML("<br />");
- }
- }
- break;
-
case "pay": // Payout this exchange -> WDS66
// Is the user ID and password set?
if (empty($_POST['wds66_id'])) {
LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points)));
OUTPUT_HTML("<br />");
} else {
- // All is fine here so do the withdraw
+ // All is fine here so do the payout
$success = WERNIS_EXECUTE_PAYOUT($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']);
if ($success) {
// Default is locked!
OUTPUT_HTML("<br />");
} else {
// Something went wrong
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_WITHDRAW_FAILED, GET_WERNIS_ERROR_MESSAGE()));
+ LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_PAYOUT_FAILED, GET_WERNIS_ERROR_MESSAGE()));
OUTPUT_HTML("<br />");
}
}
<TR>
<TD class="admin_header bottom2 right2" align="center" width="60"><STRONG>{--ID_SELECT--}</STRONG></TD>
<TD class="admin_header bottom2 right2" align="center" width="90"><STRONG>{--_UID--}</STRONG></TD>
- <TD class="admin_header bottom2 right2" align="center"><STRONG>{--PRIMERA_ADMIN_WDS66_ACCOUNT--}</STRONG></TD>
+ <TD class="admin_header bottom2 right2" align="center"><STRONG>{--PRIMERA_ADMIN_ACCOUNT--}</STRONG></TD>
<TD class="admin_header bottom2 right2" align="center"><STRONG>{--PRIMERA_ADMIN_TRANSFERED--}</STRONG></TD>
<TD class="admin_header bottom2 right2" align="center" width="160"><STRONG>{--PRIMERA_ADMIN_TIMESTAMP--}</STRONG></TD>
<TD class="admin_header bottom2 right2" align="center" width="160"><STRONG>{--PRIMERA_ADMIN_TYPE--}</STRONG></TD>
+++ /dev/null
-<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed">
- <tr>
- <td class="member_title2 bottom2" style="padding: 5px" colspan="2">
- {--MEMBER_PRIMERA_MODE_CHOOSE--}</td>
- </tr>
- <tr>
- <td width="50%" align="center" class="right2" height="40">
- <a class="menu_blur" style="height: 40px" href="{!URL!}/modules.php?module=login&what=primera&mode=withdraw"><div style="padding-top: 10px">{--MEMBER_PRIMERA_MODE_WITHDRAW--}</div></a>
- </td>
- <td width="50%" align="center">
- <a class="menu_blur" style="height: 40px" href="{!URL!}/modules.php?module=login&what=primera&mode=pay"><div style="padding-top: 3px">{--MEMBER_PRIMERA_MODE_PAYOUT--}</div></a>
- </td>
- </tr>
-</table>
-
-<p align="center">
- <a href="http://www.wds66.com/ref.php?refid=$content[refid]" target="_blank">{--PRIMERA_MEMBER_NO_ACCOUNT--}</a>
-</p>
<TD colspan="3" height="3" class="seperator"> </TD>
</TR>
<TR>
- <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_WDS66_ID--}</TD>
+ <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_NICKNAME--}</TD>
<TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="text" name="wds66_id" size="6" maxlength="5" value="$content[wds66_id]" /></TD>
+ <TD width="115"><INPUT type="text" name="primus_nickname" size="10" maxlength="255" value="$content[primus_nickname]" /></TD>
</TR>
<TR>
- <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_WDS66_PASSWORD--}</TD>
+ <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_PASSWORD--}</TD>
<TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="password" name="wds66_password" size="10" maxlength="255" /></TD>
+ <TD width="115"><INPUT type="password" name="primera_password" size="10" maxlength="255" /></TD>
</TR>
<TR>
- <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_WDS66_AMOUNT--}</TD>
+ <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_AMOUNT--}</TD>
<TD width="10" class="seperator"> </TD>
<TD width="115"><INPUT type="text" name="amount" size="10" maxlength="255" /></TD>
</TR>
+++ /dev/null
-<FORM action="{!URL!}/modules.php?module=login&what=primera&mode=withdraw" method="POST" style="margin-bottom: 0px">
-<TABLE border="0" cellspacing="0" cellpadding="0" width="440" class="member_table dashed">
- <TR>
- <TD colspan="3" align="center" class="member_title2 bottom2"
- height="30"><STRONG>{--PRIMERA_MEMBER_WITHDRAW_TITLE--}</STRONG></TD>
- </TR>
- <TR>
- <TD width="315" class="bottom2" height="25" align="right">{--PRIMERA_MEMBER_WITHDRAW_POINTS_ACCOUNT--}</TD>
- <TD width="10" class="seperator bottom2"> </TD>
- <TD width="115" class="bottom2"><strong>$content[points]</strong> Primera</TD>
- </TR>
- <TR>
- <TD width="315" class="bottom2" height="25" align="right">{--PRIMERA_MEMBER_WITHDRAW_MIN_POINTS--}</TD>
- <TD width="10" class="seperator bottom2"> </TD>
- <TD width="115" class="bottom2"><strong>$content[min_points]</strong> Primera</TD>
- </TR>
- <TR>
- <TD colspan="3" height="3" class="seperator"> </TD>
- </TR>
- <TR>
- <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_WDS66_ID--}</TD>
- <TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="text" name="wds66_id" size="6" maxlength="5" value="$content[wds66_id]" /></TD>
- </TR>
- <TR>
- <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_WDS66_PASSWORD--}</TD>
- <TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="password" name="wds66_password" size="10" maxlength="255" /></TD>
- </TR>
- <TR>
- <TD width="315" height="35" align="right">{--PRIMERA_MEMBER_WDS66_AMOUNT--}</TD>
- <TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="text" name="amount" size="10" maxlength="255" /></TD>
- </TR>
- <TR>
- <TD colspan="3" height="3" class="seperator bottom2"> </TD>
- </TR>
- <TR>
- <TD colspan="3" align="center" class="member_footer">
- <INPUT type="reset" class="member_reset" value="{--CLEAR_FORM--}"> *
- <INPUT type="submit" name="ok" class="member_submit" value="{--PRIMERA_MEMBER_WITHDRAW_SUBMIT--}">
- </TD>
- </TR>
-</TABLE>
-<br />
-<STRONG class="member_note"> {--PRIMERA_MEMBER_WITHDRAW_NOTE--}</STRONG>
-</FORM>
+++ /dev/null
-<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed">
- <tr>
- <td class="member_title2 bottom2" style="padding: 5px" colspan="2">
- {--MEMBER_WERNIS_MODE_CHOOSE--}</td>
- </tr>
- <tr>
- <td width="50%" align="center" class="right2" height="40">
- <a class="menu_blur" style="height: 40px" href="{!URL!}/modules.php?module=login&what=wernis&mode=withdraw"><div style="padding-top: 10px">{--MEMBER_WERNIS_MODE_WITHDRAW--}</div></a>
- </td>
- <td width="50%" align="center">
- <a class="menu_blur" style="height: 40px" href="{!URL!}/modules.php?module=login&what=wernis&mode=pay"><div style="padding-top: 3px">{--MEMBER_WERNIS_MODE_PAYOUT--}</div></a>
- </td>
- </tr>
-</table>
-
-<p align="center">
- <a href="http://www.wds66.com/ref.php?refid=$content[refid]" target="_blank">{--WERNIS_MEMBER_NO_ACCOUNT--}</a>
-</p>
+++ /dev/null
-<FORM action="{!URL!}/modules.php?module=login&what=wernis&mode=withdraw" method="POST" style="margin-bottom: 0px">
-<TABLE border="0" cellspacing="0" cellpadding="0" width="440" class="member_table dashed">
- <TR>
- <TD colspan="3" align="center" class="member_title2 bottom2"
- height="30"><STRONG>{--WERNIS_MEMBER_WITHDRAW_TITLE--}</STRONG></TD>
- </TR>
- <TR>
- <TD width="315" class="bottom2" height="25" align="right">{--WERNIS_MEMBER_WITHDRAW_POINTS_ACCOUNT--}</TD>
- <TD width="10" class="seperator bottom2"> </TD>
- <TD width="115" class="bottom2"><strong>$content[points]</strong> Wernis</TD>
- </TR>
- <TR>
- <TD width="315" class="bottom2" height="25" align="right">{--WERNIS_MEMBER_WITHDRAW_MIN_POINTS--}</TD>
- <TD width="10" class="seperator bottom2"> </TD>
- <TD width="115" class="bottom2"><strong>$content[min_points]</strong> Wernis</TD>
- </TR>
- <TR>
- <TD colspan="3" height="3" class="seperator"> </TD>
- </TR>
- <TR>
- <TD width="315" height="35" align="right">{--WERNIS_MEMBER_WDS66_ID--}</TD>
- <TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="text" name="wds66_id" size="6" maxlength="5" value="$content[wds66_id]" /></TD>
- </TR>
- <TR>
- <TD width="315" height="35" align="right">{--WERNIS_MEMBER_WDS66_PASSWORD--}</TD>
- <TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="password" name="wds66_password" size="10" maxlength="255" /></TD>
- </TR>
- <TR>
- <TD width="315" height="35" align="right">{--WERNIS_MEMBER_WDS66_AMOUNT--}</TD>
- <TD width="10" class="seperator"> </TD>
- <TD width="115"><INPUT type="text" name="amount" size="10" maxlength="255" /></TD>
- </TR>
- <TR>
- <TD colspan="3" height="3" class="seperator bottom2"> </TD>
- </TR>
- <TR>
- <TD colspan="3" align="center" class="member_footer">
- <INPUT type="reset" class="member_reset" value="{--CLEAR_FORM--}"> *
- <INPUT type="submit" name="ok" class="member_submit" value="{--WERNIS_MEMBER_WITHDRAW_SUBMIT--}">
- </TD>
- </TR>
-</TABLE>
-<br />
-<STRONG class="member_note"> {--WERNIS_MEMBER_WITHDRAW_NOTE--}</STRONG>
-</FORM>