Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 03/24/2019 in all areas

  1. 2 points
    I assume you know that the sidebar already exists, but is only shown on the invoices page? no you don't - if the client is logged in, you can access the $clientsstats Smarty array from the hook and the variables you need are already there (effectively it's just the same as accessing $vars) - there's no need to go looping though invoices or using the API just to get two variables... and if the client isn't logged in, then the sidebar won't show anyway. the top sidebar is your sidebar (fixed by me!), the bottom is the default one shown on the invoices page... your sidebar will overwrite the default one if the menuitemname values are the same and will appear elsewhere in the clientarea. <?php # Unpaid Invoices Sidebar Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar){ GLOBAL $smarty; $dueinvoices = $smarty->getTemplateVars()['clientsstats']['numunpaidinvoices']; $duebalance = $smarty->getTemplateVars()['clientsstats']['unpaidinvoicesamount']; $filename = APP::getCurrentFileName(); $client = Menu::context("client"); $clientid = (int) $client->id; if ($filename!=='clientarea' || $clientid===0 || $dueinvoices===0){ return; } $primarySidebar->addChild('My Invoices Summary', array('label' => Lang::trans("invoicesdue"),'order' => 1,'icon' => 'fa-money-bill-wave')); $primarySidebar->getChild('My Invoices Summary') ->setBodyHtml(sprintf(Lang::trans("invoicesduemsg"),$dueinvoices,$duebalance)) ->setFooterHtml('<a href="clientarea.php?action=masspay&all=true" class="btn btn-danger btn-sm btn-block">'.$duebalance.'</a>'); }); I suspect the default sidebar will use the Invoice class method to get the number/balance, but there seems little point in reinventing the wheel when we only need two variables and they're both accessible via Smarty. 🙂
  2. 2 points
    @brian! here this full custom already modified <?php namespace WHMCS\Module\Widget; use WHMCS\Carbon; use WHMCS\Module\AbstractWidget; use WHMCS\User\Client; class ClientOnline extends AbstractWidget { protected $title = 'Client Last Login'; protected $weight = 80; protected $cache = true; protected $cacheExpiry = 60; protected $requiredPermission = 'List Clients'; public function getData() { return array( 'client' => Client::orderBy('lastlogin', 'desc')->limit(24) ->get(array('email', 'id', 'firstname', 'lastname', 'ip', 'lastlogin'))->toArray(), ); } public function generateOutput($data) { $clientOutput = ''; $clients = array(); foreach ($data['client'] as $client) { $clientOutput .= '<div class="staff">' . '<a href="clientssummary.php?userid='.$client['id'].'"><img class="body-avatar" src="https://www.gravatar.com/avatar/'.md5($client['email']).'?s=60&d=mm" width="60" height="60"/></a>' . '<div class="name">'.$client['firstname'].' '.$client['lastname'].'</div>' . '<small><a href="http://www.geoiptool.com/en/?IP='.$client['ip'].'" target="_blank" class="name" style="color:red">'.$client['ip'].'</a></small>' . '<div class="note text-muted">' . Carbon::createFromFormat('Y-m-d H:i:s', $client['lastlogin'])->diffForHumans().'</div>' . '</div>'; } return <<<EOF <div class="widget-staff-container clearfix"> {$clientOutput} </div> EOF; } }
  3. 1 point
    Hello Good People, Main site was built with WordPress, using a premium theme, with a heavy modification in design. WHMCS part was done using SIX as base, with mostly css modification, some html modification (mostly header and footer). Front end: https://dctit.host/ WHMCS: https://dctit.host/shop/ View Cart page: https://dctit.host/shop/cart.php?a=view Will appreciate your feedback. Kindly let me know your thoughts. Thanks.
  4. 1 point
    Some people want to show their client's credit balance when they login to client area, as the option not implemented by default in Six Template here is how to do it: 1) Upload the PHP file from Attachements to -> /WHMCS-Path/includes/hooks/ directory. WHMCS_SixTemplateCreditBalance.zip
  5. 1 point
    When i use <script src="//example.com/jQuerys.js?v=<?php echo(rand()); ?>"></script> In normal php file then is generate random number. When i use in modules/servers/cpanel/template/overview.tpl Then code is not working. Please give me solution. Thanks
  6. 1 point
    @HOSKIA INDIA tHere are no WHMCS Staff License, therefore your license is not complaint I would recommend purchasing a license from us directly as the license you are using does not comply with our TOS
  7. 1 point
    @WHMCS Peter's reply on a similar thread might be a another solution:
  8. 1 point
  9. 1 point
    Welcome to WHMCS.Community Analygital! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.
  10. 1 point
    require in the strictest sense, not really... one in-built solution would be to use Product Bundles. now if they chose to, the user could remove one of the products from the cart before checkout - so that's why I said the second product isn't REQUIRED because it can be removed (though I suppose you could price the bundle to encourage them not to remove it). Configurable Options might be another option, but it really depends what configuration this secondary product might need. if you need a commercial alternative, ModulesGarden's Product Linker might be a viable option...
  11. 1 point
    it looks like the SQL queries needed tweaking - i'll attach the updated file rather than posting the entire code, but basically i've just changed the three references of... tblpaymentgateways.* to... tblpaymentgateways.value .. and it's still on my list of things to do to update this widget properly for v7.7+ 📅 admin.php
  12. 1 point
    also, sending a PM to me (and possibly other users) at the weekend and DEMANDING (not asking or requesting) that they write you a hook, is not the way things are done around here.
  13. 1 point
  14. 1 point
    No problem, @SamS1! If there's anything else, don't hesitate to reach out again!
  15. 1 point
    You know, someone like you should be hired at $50 an hour to re-write some of the help / doc articles. I suspect, WHMCS could set-aside a $4,000 budget to invest into your organization and it would pay mega dividends. The spell check thing? jeeze. I mean, mistakes happen but 9 months? Dang... 6 years is no joke. You are a great customer and community role-model. How do you think sentq compares to you? If you guys duked it out on WHCMS wisdom test, you think he would wreck you? If you had access to the actual code, you think you could learn twice as much? Would you even want to learn more? Like that stuff is fun for you? Cheers p.s. - tell your friggin' lawyers to back off!
  16. 1 point
    oh no - it shouldn't have led to more questions! lol i've just instructed my lawyers to begin proceedings for libel against you - I strenuously deny having any part in writing the WHMCS core program! 🙂 as I posted earlier, WHMCS seemingly don't even have a spellchecker! the thing about using WHMCS is that the documentation is so limited, that if you want to do anything worthwhile with it, you really have to get your hands dirty and start playing with the code... and that's increasingly becoming more the case as recent versions are more dependant upon hooks than previous versions - I mean who in their right mind creates a software package where you need to use PHP to alter the menus and sidebars... it's insane... fine, I can do it... but a new user has no chance without reading the documentation... and even then... 🙄 i'm pretty sure before I got my license 2013 (21st March to be exact - 6th year anniversary coming up... jeez six years of banging my head against the brick wall of WHMCS!), I had never played with Smarty - but it's so flexible (especially as it can use PHP) that i'm always reluctant to abandon it to write a hook, but sometimes it's necessary. the trick with WHMCS is when you find that doing x works with one aspect of WHMCS, it probably works with others - so it's just a case of trying to apply the correct solution to a given situation. and there are many people that know more about WHMCS than I do - they just choose not to share that knowledge. 😞 e.g., the WHMCS internal developers will know lots more because a) they're writing the code (not me!) and b) they have access to the decrypted code... which I don't. in this instance, it was just a case of double-checking the knowledgebase database tables and seeing that there are no date fields in the structure...
  17. 1 point
    Welcome to WHMCS.Community sai kit! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.
  18. 1 point
    i'm still inclined to think so. there are none - but a lot of WHMCS is probably still how it was 10 years ago, and this may be one of those occasions. but if the database doesn't store the updated date (or any date), then you're into the realms of having to store the date yourself when you update/create an article in the admin area... but I don't think that there are any specific hook points triggered when editing an article, so no simple way to do this. you can't extract what hasn't been saved. 🙂 no - just what has been programmed to be returned to be available to the template. not necessarily - as you saw with the useful/votes hook that I wrote that just amended the array with new content and returned it to the template... if the dates were naturally in the table, you could use that hook for this, but there are no dates stored. i'm not saying that it couldn't ultimately be done, just that there isn't a quick "here's a hook" solution... it's likely going to need an addon module for this, probably with custom database tables too.
  19. 1 point
    never say never, but they haven't changed in the last 3 years... the same people are still in charge, so I don't expect any of them to have some sort of Damascene conversion and realise the error of their ways... in the short-term, if they all keep their heads down, WHMCS as a company, will trundle along as always with no doubt a nice regular profit... it would be nice if someone senior woke up, realised that all they were doing is pumping out buggy, bloated crap software, terrible support, no documentation to speak of and decide to do something about it... as Tom said, when you can easily predict that a major release is going to be bugged, and you should wait until the first maintenance update, then why doesn't someone at WHMCS Towers realise that something needs to change. now I know some WHMCS staff are unhappy about what goes on at WHMCS (they've told me privately), but what can they do ? it's the people above them who make all the decisions, and it's the poor saps on the front-line who have to take the immediate flak for those decisions. I have to say that if anyone senior at WHMCS is going home at night, proud of what they've produced for the last few years, then they're living in their own deluded world - i'm actually embarrassed on their behalf, even if they aren't themselves. .. and i've seen many users leave WHMCS to go to a competitor, only to come back here a few years later... though I know at least one user closed their account here because they moved to that other software.. and where there's one, there's usually others. to get back to your question about will things ever change - in the way that I think we want to see it go, with 100% being a certainty, and 0% being no chance.... i'd put odds that it's in single figures... low single figures... aka unlikely. and for the avoidance of any doubt, this is not about me coming to the rescue and saving WHMCS - they (senior WHMCS management) have personally disrespected me too many times over the last 4 years, for me to even care about the company or wanting to work for them... my unpaid role here (as decided by me, not them) is to help out fellow WHMCS users where I can (when time and my limited knowledge allows) and, if at all possible, do absolutely nothing to help the company.... there can often be conflicts between those two intentions (me being here answering questions being the most obvious one!), but there are plenty of things I could do to help the company, but I simply won't - that's their loss and at least means that I don't have to be an apologist for the software... as some WHMCS staff seem to be. 🙄
  20. 1 point
    No. 😭 i've always had a secondary system running in the background just in case I need to move on quickly... yep - if they only understood that better documentation would make it easier for more developers to get involved with WHMCS, which would be a good thing.... every update comes with 4 things that you potentially have to deal with... new features - often not even asked for! old features, that you might rely upon, removed without warning. old bugs that never get fixed. new bugs introduced. if you designed billing software today, it shouldn't look anything like WHMCS - the cart should be better (it's the same order process that's been used for the last 6+ years) - actually, when you take a step back, the cart is horrendous when you think of the simple things that it should be able to do, but can't... the admin area hasn't changed dramatically from when I first started, and I thought it looked dated back then... I could go on but i'm pretty sure I said the same thing before v7... control, loss of income, coding quality embarrassment....?? who knows. interesting that their latest release is 8,000 files (compared to 8,500 with WHMCS), yet their filesize is 20MB, WHMCS v7.6 is now 75Mb (and 150MB+ when installed).
  21. 1 point
    there's a lot to ground to cover here, but i'll start by saying that hooks are the most flexible way to do this - not least, because once written, you won't need to re-add the code each time you update WHMCS... and also because there are loads of examples in the forum of nav/sidebar hooks written by myself and sentq - probably whatever you want to do has been posted previously (or is a variation of something already posted)... the downside to hooks is get them wrong, and you can blank out the client area - or sometimes even the admin area! now, having said all that, what you are really asking is: can I make these example changes in the templates? to which the answer is YES! - the coding could get tricky down the road, but if you really want to, it's an option (at least for most things). personally, my first thought would be to change something using a hook, but if I think a hook solution is going to take a while to code/test, then as my father would say, "Sod this for a game of soldiers!" and i'd fix it in the template! so as best I can, i'm going to work though your brief example list and show you how to do them using hooks and/or template tweaks... if I start with removing a navbar child - and I appreciate your questions are really about sidebars, and i'll get to them, but the hook principles are the same whether you're talking about navbars, sidebars or even the homepage panels. so, let's remove the "Home" button from the navbar - as a hook, it would be... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->removeChild('Home'); } }); if you want to do it in the template, then you would simply add a bit of Smarty (if statement) to the includes/navbar.tpl template... {foreach $navbar as $item} {if $item->getName() neq 'Home'} <li menuItemName="{$item->getName()}"{if $item->hasChildren()} class="dropdown"{elseif $item->getClass()} class="{$item->getClass()}"{/if} id="{$item->getId()}"> <a {if $item->hasChildren()}class="dropdown-toggle" data-toggle="dropdown" href="#"{else}href="{$item->getUri()}"{/if}{if $item->getAttribute('target')} target="{$item->getAttribute('target')}"{/if}> {if $item->hasIcon()}<i class="{$item->getIcon()}"></i> {/if} {$item->getLabel()} {if $item->hasBadge()} <span class="badge">{$item->getBadge()}</span>{/if} {if $item->hasChildren()} <b class="caret"></b>{/if} </a> {if $item->hasChildren()} <ul class="dropdown-menu"> {foreach $item->getChildren() as $childItem} <li menuItemName="{$childItem->getName()}"{if $childItem->getClass()} class="{$childItem->getClass()}"{/if} id="{$childItem->getId()}"> <a href="{$childItem->getUri()}"{if $childItem->getAttribute('target')} target="{$childItem->getAttribute('target')}"{/if}> {if $childItem->hasIcon()}<i class="{$childItem->getIcon()}"></i> {/if} {$childItem->getLabel()} {if $childItem->hasBadge()} <span class="badge">{$childItem->getBadge()}</span>{/if} </a> </li> {/foreach} </ul> {/if} </li> {/if} {/foreach} next, let's change the link of the "Home" button on the navbar from index.php to Google - firstly as a hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Home'))) { $primaryNavbar->getChild('Home') ->setURI('http://www.google.com'); } }); ... or as a template tweak, you would change line 3 of navbar.tpl from... <a {if $item->hasChildren()}class="dropdown-toggle" data-toggle="dropdown" href="#"{else}href="{$item->getUri()}"{/if}{if $item->getAttribute('target')} target="{$item->getAttribute('target')}"{/if}> to... <a {if $item->hasChildren()}class="dropdown-toggle" data-toggle="dropdown" href="#"{else}href="{if $item->getName() eq 'Home'}http://www.google.com{else}{$item->getUri()}{/if}"{/if}{if $item->getAttribute('target')} target="{$item->getAttribute('target')}"{/if}> technically, you might run into an issue if you have a child with the same name in both primary and secondary navbars (or sidebars), but I don't think that will occur by default, you'd likely have to engineer the problem to see it! if it ever occurred, it could be easily coded around, but i'm trying to keep the coding simple in these examples. now, your question was really about sidebars, and I assume changing links of a specific child in a sidebar... so let's take the support sidebar shown in the Knowledgebase page... again, i'm going to change the link of the 'Knowledgebase' child to Google - you could change it to another page of your site or whatever you like... so as a hook, it would be... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setURI('http://www.google.com'); } }); or as a template tweak to six/includes/sidebar.tpl ~ line19... <a menuItemName="{$childItem->getName()}" href="{if $childItem->getName() eq 'Knowledgebase'}http://www.google.com{else}{$childItem->getUri()}{/if}" class="list-group-item{if $childItem->isDisabled()} disabled{/if}{if $childItem->getClass()} {$childItem->getClass()}{/if}{if $childItem->isCurrent()} active{/if}"{if $childItem->getAttribute('dataToggleTab')} data-toggle="tab"{/if}{if $childItem->getAttribute('target')} target="{$childItem->getAttribute('target')}"{/if} id="{$childItem->getId()}"> in these template examples, i'm just changing one link... but if you were changing a lot of sidebar links, then you just follow the standard {if} {elseif} and {else} method of checking your conditions. for continuity, i'll stick with using the Knowledgebase child, and now we'll change it's icon to a book as a hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setIcon('fa-book fa-fw'); } }); or as a tweak to sidebar.tpl ~ line21... {if $childItem->hasIcon()}<i class="{if $childItem->getName() eq 'Knowledgebase'}fa fa-book fa-fw{else}{$childItem->getIcon()}{/if}"></i> {/if} as a hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar) { if (!is_null($secondarySidebar->getChild('Support'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setLabel('<b><u>Brian</u></b>'); } }); and as a sidebar tweak in sidebar.tpl ~ line 22... {if $childItem->getName() eq 'Knowledgebase'}<b><u>Brian</u></b>{else}{$childItem->getLabel()}{/if} let's assume the client is logged in and then we'd have access to the $clientsdetails array - in the sidebar template, you could do this to show their firstname in the child label... {if $childItem->getName() eq 'Knowledgebase'}Hello {$clientsdetails.firstname}{else}{$childItem->getLabel()}{/if} and similarly, you could use a language string in the same way as in any other template... in a hook, you'd use the Lang::trans method. https://forum.whmcs.com/showthread.php?114986-Changing-Breadcrumbs-display-EVERY-step-of-the-Navigation https://forum.whmcs.com/showthread.php?124946-template-THEMENAME-includes-pageheader-tpl-and-FA in summary, if you want to edit navbars/sidebars in the templates... to edit navbars, you can edit six (or your custom)/includes/navbar.tpl to edit sidebar, you can edit six (or your custom)/includes/sidebar.tpl I would imagine if you're previously experienced in modifying the old templates, then the principles will be the same in the new templates - you might just have to tweak the precise code to achieve the same outcomes. there's no need to create a new hook file each time you want to change some minor thing - perhaps just have one hook file for navbars and put all your navbar changes in there, a similar one for sidebars etc... and as can be seen above in the very basic examples, hooks can pass HTML, PHP, JS or whatever and there are many ways to do it depending on what you're trying to do and where. and the golden rule - if WHMCS support tell you something can't be done, don't automatically assume that they're right! I can still remember, in the first few months of buying WHMCS, being told definitively by Support that something couldn't be done - after a cup of tea and an hour, i'd figured the solution - and I knew nothing about Smarty or WHMCS software in those days. why they didn't just point you in the direction in the includes/ templates, I simply don't know.
  22. 1 point
    Answering myself: the field I was looking for is in tblpricing, and it's tsetupfee ...
  23. 1 point
    I have setup a remote payment system that once the payment is done, it calls a local file on my wHMCS install that will do the following: 1. check if the user exists 2. if the user isnt registered it creates an account and add an order 3. if the client exists it add the order to his account only. In this case the script will skip the account creation. Here it is my issue. Have no idea how to write the logic in order to skip the user creation if the account already exists. I am testing this snippet found on a forum. It works but as I said, I have no idea how to skip the user creation if the user already exists. Thank you for any help on this. Here it is: <?php $url = "http://domain.com/customers/includes/api.php"; # URL to WHMCS API file goes here $apiusername = "myusername"; # Admin username goes here $apipassword = "mypass"; # Admin password goes here if ($_POST["action"]=="submit") { # Get Values $domain = trim(htmlentities($_POST["domain"])); $firstname = trim(htmlentities($_POST["firstname"])); $lastname = trim(htmlentities($_POST["lastname"])); $companyname = trim(htmlentities($_POST["companyname"])); $email = trim(htmlentities($_POST["email"])); $address1 = trim(htmlentities($_POST["address1"])); $address2 = trim(htmlentities($_POST["address2"])); $city = trim(htmlentities($_POST["city"])); $state = trim(htmlentities($_POST["state"])); $postcode = trim(htmlentities($_POST["postcode"])); $country = trim(htmlentities($_POST["country"])); $phonenumber = trim(htmlentities($_POST["phonenumber"])); $password = trim(htmlentities($_POST["password"])); $password2 = trim(htmlentities($_POST["password2"])); $customfield1 = trim(htmlentities($_POST["customfield1"])); $securityqans = trim(htmlentities($_POST["securityqans"])); $tosagreement = $_POST["accepttos"]; # Error Checking if ($domain == "") { $errors[] = "You did not enter a domain"; } if (ereg('[^a-z0-9.-]', $domain)) { $errors[] = "The domain you entered is not valid."; } if (!$firstname) { $errors[] = "You did not enter your first name."; } if (!$lastname) { $errors[] = "You did not enter your last name."; } if (!$email) { $errors[] = "You did not enter your email address"; } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", $email)) { $errors[] = "The email address you entered is invalid."; } if (!$address1) { $errors[] = "You did not enter the first line of your address."; } if (!$city) { $errors[] = "You did not enter your city."; } if (!$state) { $errors[] = "You did not enter your state."; } if (!$postcode) { $errors[] = "You did not enter your postcode."; } if (!$country) { $errors[] = "You did not enter your country."; } if (!$phonenumber) { $errors[] = "You did not enter your phone number."; } if (!$password) { $errors[] = "You must enter a password"; } elseif ($password!=$password2) { $errors[] = "The password you entered did not match."; } if (!$customfield1) { $errors[] = "You must choose a forum username."; } if (!$securityqans) { $errors[] = "You must provide an answer to your secret question."; } if (!$tosagreement) { $errors[] = "You must agree to the terms of service."; } if (!$errors) { # Submit Order $postfields = array(); $postfields["username"] = $apiusername; $postfields["password"] = md5($apipassword); $postfields["action"] = "addclient"; $postfields["firstname"] = $firstname; $postfields["lastname"] = $lastname; $postfields["companyname"] = $companyname; $postfields["email"] = $email; $postfields["address1"] = $address1; $postfields["address2"] = $address2; $postfields["city"] = $city; $postfields["state"] = $state; $postfields["postcode"] = $postcode; $postfields["country"] = $country; $postfields["phonenumber"] = '0000000000000000'; $postfields["password2"] = $password; $postfields["securityqid"] = $securityqid; $postfields["securityqans"] = $securityqans; $postfields["customfield[1]"] = $customfield1; $query_string = ""; foreach ($postfields AS $k=>$v) { $query_string .= "$k=".urlencode($v)."&"; } $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, $query_string); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $data = curl_exec($ch); if (curl_error($ch)) die("CURL Error: ".curl_error($ch)); curl_close($ch); $data = explode(";",$data); foreach ($data AS $temp) { $temp = explode("=",$temp); $results[$temp[0]] = $temp[1]; } if ($results["result"]=="success") { $clientid = $results["clientid"]; } else { echo 'llop'; die("An error occured1. Please contact support. ({$results['message']})"); } $postfields = array(); $postfields["username"] = $apiusername; $postfields["password"] = md5($apipassword); $postfields["action"] = "addorder"; $postfields["clientid"] = $clientid; $postfields["pid"] = '57'; $postfields["domain"] = $domain; $postfields["domaintype"] = $domaintype; $postfields["billingcycle"] = $billingcycle; $postfields["paymentmethod"] = 'paypal'; $query_string = ""; foreach ($postfields AS $k=>$v) { $query_string .= "$k=".urlencode($v)."&"; } $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, $query_string); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $data = curl_exec($ch); if (curl_error($ch)) die("CURL Error: ".curl_error($ch)); curl_close($ch); $data = explode(";",$data); foreach ($data AS $temp) { $temp = explode("=",$temp); $results[$temp[0]] = $temp[1]; } if ($results["result"]=="success") { $invoiceid = $results["invoiceid"]; header("Location: ".$whmcsurl."dologin.php?username=$email&password=$password&goto=viewinvoice&id=$invoiceid"); exit; } else { die("An error occured2. Please contact support. ({$results['message']})"); } } } ?><html> <head> <title>Order Form</title> </head> <body> <h1>Order Form</h1> <?php if ($errors) { echo "<p>The following errors occured.</p><ul>"; foreach ($errors AS $error) { echo "<li>$error</li>"; } echo "</ul>"; } ?> <form method="post" action="<?php echo $_SERVER["PHP_SELF"] ?>"> <input type="hidden" name="action" value="submit" /> <table> <tr> <td>First Name:</td><td><input type="text" name="firstname" size="30" value="<?php echo $firstname ?>" /></td> <td>Last Name:</td><td><input type="text" name="lastname" size="30" value="<?php echo $lastname ?>" /></td> </tr> <tr> <td>Address 1:</td><td><input type="text" name="address1" value="<?php echo $address1 ?>" size="30" /></td> <td>Address 2:</td><td><input type="text" name="address2" value="<?php echo $address2 ?>" size="30" /></td> </tr> <tr> <td>Company Name:</td><td><input type="text" name="companyname" value="<?php echo $companyname ?>" size="30" /></td> <td>E-mail Address:</td><td><input type="text" name="email" value="<?php echo $email ?>" size="30" /></td> </tr> <tr> <td>City:</td><td><input type="text" name="city" size="30" value="<?php echo $city ?>" /></td> <td>State:</td><td><input type="text" name="state" size="30" value="<?php echo $state ?>" /></td> </tr> <tr> <td>Zip Code:</td><td><input type="text" name="postcode" size="30" value="<?php echo $postcode ?>" /></td> <td>Country:</td><td><select name="country"><option value="AU">Australia</option><option value="CA">Canada</option><option value="IE">Ireland</option><option value="GB">United Kingdom</option><option value="US" selected="selected">United States</option></select></td> </tr> <tr> <td>Phone Number:</td><td><input type="text" name="phonenumber" size="30" value="<?php echo $phonenumber ?>" /></td> <td>(Used by our automated anti-fraud system.)</td><td></td> </tr> <tr> <td>Domain Name:</td><td><input type="text" name="domain" size="20" value="<?php echo $domain ?>" />.CXR.CC</td> <td>(For example.cxr.cc type: <i>example</i>)</td><td></td> </tr> <tr> <td>Forum Username:</td><td><input type="text" size="30" name="customfield1" value=""></td> <td>(Automatically Generated)</td><td></td> </tr> <tr> <td>Password:</td><td><input type="password" name="password" size="30" /></td> <td>Confirm Password</td><td><input type="password" name="password2" size="30" /></td> </tr> <tr> <td>Security Question:</td><td><select name="securityqid"> <option value=2>Mother's maiden name?</option> <option value=3>Name of first pet?</option> <option value=4>Color of first car?</option> <option value=5>Favorite color?</option> </select></td> <td>Security Answer:</td><td><input type="password" name="securityqans" size="30"></td> </tr> <tr> <td colspan="4"> <input type="hidden" name="domaintype" value="selsubdomain" /> <input type="hidden" name="paymentmethod" value="paypal" /> <input type="hidden" name="pid" value="16" /> <input type="hidden" name="billingcycle" value="free" /> <input type="checkbox" name="accepttos" id="accepttos" />I have read and agree to the <a href="http://www.jweb2.com/tos.php" target="_blank">Terms of Service</a><br /> <strong>Please have your phone available because we use an automated telephone system to verify high-risk orders.</strong> <p align="center"><input type="submit" value="Submit Order" /></p> </td> </tr> </table> </form> </body> </html>
  24. 1 point
    You need to join the tblinvoicetiems table with tblhosting to find the service and from the service you can get the package/product id. e.g. select packageid from tblinvoiceitems, tblhosting WHERE tblinvoiceitems.relid = tblhosting.id and tblinvoiceitems.type = 'Hosting' and invoiceid = '123'
  25. 1 point
    I think I found it ... Configuration >> General Settings >> Other >> Allow Client Registration >> Tick this box to allow registration without ordering any products/services
×

Important Information

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