Jump to content

webix

Member
  • Posts

    8
  • Joined

  • Last visited

  • Days Won

    1

webix last won the day on January 4 2019

webix had the most liked content!

About webix

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

webix's Achievements

Junior Member

Junior Member (1/3)

2

Reputation

  1. Hello Folks. I am trying to do a user verification, user login and ordering using the WHMCS API. The goal is to have a custom frontend cart completely separated from WHMCS (personal reasons). Now, i have this problem: When i use the php code with my browser, my browser IP is passed to WHMCS API instead of the server IP where the php code is hosted. And using the variable $api_access_key is not working (it doesn't bypass the IP check). So... here's my php code: <?php /** * Getting started with the WHMCS API Tutorial */ // Set your WHMCS URL and API Authentication Credentials $whmcsUrl = "shop/"; $apiIdentifier = "API_IDENTIFIER_REMOVED"; $apiSecret = "API_SECRET_REMOVED"; $accesskey = "ACCESS_KEY_REMOVED"; $Email = 'testclient@hotmail.com'; $Senha = md5('testClientPassword'); // Build post values $postfields = array( 'action' => 'ValidateLogin', 'accesskey' => $accesskey, 'identifier' => $apiIdentifier, 'secret' => $apiSecret, 'email' => $Email, 'password2' => $Senha, 'responsetype' => 'json', ); // Call the API $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); $response = curl_exec($ch); if (curl_error($ch)) { die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch)); } curl_close($ch); // Decode response $jsonData = json_decode($response, true); // Dump array structure for inspection var_dump($response); var_dump($jsonData); ?> I have double checked all the authentication informations and they are correct. The result of the above code is: result=error;message=Invalid IP xxx.xxx.xxx.xxx Note 1: This Invalid IP is my own IP and not the IP where the above script and whmcs are hosted. Note 2: On the WHMCS security tab, i added 127.0.0.1 (and also the server public IP address) on API IP Access Restriction. Note 3: The webserver is behind cloudflare.
  2. Hello folks! I am developping a custom control panel for my users to manage their IP addresses (rDNS, etc...). I want they use their email address and password from WHMCS to login on the panel. In order to do that, i made a login form that will pass the POST data (email and password hashed in MD5) to the following function: function validate_login($email, $password) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://XXX.XXXXXXX.XXX/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'ValidateLogin', // See https://developers.whmcs.com/api/authentication 'username' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'password' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXxxXX', 'email' => $username, 'password2' => $password, 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch); curl_close($ch); } The problem is that the function returns in error with the message "Email or Password Invalid". Anyone can help me out to find the error? Best regards
  3. Hello Folks. I am trying to make the languages on a addon that i am developping work and i can't figure out this. My folder structure is this: modules/addons/mycustomaddon/lang -> This is where i am putting the languages files. modules/servers/mycustomaddon -> This is where i am putting my custom addon. The module is working well if i hard code the english on the mycustomaddon.php file. I am following this guide: http://docs.whmcs.com/Addon_Module_Developer_Docs#Multi-Language My english.php example: <?php $_ADDONLANG['ModuleVersion'] = "Module Version"; My mycustomaddon.php: <?php function mycustomaddon_MetaData() { return array( 'DisplayName' => 'mycustomaddon', 'APIVersion' => '1.1', // Use API Version 1.1 'RequiresServer' => true, // Set true if module requires a server to work 'language' => 'english', ); } function xrvteamspeak3_ConfigOptions() { return array( 'Module Version' => array( 'FriendlyName' => $_ADDONLANG['ModuleVersion'], 'Type' => 'text', 'Size' => 25, 'Default' => '1.0', ) ); } // And the file continues. The problem is that the text "Module Version" doesn't show up.
  4. Hello everyone. I am guessing that most of users here on the forum aren't aware of the WHMCS request system. Anyway, i opened 2 requests about a better language support: - Duplicate product bug (translations not duplicated) - multi-language support for configurable options and option to disable existing languages For WHMCS to work on these 2 features, they need to be voted by the community. I also would like to know what you think (community fellows) about these 2 requests (or any other language request). Regards
  5. I just developped this hook: https://forum.whmcs.com/showthread.php?122278-Auto-switch-language-based-on-browser-language&p=491210#post491210
  6. Hello Folks! I looked here in the forums about a way to get auto-translate working on WHMCS and i only found a hook based on ip address. For most of users, IP address is not accurate to get the correct language (example: switzerland has 3 languages: french, italian and german. A spanish living in UK). So, i focused on the browser language. Many people use their computers on their foreign language (browser included) but it's not a rule to follow. So, for those who want to get whmcs showed up with the correct language for the users, i developped the following hook based on another that i found on the whmcs blog for a very old version. Just create the file includes/hooks/switch-language.php and place the following code inside of it: <?php $country_to_language = array( 'default' => 'english', 'AR' => 'arabic', 'AR-DZ' => 'arabic', 'AR-BH' => 'arabic', 'AR-EG' => 'arabic', 'AR-IQ' => 'arabic', 'AR-JO' => 'arabic', 'AR-KW' => 'arabic', 'AR-LB' => 'arabic', 'AR-LY' => 'arabic', 'AR-MA' => 'arabic', 'AR-OM' => 'arabic', 'AR-QA' => 'arabic', 'AR-SA' => 'arabic', 'AR-SY' => 'arabic', 'AR-TN' => 'arabic', 'AR-AE' => 'arabic', 'AR-YE' => 'arabic', 'AZ' => 'azerbaijani', 'CA' => 'catalan', 'ZH' => 'chinese', 'ZH-HK' => 'chinese', 'ZH-CN' => 'chinese', 'ZH-SG' => 'chinese', 'ZH-TW' => 'chinese', 'HR' => 'croatian', 'CS' => 'czech', 'DA' => 'danish', 'NL' => 'dutch', 'NL-BE' => 'dutch', 'EN' => 'english', 'EN-AU' => 'english', 'EN-BZ' => 'english', 'EN-CA' => 'english', 'EN-IE' => 'english', 'EN-JM' => 'english', 'EN-NZ' => 'english', 'EN-PH' => 'english', 'EN-ZA' => 'english', 'EN-TT' => 'english', 'EN-GB' => 'english', 'EN-US' => 'english', 'EN-ZW' => 'english', 'ET' => 'estonian', 'FA' => 'farsi', 'FR' => 'french', 'FR-BE' => 'french', 'FR-CA' => 'french', 'FR-FR' => 'french', 'FR-LU' => 'french', 'FR-MC' => 'french', 'FR-CH' => 'french', 'DE' => 'german', 'DE-AT' => 'german', 'DE-DE' => 'german', 'DE-LI' => 'german', 'DE-LU' => 'german', 'DE-CH' => 'german', 'HE' => 'hebrew', 'HU' => 'hungarian', 'IT' => 'italian', 'IT-CH' => 'italian', 'MK' => 'macedonian', 'NO' => 'norwegian', 'NB' => 'norwegian', 'NN' => 'norwegian', 'PT-BR' => 'portuguese-br', 'PT' => 'portuguese-pt', 'RO' => 'romanian', 'RO-MO' => 'romanian', 'RU' => 'russian', 'RU-MO' => 'russian', 'ES' => 'spanish', 'ES-AR' => 'spanish', 'ES-BO' => 'spanish', 'ES-CL' => 'spanish', 'ES-CO' => 'spanish', 'ES-CR' => 'spanish', 'ES-DO' => 'spanish', 'ES-EC' => 'spanish', 'ES-SV' => 'spanish', 'ES-GT' => 'spanish', 'ES-HN' => 'spanish', 'ES-MX' => 'spanish', 'ES-NI' => 'spanish', 'ES-PA' => 'spanish', 'ES-PY' => 'spanish', 'ES-PE' => 'spanish', 'ES-PR' => 'spanish', 'ES-ES' => 'spanish', 'ES-UY' => 'spanish', 'ES-VE' => 'spanish', 'SV' => 'swedish', 'SV-FI' => 'swedish', 'SV-SV' => 'swedish', 'TR' => 'turkish', 'UK' => 'ukranian', // NOTE: You can add more below ); if(strpos($_SERVER['REQUEST_URI'], $customadminpath) === false && !isset($_SESSION['switch-language']) && $_SESSION['uid'] == false) { $_SESSION['switch-language'] = true; // prevent from redirecting back again in this session // we will add more here.... } $current_country = strtoupper(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $language = $current_country != '' && isset($country_to_language[$current_country]) ? $country_to_language[$current_country] : $country_to_language['default']; if(!isset($_SESSION['Language']) || $_SESSION['Language'] != $language) { $location = '?language='.$language; if($_SERVER['QUERY_STRING'] != '') $location .= '&'.$_SERVER['QUERY_STRING']; ob_clean(); header('location: '.$location); die(); } Once done your whmcs will switch language automatically right away. The hook is loaded automatically. This won't change the currency has it's a bit more invasive. I hope this will help you.
  7. Won't it be simplier to just add: grid_snap: true, [b]step: {$configoption.options[0]['nameonly']},[/b] onChange: function() { On the code? That way the step would be directly defined on the amount itself to be priced. This works perfectly for values that are higher than 2 decimal cases (0.00). But if i want by example price the step of 512 of ram to 0.50$, the slider will multiply 0.50 by 512 instead of multiply it by 1. If someone knows a way to get this done correctly, that would be a huge feature to be implemented. Regards
  8. Hello WHMCS team. I am testing WHMCS since some days now on a local machine and on the side developped an addon. I am very pleased with your product and plan to purchase it. However i am facing an issue with the product upgrades/downgrades. I have a product which change it's value based on a number of connections (yes, it's for a VPN server). This product has a base number of 10 connections and it can go till 200. I did that config easily with the "configurable options" and on initial purchase it works fine. The problem appears when the client want to update the product connections by exemple from 10 to 50, he can't do it because he doesn't have how-to do it. I can't send him to purchase the same product with more connections because that will create another virtual server on my VPN server. I have read your documentation and it's said that if i select the option "Configurable Options" on the product "upgrades" tab, he could upgrade or downgrade the configurable options. But that isn't working. I am doing something wrong or this is a bug? Or is it just a disabled feature because i am still on the 30 day trial period? BTW the WHMCS version is 6.0.1 Regards.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated