Jump to content

Search the Community

Showing results for tags 'api'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


WHMCS.Community

  • The latest WHMCS Release
  • The Latest from the WHMCS Team
    • News & Announcements
  • WHMCS.Community
    • Community Announcements
    • Introduce Yourself
  • Using WHMCS
    • Pre-Sales Questions
    • Admin & Configuration Questions
    • Installation, Upgrade, and Import Support
    • Using WHMCS
    • Troubleshooting Issues
    • Vendor Discussions
  • WHMCS Beta Program
    • V7.7 Beta Discussion
  • WHMCS Showcase
    • Showcase Your Site
    • Share Your Best Practices & Tips
  • Developing & Extending WHMCS
    • Third Party Add-ons
    • Service Offers & Requests
    • Developer Corner
    • Building Modules
    • Share Ideas for WHMCS Modules
  • Community Competitions
    • Competitions
  • General Discussions
    • General Discussion
  • General Feedback & Assistance
    • WHMCS.Community Tips & Tricks
  • Third Party Developers's Topics
  • Turkish International Discussions's Topics
  • Russian International Discussions's Topics
  • Spanish International Discussions's Topics
  • Portuguese International Discussions's Topics
  • French International Discussions's Topics
  • Italian International Discussions's Argomenti
  • German International Discussions's Topics
  • WHMCS Brasil's Topics
  • WHMCS Brasil's Tópicos
  • ModulesGarden Club's Topics
  • Hungarian International Discussions's Segítség

WHMCS Version

  • V7 Hotfixes
  • V7.1.x Hotfixes
  • V7.2.x Hotfixes
  • V7.3.x Hotfixes
  • V7.4.x Hotfixes
  • V7.5.x Hotfixes
  • V7.6.x Hotfixes

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 29 results

  1. Hello, community! I'm doing some experiments with the API UpdateTransaction but it looks like it is not working with any combination of parameters. I used the required parameter transactionid and tried to update the fee and description, but nothing happens. The API returns success.
  2. Version 1.0.0

    4 downloads

    An issue has been identified in the 7.4.2 release - published on 9th January, 2018 - that is causing the GetProducts API command not to return product data in the expected format. Data is incorrectly returned as: Array ( [result] => success [totalresults] => )
  3. wellconnit

    Client File Access via API

    Hi All, I've written some PHP to extract client files from the WHMCS database because it's not a native API call. Just opened the thread to share it with anyone who may want to use it. I'm working on another to update the Last Login details also. Create the SQL Connection then Get the Files List - Pass $userID as the clientID - While loop ensures all records are put into the arrary function getfiles($userID) { $conn = new mysqli('DBAddress', 'DBUser', 'DBPW', 'DBName') $result = $conn->query("SELECT * FROM `tblclientsfiles` WHERE userid = $userID"); $rows = array(); while($row = $result->fetch_assoc()) { $rows[] = $row; } return $rows; } $filesData = getfiles($userID); for ($counter = 0; $counter < count($rows); $counter++) { $split = explode("_", $filesData[$counter]['filename']); echo "<tr><td>" . $split['1'] . "</td><td><a href='WHMCSWebsite/attachments" .$filesData[$counter]['filename']. "'>Download</a></td></tr>"; } That should be enough for people to be able to extract the files list and display it through the API.
  4. wellconnit

    Password Reset VIA API

    Hi All, Has anyone successfully worked out a way to generate a forgotten password email from the WHMCS API? It's all good to be able to login to the system but if the user has forgotten their password it's pointless getting them to sign into the WHMCS version of the site when you're using the API to make sure they don't hit that site in the first place? It seems strange that this isn't native to WHMCS already as it aligns with the login process of the normal page? Any help with this is greatly appreciated.. Thanks!
  5. Hi All, Does anyone know if it is possible to make a payment through a custom gateway from outside the WHMCS system? I want to let users pay with a credit card using my custom payment gateway through my own website rather than the WHMCS website, since the API does not have any function built in for payment of invoices from the remote API I was going to try and reference the payment gateway file directly. Is there a clean way to pass through the variables that the payment gateway is looking for or should I $_POST the variables and then just overwrite whatever the gateway file is looking for so that I don't need to change the gateway code that currently functions? Not sure if I will have to manually run the remote API command to AddInvoicePayment to the system depending on whether it is processed or not. Thinking about it like that could this be seen as a functional way of completing a payment? If someone has a cleaner/simpler solution I'd be happy to hear it? Thanks in advance
  6. wellconnit

    Get Customer Files via API?

    Hi Guys, Has anyone managed to access customer files via the API? I'm not sure if there is an API call already for it(if there is, it isn't in the doc's). Otherwise has anyone written one themselves that they are willing to provide insight on?? Thanks.
  7. Hi All, I've been looking for a while to find a solution to how I can display users files in a remote API session. Just wondering if anyone has any experience accessing the database across the remote API, I'd rather not write into the page credentials to access the DB, as secure as it may be. As the API seems to have a few gaps in functionality, I'm planning on running SELECT * FROM `tblclientsfiles` WHERE userid = apiuserid Which will give me the information I need to display links to each of the files and their titles. Any help or examples on how to interface with the DB is much appreciated.
  8. wellconnit

    PDF Invoices via API

    Hi Guys, A much asked for feature over the last few years for API users has been the ability to retrieve PDF Invoices from the system. I stumbled across a link from The Wandering System Admin who has done a great job at dissecting the system and getting it to spit out a PDF invoice. (http://thewanderingsysadmin.net/?p=35) However I'm having a bit of trouble getting it working. I've created the request and passed it $username,$password & a static invoice ID of 10 however I'm getting a response of, I've created the api request file in /includes/api/genpdffile.php however it's still not working. Happy to drop the working code once I get it, because I know a few people are looking for it on here, and WHMCS support are yet to implement this natively. Thanks to anyone with any ideas. Anyone can follow the ticket if they want to keep updated on the issue.
  9. WHMCS: 7.2.3 The DomainWhois JSON API output seems to be missing an opening curly bracket/brace. "result":"success","status":"available","whois":""} Not sure if this is a bug or if I'm doing something wrong? Can someone check if they're seeing the same?
  10. Hi All, I was wondering if someone can point me in the right direction to create a button that will link to the specific customer cPanel. I've got the service details, etc displaying but i'm unsure of the best way to add a button to the page that will take the user to the cPanel screen that the service is related too. I'm guessing I'll need to get an authentication key of some sort but i'm unsure of the steps that I should be taking to get this done. Any assistance is appreciated. Thanks.
  11. wellconnit

    Last Login to via API?

    Hi All, Is there a way to get the Last login details for a client to update when logging in via the API? I've currently implemented it forward facing so the customer can see any unusual activity on their account but if it isn't updating as it's supposed too, it becomes redundant. If anyone has had any success with this, please let me know. Thanks.
  12. battles

    A-Record by product.

    I'm in need of setting an A-record to a specific IP when certain set of products is ordered. Enom and using their API. Would I create a hook?
  13. Hello, good day, recently we move our whmcs to our new hosting, everything works great except this error: Error en el registro CURL Error: 35 - Unknown SSL protocol error in connection to httpapi.com:443 (IP: Moved Permanently The document has moved here. & 62.210.214.28) I think than probably the connection with resellerclub is failing, because the error is displayed in sections than requires connect to resellerclub. searching across the internet I've found than would be the SSL curl version, I've found a few solutions than require change the php code but obviously it's not possible because the whmcs code is encrypted. Anyone has had this issue, do you know how solve it?..thank you so much!!!
  14. Hi, I am using a custom api from easy.gr for registering domains. My problem is when T try register a domain with Greek characters. When I search for a domain with Greek characters, the result is always 'Invalid characters'. Does anybody know how I can make this work correctly and display the availability of Greek domains? Should I ask for help the company who provides the api? Thank you in advance.
  15. MachPanel WHMCS API has been available for many years now and we are further looking to make it more useful thus looking for community help to advise on new features or enhancements will be useful. Currently MachPanel WHMCS API offers: • Customer Management • Reseller Management • Provide Login to control panel links for hosted services in WHMCS interfaces for both Admin and Client. • Auto-create a customer in MachPanel when it is created in WHMCS or create only when the customer subscribes for the service. For Exchange, Hyper-V, Skype for Business, SharePoint, Dynamics 365, Windows webhosting: • Ordering/provisioning, suspend, resume, cancellation, link to manage subscription • Ordering/provisioning, cancellation of Managed Add-on. For detailed information on current features and configuration: http://kb.machsol.com/Downloads/Download/53448 Please let me know how the community can help us with advise on features or enhancements. With regards, Dietger Koopmans, Managing Director MachSol Europe | Amsterdam | The Netherlands Office +31 (0)88 6224765 | http://www.machsol.com
  16. I'm going to transfer my customers to WHMCS with WHMCS APIs, all options worked but when I set valued autosetup and sendemail to false , that order created by WHMCS on my WHM(CPANEL),It does mean true and false does not work in them. what shall I do now ? could you help me please ?
  17. bigideaguy

    WHMCS Slack

    WHMCS Slack allows you to post automatic updates to Slack when events happen in your WHMCS installation you can have an unlimited number of events and an unlimited number of channels. You can even post the same event to multiple channels but with a different message if you would like to. The addon uses WHMCS hooks to post to slack when things happen. The following hooks are available in version 1.0: AddInvoiceLateFee AddInvoicePayment AddTransaction AdminAreaViewQuotePage InvoiceCancelled InvoiceChangeGateway InvoiceCreated InvoicePaid InvoicePaymentReminder InvoiceRefunded InvoiceSplit InvoiceUnpaid LogTransaction ManualRefund QuoteCreated QuoteStatusChange acceptQuote AcceptOrder AddonFraud AfterShoppingCartCheckout CancelOrder DeleteOrder FraudOrder PendingOrder RunFraudCheck ShoppingCartValidateDomain AdminServiceEdit CancellationRequest ServiceDelete ServiceRecurringCompleted AfterModuleChangePackage AfterModuleChangePassword TicketAdminReply TicketClose TicketOpen TicketStatusChange TicketUserReply When editing a hook you can add a channel and the message format you want to post to that channel. Purchase the addon for only $9.99 via our website at http://anveto.com/members/cart.php?a=add&pid=37 Purchase the addon without the encoding in order to make your own modifications for $49.99 at http://anveto.com/members/cart.php?a=add&pid=38
  18. Hi everyone, Here goes a small contribution: ever wanted to connect to a remote API? Add //Documentation: http://guzzle3.readthedocs.io/docs.html //Declare an alias to Guzzle in your project file's use Client to access Guzzle: use \Guzzle\Http\Client; $client = Client('https://' . $url . '/api/{version}', array( 'version' => 'v1', 'request.options' => array( 'auth' => array($user, $pass, 'Basic'), ) )); Anyone contributing on this? All the best!
  19. While doing what seems like a straightforward client update external API call, the response is returned as successful but nothing is changed in the system. The response also returned the client id as null. Example Request Query: (I'm using guzzle to post) array (size=1) 'query' => array (size= 'username' => string 'xxx' (length= 'password' => string 'xxx' (length=32) 'responsetype' => string 'json' (length=4) 'action' => string 'updateclient' (length=12) 'clientid' => int 1266 'firstname' => string 'Test' (length=7) object(stdClass)[113] public 'result' => string 'success' (length=7) public 'clientid' => null Just as a test I removed the clientid from the post fields and I get the expected error: object(stdClass)[113] public 'result' => string 'error' (length=5) public 'message' => string 'Client ID Not Found' (length=19) So is there any undocumented restricts to updating client details or is this a bug?
  20. Hello WHMCS World! We're on the look for a developer who may be available for hire. We're a busy team of developers whose time is limited, so cannot at the moment do this ourselves. It is our hope that someone may be available and experienced enough with API use and WHMCS. In short, we sell themes on a popular marketplace called Envato (more specifically, Themeforest). Right now, we use Vanilla Forums to handle our buyer support, which works great, but we want the convenience of having our support directly integrated with WHMCS. This way, all our business is being conducted within one area verses multiple (ie., on Themeforest, WHMCS, and our Vanilla Forums support). We want to create a new submission / ticket department for buyer support that will make use of the Envato API to check whether or not the buyer is a legitimate buyer of our themes, as well has an active subscription / license for Buyer Support, so those buyers can continue to receive support for the items they've purchased from us. https://build.envato.com/api/ http://themeforest.net/page/item_support_policy Support can be renewed on the item purchases, so it's important that it checks for this license. Though after 6 months on a purchase, if support is not renewed, then they either have to renew or no support is provided to the user as their subscription to it has expired. The short and sweet version of this is, we want it to be similar to Ticksy.com but of course for WHMCS. We'd love to research and accomplish this ourselves, but honestly, we're falling short on availability right now. There are two possibilities in how we can approach this: 1. We require users register and at the time of registration, require inserting the Envato API Key. Then periodically (maybe once a week) it checks to see if the registered user has a valid license. 2. We create a support ticket that when submitted, requires a license key entered that checks on submission. The latter I believe is less convenient. It would be more convenient our users register for support. Then open a ticket under their client account and do not have to worry about constantly inputting their license details with each time they open a support ticket. Though we need a way to display whether or not their licenses are valid for an active support subscription. Ideally, it would be nice if we could send out reminders when their subscription is coming to an end (ie., 30 days prior, then 15 days prior, then 7 days prior, but not required). So we're hoping reaching out to the WHMCS community, we can find someone capable of doing it. If you're interested, please message us or reply with an email address and we'll reach out to you We can go into further details once we begin corresponding. If this sounds of interest, please message us. Thanks in advance!
  21. fws_hosting

    Envato API + WHMCS Tickets

    Hello WHMCS World! We're on the look for a developer who may be available for hire. We're a busy team of developers whose time is limited, so cannot at the moment do this ourselves. It is our hope that someone may be available and experienced enough with API use and WHMCS. In short, we sell themes on a popular marketplace called Envato (more specifically, Themeforest). Right now, we use Vanilla Forums to handle our buyer support, which works great, but we want the convenience of having our support directly integrated with WHMCS. This way, all our business is being conducted within one area verses multiple (ie., on Themeforest, WHMCS, and our Vanilla Forums support). We want to create a new submission / ticket department for buyer support that will make use of the Envato API to check whether or not the buyer is a legitimate buyer of our themes, as well has an active subscription / license for Buyer Support, so those buyers can continue to receive support for the items they've purchased from us. https://build.envato.com/api/ http://themeforest.net/page/item_support_policy Support can be renewed on the item purchases, so it's important that it checks for this license. Though after 6 months on a purchase, if support is not renewed, then they either have to renew or no support is provided to the user as their subscription to it has expired. The short and sweet version of this is, we want it to be similar to Ticksy.com but of course for WHMCS. We'd love to research and accomplish this ourselves, but honestly, we're falling short on availability right now. There are two possibilities in how we can approach this: 1. We require users register and at the time of registration, require inserting the Envato API Key. Then periodically (maybe once a week) it checks to see if the registered user has a valid license. 2. We create a support ticket that when submitted, requires a license key entered that checks on submission. The latter I believe is less convenient. It would be more convenient our users register for support. Then open a ticket under their client account and do not have to worry about constantly inputting their license details with each time they open a support ticket. Though we need a way to display whether or not their licenses are valid for an active support subscription. Ideally, it would be nice if we could send out reminders when their subscription is coming to an end (ie., 30 days prior, then 15 days prior, then 7 days prior, but not required). So we're hoping reaching out to the WHMCS community, we can find someone capable of doing it. If you're interested, please message us or reply with an email address and we'll reach out to you We can go into further details once we begin corresponding. If this sounds of interest, please message us. Thanks in advance!
  22. I know this is a shot in the dark. I am using a custom addon that won't work with whmcs 6, it's pretty straightforward and basically checks hosted sites for a certain html code and returns with a list of site that does or doesn't have the code installed, the sites the do not have the code should be terminated be the module but this is not happening. Here's the code and any help would be much appreciated. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); /** * get "need banner" hosting types list * */ function _bannersforfree_get_banner_hosting_list2() { $db_result = full_query("SELECT b.*, h.name as hosting_name FROM `mod_banners_hosting_types` as b LEFT JOIN `tblproducts` h ON b.hid = h.id WHERE h.type='hostingaccount' ORDER BY `id` DESC"); $result_array = array(); while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result_array[] = $row; } return $result_array; } /** * get hosting data by order id * */ function _bannersforfree_get_hosting_data_by_order_id($order_id = 0) { $db_result = full_query("SELECT * FROM `tblhosting` WHERE orderid='$order_id' LIMIT 1"); $result_array = array(); while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result_array = $row; return $result_array; } return false; } /** * get free hosting users list counter * */ function _bannersforfree_get_hosting_user_counter2($free_package_ids) { $ids = join(',', $free_package_ids); $db_result = full_query("SELECT count(*) as counter FROM `tblhosting` WHERE packageid IN ($ids) AND domainstatus = 'Active' ORDER BY `id`"); $result_row = array(); while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result_row = $row; return $result_row['counter']; break; } return 0; } /** * get free hosting users list * */ function _bannersforfree_get_hosting_users2($free_package_ids, $start_from, $page_size) { $ids = join(',', $free_package_ids); $db_result = full_query("SELECT * FROM `tblhosting` WHERE packageid IN ($ids) AND domainstatus = 'Active' ORDER BY `id` LIMIT $start_from, $page_size"); $result_array = array(); while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result_array[] = $row; } return $result_array; } /** * Update banner * */ function _bannersforfree_update_hosting($id, $status, $suspendedto) { return full_query("UPDATE `tblhosting` SET `domainstatus` = '$status', `overidesuspenduntil` = '$suspendedto' WHERE `id` = '$id' "); } /** * Get banners * */ function _bannersforfree_get_banners2() { $db_result = full_query("SELECT * FROM `mod_banners_banners` ORDER BY `id` DESC"); $result_array = array(); while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result_array[] = $row; } return $result_array; } /** * set setting value by slug * */ function _bannersforfree_set_setting2($slug, $value = '') { return full_query("UPDATE `mod_banners_config` SET `value`='" . $value . "' WHERE `slug` = '" . $slug . "' LIMIT 1"); } /** * Get setting value by slug * */ function _bannersforfree_get_setting2($slug = '') { $db_result = full_query("SELECT * FROM `mod_banners_config` WHERE `slug` = '" . $slug . "' LIMIT 1"); $result = false; while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result = $row; break; } return $result; } /** * Get user * */ function _bannersforfree_get_user($uid) { $db_result = full_query("SELECT * FROM `tblclients` WHERE `id` = '$uid' LIMIT 1"); $result = false; while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result = $row; break; } return $result; } /** * Get email template * */ function _bannersforfree_get_email_template_by_name($name) { $db_result = full_query("SELECT * FROM `tblemailtemplates` WHERE `name` = '$name' LIMIT 1"); $result = false; while ($row = mysql_fetch_array($db_result, MYSQL_ASSOC)) { $result = $row; break; } return $result; } /** * Sending curl post * */ function _curl_post_sender($postfields) { // Get website URL $table = "tblconfiguration"; $fields = "value"; $where = array("setting" => "SystemURL"); $result = select_query($table, $fields, $where); $urldata = mysql_fetch_assoc($result); $url = $urldata['value'] . 'includes/api.php'; // Get username and pass to use in api $table = "tbladmins"; $fields = "id,username,password"; $where = ''; $result = select_query($table, $fields, $where); $data = mysql_fetch_assoc($result); $postfields["username"] = $data['username']; $postfields["password"] = $data['password']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $data = curl_exec($ch); curl_close($ch); return $data; } /** * Make domain suspended * */ function _suspend_domain($domain_id) { $postfields["action"] = "modulesuspend"; $postfields["accountid"] = $domain_id; _curl_post_sender($postfields); } /** * Mail sending * */ function _bannersforfree_mail($uid) { error_reporting(E_ALL); $query = full_query("SELECT value FROM `mod_banners_config` WHERE `slug` = 'cron_email_tpl' LIMIT 1"); $templateid = mysql_fetch_assoc($query); $table = "tblemailtemplates"; $fields = "name"; $where = array("id" => $templateid['value']); $result = select_query($table, $fields, $where); $data = mysql_fetch_assoc($result); $postfields["messagename"] = $data['name']; $postfields["action"] = "sendemail"; $postfields["id"] = $uid; _curl_post_sender($postfields); } /** * Banners cron process * */ function _bannersforfree_cron() { echo "<b>Start checking free hostings</b><br />"; # getting cron settings $cron_limit_array = _bannersforfree_get_setting2('cron_limit'); $cron_last_id_array = _bannersforfree_get_setting2('cron_last_id'); $cron_limit = $cron_limit_array['value']; $cron_last_id = $cron_last_id_array['value']; if (!$cron_limit) { $cron_limit = 100; } if (!$cron_last_id) { $cron_last_id = 0; } echo "<i>Getting settings</i>"; echo "<i>( limit = $cron_limit, start from row# $cron_last_id)</i><br />"; # getting free hosting types $free_hosting_types = _bannersforfree_get_banner_hosting_list2(); $free_ids = array(); foreach ($free_hosting_types as $hosting_free) { $free_ids[] = $hosting_free['hid']; } $free_hostings_list = _bannersforfree_get_hosting_users2($free_ids, $cron_last_id, $cron_limit); $free_hosting_counter = _bannersforfree_get_hosting_user_counter2($free_ids); echo "<i>Getting hosting list...</i><br />"; # save hosting pointer if (($cron_limit + $cron_last_id) < $free_hosting_counter) { _bannersforfree_set_setting2('cron_last_id', $cron_limit + $cron_last_id); } else { _bannersforfree_set_setting2('cron_last_id', 0); } # checking websites $banners = _bannersforfree_get_banners2(); if (!empty($free_hostings_list)) { foreach ($free_hostings_list as $hosting) { $url = $hosting['domain']; echo "Checking <b>$url</b> html<br />"; # getting hosting website html $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, 0); $website_html = curl_exec($ch); curl_close($ch); # compare website html with banners html $banner_founded = false; foreach ($banners as $banner) { $banner_html = htmlspecialchars_decode($banner['html']); if (strpos($website_html, $banner_html) !== false) { $banner_founded = true; break; } } # changing hosting status if banner not found if (!$banner_founded) { //_bannersforfree_update_hosting($hosting['id'], 'Suspended', date("Y-m-d", time() + 60*60*24*3 )); // suspended for 3 days _suspend_domain($hosting['id']); _bannersforfree_mail($hosting['userid']); echo "<i style='color:red'>AD not found</i><br />"; } else { echo "<i style='color:green'>AD found</i><br />"; } } } die('<b>done</b>'); } /** * Hook running before checkout complete page shows * */ function bannersforfree_hook1($vars) { $order_id = $vars['orderid']; $free_hosting_types = _bannersforfree_get_banner_hosting_list2(); $free_ids = array(); foreach ($free_hosting_types as $hosting_free) { $free_ids[] = $hosting_free['hid']; } $current_hosting = _bannersforfree_get_hosting_data_by_order_id($order_id); # if hosting type "may have banner" if (in_array($current_hosting['packageid'], $free_ids)) { # redirect to the banners list header("Location: index.php?m=bannersforfree&ordernumber=" . $vars['ordernumber']); } } if (isset($_GET['action'])) { # banners list on product details page if ($_GET['action'] == "productdetails") { $product_id = (int) $_GET['id']; $current_hosting = _bannersforfree_get_hosting_data_by_order_id($product_id); $free_hostings_array = _bannersforfree_get_banner_hosting_list2(); $free_ids = array(); foreach ($free_hostings_array as $hosting_free) { $free_ids[] = $hosting_free['hid']; } if (in_array($current_hosting['packageid'], $free_ids)) { $_LANG['freehosting'] = 1; } else { $_LANG['freehosting'] = 0; } $banners_list = _bannersforfree_get_banners2(); $output = "<table class='datatable' width='100%' cellspacing='3' cellpadding='3' border='0'>"; $output .= "<tr><th>View</th><th>Code</th></tr>"; foreach ($banners_list as $banner) { $b_id = $banner['id']; $output .= "<tr>"; $output .= "<td>"; $output .= "<div style='width:300px;overflow:auto'>" . htmlspecialchars_decode($banner['html']) . "</div>"; $output .= "</td>"; $output .= "<td>"; $output .= '<textarea cols="40" rows="12" name="banners[' . $b_id . ']">' . $banner['html'] . '</textarea>'; $output .= "</td>"; $output .= "</tr>"; } $output .= "</table>"; $_LANG['bannerslist'] = $output; } # banners cron if ($_GET['action'] == "bannerscron") { _bannersforfree_cron(); } } add_hook("ShoppingCartCheckoutCompletePage", 1, "bannersforfree_hook1"); ?> - - - Updated - - - There's also this file and thats all there is to the addon. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); /** * Addon config hook **/ function bannersforfree_config() { $configarray = array( "name" => "for Hosting", "description" => "", "version" => "1.1", "author" => "", "language" => "english", ); return $configarray; } /** * Plugin activation hook **/ function bannersforfree_activate(){ $query = "CREATE TABLE IF NOT EXISTS `mod_banners_banners` ( `id` INT NOT NULL AUTO_INCREMENT, `html` TEXT NOT NULL, PRIMARY KEY ( `id` ))"; $result1 = full_query($query); $query = "CREATE TABLE IF NOT EXISTS `mod_banners_config` ( `id` INT NOT NULL AUTO_INCREMENT, `slug` VARCHAR (255) NOT NULL, `value` VARCHAR (255) NOT NULL, PRIMARY KEY ( `id` ))"; $result2 = full_query($query); $query = "CREATE TABLE IF NOT EXISTS `mod_banners_hosting_types` ( `id` INT NOT NULL AUTO_INCREMENT, `hid` INT NOT NULL, PRIMARY KEY ( `id` ))"; $result3 = full_query($query); # set default value for cron limit $query = "INSERT INTO `mod_banners_config` VALUES (NULL, 'cron_limit', '100')"; $result4 = full_query($query); $query = "INSERT INTO `mod_banners_config` VALUES (NULL, 'cron_last_id', '0')"; $result5 = full_query($query); $query = "INSERT INTO `mod_banners_config` VALUES (NULL, 'cron_email_tpl', '56')"; $result6 = full_query($query); if(!$result1 || !$result2 || !$result3 || !$result4 || !$result5 || !$result6){ return array('status'=>'error', 'description'=>'There was an error occurred on addon activation'); } else{ return array('status'=>'success', 'description'=>'"Forced Ads for Hosting" addon activated successfully'); } } /** * Addon deactivation hook **/ function bannersforfree_deactivate() { $query = "DROP TABLE IF EXISTS `mod_banners_banners`"; $result1 = full_query($query); $query = "DROP TABLE IF EXISTS `mod_banners_config`"; $result2 = full_query($query); $query = "DROP TABLE IF EXISTS `mod_banners_hosting_types`"; $result3 = full_query($query); if(!$result1 || !$result2 || !$result3){ return array('status'=>'error', 'description'=>'There was an error occurred on addon deactivation'); } else{ return array('status'=>'success', 'description'=>'"Forced Ads for Hosting" addon deactivated successfully'); } } function bannersforfree_clientarea($vars){ if(isset($_GET['ordernumber'])){ $ordernumber = $_GET['ordernumber']; } else{ $ordernumber = 0; } $banners_list = _bannersforfree_get_banners(); foreach($banners_list as $key => $banner){ $banners_list[$key] = htmlspecialchars_decode( $banners_list[$key]['html'] ); } $LANG = $vars['_lang']; return array( 'pagetitle' => 'Banners list', 'breadcrumb' => array('index.php?m=bannersforfree'=>'Banners list'), 'templatefile' => 'clientbannerslist', 'requirelogin' => true, # or false 'vars' => array( 'ordernumber' => $ordernumber, 'banners' => $banners_list, 'text' => $vars['_lang'], ), ); } /** * Addon's admin-sde page **/ function bannersforfree_output(){ # saving data if(!empty($_POST)){ # add new banner if(isset($_POST['newbanner'])){ $new_banner_html = trim( $_POST['newbanner'] ); _bannersforfree_add_banner($new_banner_html); } # update banner if(isset($_POST['banners'])){ if(!empty($_POST['banners'])){ foreach($_POST['banners'] as $b_id => $b_html){ _bannersforfree_update_banner($b_id, $b_html); } } } # remove banner if(isset($_POST['banners'])){ if(!empty($_POST['banners'])){ foreach($_POST['deletebanners'] as $b_id => $flag){ _bannersforfree_remove_banner($b_id); } } } # new "must have banner" hosting if(isset($_POST['newhosting'])){ $hosting_id = (int)$_POST['newhosting']; _bannersforfree_add_banner_hosting($hosting_id); } # delete hosting from "must have banner" list if(isset($_POST['deletehosting'])){ if(!empty($_POST['deletehosting'])){ foreach($_POST['deletehosting'] as $h_id => $flag){ _bannersforfree_remove_banner_hosting($h_id); } } } # set cron limit if(isset($_POST['settings'])){ if(!empty($_POST['settings'])){ foreach($_POST['settings'] as $slug => $value){ _bannersforfree_set_setting($slug, $value); } } } } # new banner form $output = '<form action="addonmodules.php?module=bannersforfree" method="post">'; $output .= '<textarea style="width:100%; height:80px" name="newbanner">Place the HTML code of the AD</textarea><br /><br />'; $output .= '<input type="submit" class="btn btn-success" value="Add New AD" name="msave_bannersforfree" />'; $output .= '</form>'; # banners list $output .= '<br><h2 style="border-bottom: 1px dashed #CCCCCC;font-weight: bold;padding-bottom: 10px;">ADS list</h3>'; # getting banners list $banners_list = _bannersforfree_get_banners(); if(!empty($banners_list)){ $output .= '<form action="addonmodules.php?module=bannersforfree" method="post">'; $output .= "<table class='datatable' width='100%' cellspacing='3' cellpadding='3' border='0'>"; $output .= "<tr><th>Delete</th><th>View</th><th>Code</th></tr>"; foreach($banners_list as $banner){ $b_id = $banner['id']; $output .= "<tr>"; $output .= "<td>"; $output .= "<input type='checkbox' value='1' name='deletebanners[$b_id]' />"; $output .= "</td>"; $output .= "<td>"; $output .= "<div style='width:100%;'>".htmlspecialchars_decode($banner['html'])."</div>"; $output .= "</td>"; $output .= "<td>"; $output .= '<textarea style="width:100%; height:80px" name="banners['.$b_id.']">'.$banner['html'].'</textarea>'; $output .= "</td>"; $output .= "</tr>"; } $output .= "</table>"; $output .= "<br><input type='submit' class='btn primary' value='Update' name='msave_bannersforfree' />"; $output .= "</form>"; } else{ $output .= "<p>Empty list</p>"; } $output .= "<br /><hr /><br />"; $output .= '<br><h2 style="border-bottom: 1px dashed #CCCCCC;font-weight: bold;padding-bottom: 10px;">Hosting Plans</h3>'; # Hosting list # Current "need banner" hosting list $output .= "<div style='float:left; width:50%; margin-right:50px'><h3>List of hosting plans that should has a forced ads.</h3>"; $hosting_with_banner_list = _bannersforfree_get_banner_hosting_list(); if(!empty($hosting_with_banner_list)){ $output .= '<form action="addonmodules.php?module=bannersforfree" method="post">'; $output .= "<table class='datatable' width='100%' cellspacing='3' cellpadding='3' border='0'>"; $output .= "<tr><th width='20'>Delete</th><th>Hosting name</th></tr>"; foreach($hosting_with_banner_list as $hosting){ $h_id = $hosting['id']; $output .= "<tr>"; $output .= "<td>"; $output .= "<input type='checkbox' value='1' name='deletehosting[$h_id]' />"; $output .= "</td>"; $output .= "<td>"; $output .= '<a href="configproducts.php?action=edit&id='.$hosting['id'].'">'.$hosting['hosting_name'].'</a>'; $output .= "</td>"; $output .= "</tr>"; } $output .= "</table>"; $output .= '<br><input type="submit" class="btn primary" value="Update" name="msave_bannersforfree" />'; $output .= '</form>'; } else{ $output .= "<p>Empty list</p>"; } $output .= "</div><div style='float:left; width:40%'>"; # Add new hosting to "need banner" list $output .= "<h3>Add new hosting plan</h3>"; $output .= '<form action="addonmodules.php?module=bannersforfree" method="post">'; $hosting_list = _bannersforfree_get_hosting_types_list(); foreach($hosting_list as $key => $hosting_type){ foreach($hosting_with_banner_list as $h_with_banner){ if($hosting_type['id'] == $h_with_banner['hid']){ unset($hosting_list[$key]); break; } } } if(!empty($hosting_list)){ $output .= '<select name="newhosting">'; foreach($hosting_list as $htype){ $output .= "<option value='".$htype['id']."'>".$htype['name']."</>"; } $output .= '</select>'; $output .= '<br /><br />'; $output .= '<input type="submit" class="btn btn btn-success" value="Add" name="msave_bannersforfree" />'; } else{ $output .= "<p>Hosting types list is empty</p>"; } $output .= '</form></div>'; $output .= "<div style='clear:both'><br /></div>"; //_bannersforfree_get_email_template_list $output .= "<br /><hr /><br />"; # Hosting users list $output .= '<h2 style="border-bottom: 1px dashed #CCCCCC;font-weight: bold;padding-bottom: 10px;">Suspended Websites</h2>'; $free_ids = array(); foreach($hosting_with_banner_list as $hosting_free){ $free_ids[] = $hosting_free['hid']; } if(isset($_GET['host-page'])){ $current_host_page = $_GET['host-page']; } else{ $current_host_page = 1; } if(!empty($free_ids)){ $host_list = _bannersforfree_get_hosting_users($free_ids, $current_host_page); if(!empty($host_list)){ $output .= "<table class='datatable' width='100%' cellspacing='3' cellpadding='3' border='0'>"; # paginator logic $total_hosts = _bannersforfree_get_hosting_user_counter( $free_ids ); $total_hosts_pages = (int) ($total_hosts / 10 ); //$left_link = "<a href='addonmodules.php?module=bannersforfree&host-page=".($current_host_page-1)."'>Prev</a>"; if($current_host_page != 1){ $left_link = "<a href='addonmodules.php?module=bannersforfree&host-page=".($current_host_page-1)."'>Prev</a>"; } else{ $left_link = ''; } //$right_link = "<a href='addonmodules.php?module=bannersforfree&host-page=".($current_host_page+1)."'>Next</a>"; if($current_host_page <= $total_hosts_pages){ $right_link = "<a href='addonmodules.php?module=bannersforfree&host-page=".($current_host_page+1)."'>Next</a>"; } else{ $right_link = ''; } $output .= "<tr><th>Domain</th><th>Status</th><th>Suspend until</th></tr>"; foreach($host_list as $host){ $output .= "<tr>"; $output .= "<td align='center'><a href='clientsservices.php?userid=".$host['userid']."&id=".$host['id']."'>".$host['domain']."</a></td>"; $output .= "<td align='center'>".$host['domainstatus']."</td>"; if($host['domainstatus'] == "Suspended" && $host['overidesuspenduntil'] != "0000-00-00"){ $susp_until_value = $host['overidesuspenduntil']; } else{ $susp_until_value = ''; } $output .= "<td align='center'>".$susp_until_value."</td>"; $output .= "</tr>"; } //if(!empty($left_link)) $output .= "<tr><td align='center' colspan='3'>$left_link $right_link</td></tr>"; $output .= "</table>"; } else{ $output .= "<p>Empty list</p>"; } } else{ $output .= "<p>Empty list</p>"; } # Settings Area $current_cron_limit_array = _bannersforfree_get_setting('cron_limit'); $current_cron_limit = $current_cron_limit_array['value']; $mail_tpl_list = _bannersforfree_get_email_template_list(); $current_cron_tpl_array = _bannersforfree_get_setting('cron_email_tpl'); $current_cron_tpl = $current_cron_tpl_array['value']; # Form $output .= "<br /><hr /><br />"; $output .= '<h2 style="border-bottom: 1px dashed #CCCCCC;font-weight: bold;padding-bottom: 10px;">Addon Settings</h2>'; $output .= '<form action="addonmodules.php?module=bannersforfree" method="post">'; # Cron limit $output .= '<lable for="cron-limit">Set users limit per cron:</label><br /><br />'; $output .= '<input id="cron-limit" type="text" name="settings[cron_limit]" value="'.$current_cron_limit.'" /><br /><br />'; # Choosing email template $output .= '<lable for="cron-email-tpl">Choose email template to send to suspended customers:</label><br /><br />'; if(!empty($mail_tpl_list)){ $output .= "<select id='cron-email-tpl' name='settings[cron_email_tpl]'>"; foreach($mail_tpl_list as $tpl){ $selected = ($current_cron_tpl == $tpl['id']) ? "selected" : ""; $output .= "<option $selected value='".$tpl['id']."'>".$tpl['name']."</option>"; } $output .= "</select>"; } else{ $output .= "<p>Empty list</p>"; } # Submit form $output .= '<br /><br /><input type="submit" class="btn btn-success" value="Save" name="msave_bannersforfree" style="float:left; margin-right:10px"/>'; $output .= '</form>'; # Cron link $output .= " <script> $(document).ready(function(){ $('#cron-popup-link').click(function(){ var cron_load_href = $(this).attr('href'); $('#cron-popup').load( cron_load_href ); $('#cron-popup').dialog(); return false; }); }); </script> <div style='display:none' id='cron-popup' title='Cron'> <p>Cron running...</p> </div> "; $output .= "<a id='cron-popup-link' target='_blank' href='../clientarea.php?action=bannerscron'><input type='button' class='btn-info' value='Run CRON' /></a>"; $output .= "<br />"; echo $output; } /** * get free hosting users list counter **/ function _bannersforfree_get_hosting_user_counter($free_package_ids){ $page_size = 30; $ids = join(',', $free_package_ids); $query = "SELECT count(*) as counter FROM `tblhosting` WHERE packageid IN ($ids) ORDER BY `id`"; $db_result = full_query($query); $result_row = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result_row = $row; return $result_row['counter']; break; } return 0; } /** * get free hosting users list **/ function _bannersforfree_get_hosting_users($free_package_ids, $page_number = 1){ $page_size = 10; $ids = join(',', $free_package_ids); $a = $page_number * $page_size - $page_size; $b = $page_number * $page_size; $query = "SELECT * FROM `tblhosting` WHERE packageid IN ($ids) AND domainstatus!='Cancelled' GROUP BY `domain` ORDER BY `id` DESC LIMIT $a, $page_size"; $db_result = full_query($query); $result_array = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result_array[] = $row; } return $result_array; } /** * set setting valueby slug **/ function _bannersforfree_set_setting($slug, $value = ''){ $query = "UPDATE `mod_banners_config` SET `value`='".$value."' WHERE `slug` = '".$slug."' LIMIT 1"; return full_query($query); } /** * Get setting value by slug **/ function _bannersforfree_get_setting($slug = ''){ $query = "SELECT * FROM `mod_banners_config` WHERE `slug` = '".$slug."' LIMIT 1"; $db_result = full_query($query); $result = false; while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result = $row; break; } return $result; } /** * Remove banner **/ function _bannersforfree_remove_banner_hosting($id = 0){ $query = "DELETE FROM `mod_banners_hosting_types` WHERE `id` = '".$id."' LIMIT 1"; return full_query($query); } /** * Add banner hosting **/ function _bannersforfree_add_banner_hosting($id = ''){ $query = "INSERT INTO `mod_banners_hosting_types` VALUES (NULL, '".$id."')"; return full_query($query); } /** * search hosting in "need banner" list by hosting id **/ function _bannersforfree_search_banner_hosting($id=0){ $query = "SELECT * FROM `mod_banners_hosting_types` ORDER BY `id` DESC LIMIT 1"; $db_result = full_query($query); $result_array = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result_array[] = $row; break; } return $result_array; } /** * get "need banner" hosting types list **/ function _bannersforfree_get_banner_hosting_list(){ $query = "SELECT b.*, h.name as hosting_name FROM `mod_banners_hosting_types` as b LEFT JOIN `tblproducts` h ON b.hid = h.id WHERE h.type='hostingaccount' ORDER BY `id` DESC"; $db_result = full_query($query); $result_array = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result_array[] = $row; } return $result_array; } /** * get hosting types list **/ function _bannersforfree_get_hosting_types_list(){ $query = "SELECT * FROM `tblproducts` WHERE type='hostingaccount' ORDER BY `id` DESC"; $db_result = full_query($query); $result_array = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result_array[] = $row; } return $result_array; } /** * Update banner **/ function _bannersforfree_update_banner($id, $html = ''){ $query = "UPDATE `mod_banners_banners` SET `html` = '".$html."' WHERE `id` = '".$id."' "; return full_query($query); } /** * Remove banner **/ function _bannersforfree_remove_banner($id = 0){ $query = "DELETE FROM `mod_banners_banners` WHERE `id` = '".$id."' LIMIT 1"; return full_query($query); } /** * Add banner **/ function _bannersforfree_add_banner($html_code = ''){ $query = "INSERT INTO `mod_banners_banners` VALUES (NULL, '".$html_code."')"; return full_query($query); } /** * Get email template (only general type) **/ function _bannersforfree_get_email_template_list(){ $query = "SELECT * FROM `tblemailtemplates` WHERE `type` = 'general'"; $db_result = full_query($query); $result = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result[] = $row; } return $result; } /** * Get banners **/ function _bannersforfree_get_banners(){ $query = "SELECT * FROM `mod_banners_banners` ORDER BY `id` DESC"; $db_result = full_query($query); $result_array = array(); while($row = mysql_fetch_array($db_result, MYSQL_ASSOC)){ $result_array[] = $row; } return $result_array; } ?>
  23. I want to do something super simple: I want to create a test order form that submits an order via AJAX. To get to that point I have about 30 stupid questions that need to be answered, and I don't want to spam up these forums with dumb questions like "Where do I save the file?" "What file extension should it have?", etc. If you're willing to help me put together a working demo script using the internal API and answer my questions via chat or email, I'd be happy to pay you for your time (I guess using PayPal?). I guess it's best to PM me. If this isn't an appropriate question (or an appropriate place to ask this question) let me know and I'll delete it.
  24. Hi, We developed a solution that can read all payments of Exact Online and sync them to WHMCS. In WHMCS the status will get paid, with a log of payment. We also offer other solutions or custom Also we developed a script where we can export a csv file for both customers and invoices to import in Exact. We also offer a solution that does this automatically. All syncs are done trough the Exact and WHMCS api's. If you are interested you can email us on sales@onsweb.nl. Also see our website http://www.onsweb.nl. Please send what you want exactly and we will send you a quote. Our company developed a lot of custom scripts for WHMCS, so if you need customization let us know.
  25. This is really just a note for anyone else getting API errors. Our application service stopped talking to WHMCS one day, which lead us down a garden path to nowhere. During our attempts to fix this, we accidently added another API key to our config. Thinking the issue was solved we went back to step one only to find it wasn't. Connecting to the WHMCS server API via a simple PHP script yielded the following: <?xml version="1.0" encoding="utf-8"?> <whmcsapi version="5.3.7-release.1"> <action>gettodoitems</action> <result>success</result> <totalresults>129</totalresults> But from the application server we constantly failed to connect and authenticate. Then we noticed that at the end of the API test result was this: <script pagespeed_no_defer="" type="text/javascript">//<![CDATA[ (function(){var **bunch of jscript**'); //]]></script> Sure enough, ModPageSpeed had been enabled at the server level. A quick .htaccess update (ModPageSpeed Off), and API still testing OK but now our application server is also happy. So the moral of the story? If your application server is not having a good time talking to WHMCS API, check all the normal things, but also check the PageSpeed is not the issue. HTH
×

Important Information

By using this site, you agree to our Terms of Use & Guidelines