
malin
Member-
Content Count
60 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Hotfixes
Everything posted by malin
-
We know the example code: //Checks transaction number isn't already in the database and ends processing if it does checkCbTransID($transid); I want to know transaction number store in which table.
-
What's the `date` of a tblorders? mysql> select * from tblorders limit 1; +----+------------+--------+-----------+---------------------+-------------+----------------+----------+-----------+-----------+------------+-----------+--------+---------------+-----------+-----------+-----------------+-------------+-------------+-------+ | id | ordernum | userid | contactid | date | nameservers | transfersecret | renewals | promocode | promotype | promovalue | orderdata | amount | paymentmethod | invoiceid | status | ipaddress | fraudmodule | fraudoutput | notes | +----+------------+--------+-----------+---------------------+-------------+----------------+----------+-----------+-----------+------------+-----------+--------+---------------+-----------+-----------+-----------------+-------------+-------------+-------+ | 15 | 9306257830 | 3 | 0 | 2020-01-01 00:03:41 | | | | | | | a:0:{} | 0.00 | alipay_full | 0 | Cancelled | 110.184.220.250 | | | | +----+------------+--------+-----------+---------------------+-------------+----------------+----------+-----------+-----------+------------+-----------+--------+---------------+-----------+-----------+-----------------+-------------+-------------+-------+ Whether the `date` is the order created date? today there is no new order, but there have today's ` date` orders.
-
Hi, In the admin area , in the `addon`'s php file or other customize php file, how can I get my admin `username`?
-
$client_id = $mergefields['client_id']; $service_id = $mergefields['service_id']; $service_product_name = $mergefields['service_product']; $service_obj = Capsule::select(" SELECT * FROM tblhosting WHERE id = $service_id "); $client_obj = Capsule::select(" SELECT * FROM tblclients WHERE id = $client_id "); if(count($client_obj) == 0) { echo gen_return_json(400, array( "msg" => 'there is no this client' )); return; } if(count($service_obj) == 0) { echo gen_return_json(400, array( "msg" => 'there is no this service' )); return; } // echo gen_return_json( // 200, // array( // ' $messagename' => $messagename // ) // ); // return; $command = 'SendAdminEmail'; $postData = array( 'messagename' => 'Dedicated/VPS Server Welcome Email',//$messagename, 'mergefields' => array( 'client_id' => 3,//$client_obj[0] -> id, 'client_name' => $service_obj[0] -> firstname . $service_obj[0] -> lastname , 'service_product_name' => $service_product_name, 'service_domain' => $service_obj[0] -> domain, 'service_dedicated_ip' => $service_obj[0] -> dedicatedip, 'service_assigned_ips' => $service_obj[0] -> assignedips, 'service_password' => decrypt($service_obj[0] -> password), 'service_ns1' => $service_obj[0] -> service_ns1, 'service_ns2' => $service_obj[0] -> service_ns2 ), ); $adminUsername = 'admin123'; // Optional for WHMCS 7.2 and later $results = localAPI($command, $postData, $adminUsername); echo gen_return_json( 200, array( 'sendemail_response' => $results ) ); return; But however, I get `Email Template not found` error: ``` {"sendemail_response":{"result":"error","message":"Email Template not found"}}} ``` I promise there exists this email template:
-
<?php /** * Created by PhpStorm. * User: ldl * Date: 2019/12/25 * Time: 10:24 PM */ try { $mergefields = array( 'client_id' => 3, 'service_id' => 330, 'service_product' => 'This is a product', 'service_domain' => 'sampledomain.com' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, '../../includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'SendAdminEmail', // See https://developers.whmcs.com/api/authentication 'username' => 'admin123', 'password' => 'adminpwd', 'messagename' => 'Dedicated/VPS Server Welcome Email', 'mergefields' => $mergefields,//array('client_id' => 1, 'service_id' => 1, 'service_product' => 'This is a product', 'service_domain' => 'sampledomain.com'), 'responsetype' => $responsetype, ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); echo $response; }catch (Exception $e) { echo $e; return; } echo '200'; return; You see my upper code in a `path-to-whmcs/admin/test05.php`, I follow the [API document](https://developers.whmcs.com/api-reference/sendadminemail/ But it send email fail, there even echo `200`, but the `$response` is blank. there only echo `200`. Who can tell me why there is issue in sendAdminEmail?
-
Hi, what's the `tblhosting`'s password encryption way?
-
In the [addonmodule Controller.php](https://github.com/WHMCS/sample-addon-module/blob/master/modules/addons/addonmodule/lib/Admin/Controller.php): I append this `order_detail` function: ``` /** * @param $vars */ public function order_detail($vars){ $modulelink = $vars['modulelink']; // eg. addonmodules.php?module=addonmodule $version = $vars['version']; // eg. 1.0 $LANG = $vars['_lang']; // an array of the currently loaded language variables $orderid = 28;//isset($_REQUEST['orderid']) ? $_REQUEST['orderid'] : ''; $sql = "SELECT tblhosting.id, tblhosting.regdate, tblhosting.domain, tblhosting.billingcycle, tblhosting.nextduedate, tblhosting.nextinvoicedate, tblhosting.termination_date, tblhosting.domainstatus, tblhosting.username, tblhosting.notes, tblhosting.dedicatedip, tblhosting.assignedips FROM tblhosting "; // $sql .= "LEFT JOIN tblorders ON "; // $sql .= "tblhosting.orderid = tblorders.id "; $sql .= ("WHERE tblhosting.orderid = " . $orderid); $tblhostings = Capsule::select($sql); $table_tbody = ""; for($i = 0; $i < count($tblhostings); $i ++) { $item = $tblhostings[$i]; $row = "<tr>"; $row .= ("<td><input type='text' id='tblhosting-id' name='id' class='form-control' readonly=\"readonly\" style='width:80px;' value='" . $item->id . "'></td>"); $row .= ("<td><textarea id='tblhosting-domain' name='domain' class='form-control' style='width:320px;'>" . $item->domain . "</textarea></td>"); //$row .= ("<td>" . $item->billingcycle . "</td>"); $row .= ("<td ><div style='width:80px;'>" . $item->nextduedate . "</div></td>"); $row .= ("<td ><div style='width:80px;'>" . $item->nextinvoicedate . "</div></td>"); //$row .= ("<td>" . $item->termination_date . "</td>"); //$row .= ("<td>" . $item->username . "</td>"); $row .= ("<td><textarea id='tblhosting-dedicatedip' name='dedicatedip' class='form-control' style='width:200px;'>" . $item->dedicatedip . "</textarea></td>"); $row .= ("<td><textarea id='tblhosting-assignedips' name='assignedips' class='form-control' style='width:200px;'>" . $item->assignedips . "</textarea></td>"); $row .= ("<td>" . $item->domainstatus . "</td>"); $row .= ("<td><div style='width:80px;'>" . $item->regdate . "</div></td>"); $row .= ("<td><textarea id='tblhosting-notes' type='textarea' name='notes' class='form-control' style='width:200px;'>" . $item->notes . "</textarea></td>"); $row .= ("<td> <button id='modify' type='submit' class='btn btn-warning'>modify</button> <button id='send-email' type='button' class='btn btn-success'>Send email</button> </td>"); $row .= "</tr>"; $table_tbody .= $row; } $div = "<div class='container'><div><h2>order ID: {$orderid} :</h2></div>"; $div .= "<div >"; $div .= "<form '><table class='table'>"; $div .= "<thead><tr>"; $div .= "<th>product ID</th>"; $div .= "<th>product name</th>"; //$div .= "<th>billingtype</th>"; $div .= "<th>nextdue</th>"; $div .= "<th>nextvoice</th>"; //$div .= "<th>terminate time</th>"; //$div .= "<th>username</th>"; $div .= "<th>dedicated IP</th>"; $div .= "<th>assigned IP</th>"; $div .= "<th>status</th>"; $div .= "<th>regdate</th>"; $div .= "<th>note</th>"; $div .= "<th>ope</th>"; $div .= "</tr></thead>"; $div .= "<tbody>"; $div .= $table_tbody; $div .= "</tbody>"; $div .= "</table>"; $div .= "</div></div>"; $js = "<script>"; $js .= " var origin_url = window.location.href;//\"http://192.168.33.10/whmcs-nlidc.com/whmcs/admin/addonmodules.php?module=addonmodule&action=order_detail&orderid=100\"; var url_array =origin_url.split(\"/admin/\") var url = url_array[0] + \"/admin/api/admin_apis.php\"; jQuery(document).ready(function(){ $('#modify').click(function(){ //alert('modify'); var id = $('#tblhosting-id').val(); var domain = $('#tblhosting-domain').val(); var dedicatedip = $('#tblhosting-dedicatedip').val(); var assignedips = $('#tblhosting-assignedips').val(); var notes = $('#tblhosting-notes').val(); var params = { admin_api:'update_tblhosting_support', id: id, domain: domain, dedicatedip: dedicatedip, assignedips: assignedips, notes: notes, } $.post(url, params,function(data,status){ //alert(\"Data: \" + data + \"nStatus: \" + status); var data_obj = JSON.parse(data); if (status == 'url' && data_obj.status == 200) { alert('update success'); alert(window.location.href(www.baidu.com);) }else { //alert('update fail'); } }); }) }); jQuery(document).ready(function(){ $('#send-email').click(function(){ alert('send email'); }) }); "; $js .= "</script>"; $html = $div . $js; return <<<EOF $html EOF; } } ``` [![enter image description here][1]][1] I want to use this way to update the `tblhosting` entries. You see my jQuery code want to use `post` method to update the `tblhosting` entry. when I click update button, it will execute the update url, but however it will redirect to this URL ``` http://192.168.33.10/whmcs/admin/addonmodules.php?id=28&domain=10.93.240.193-194(15M%29+HK-Z7-A15++E5-2650%282CPU%29%2F32G%2F500G+ssd%2F++&dedicatedip=10.93.240.193-194&assignedips=10.93.240.193%0D%0A10.93.240.194¬es=02442%2F66655%0D%0A10&intellisearch=1&token=ac271aed87528e68969608329e8a1f4d2a35c858&value= ``` [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/eJRM7.png [2]: https://i.stack.imgur.com/vEw9w.png --- As we know the ajax will not refresh a whole page, and will not redirect by default after request, why there goes different? Who know the way to avoid the redirect? --- I also tried use ``` window.location.href(origin_url); ``` to redirect to back after the wrong redirect, but it will not execute.
-
Every product has a pid link, but when I access it, it redirect to a new URL You see my requests below: [![enter image description here][1]][1] [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/pCD9y.jpg [2]: https://i.stack.imgur.com/Q2phV.jpg ---- There have two HTTP requests, in my browser I request the first URL, you can see there is `bw=20M` param I added in the URI. but in the website it redirect to the second URL(`cart.php?a=confproduct&i=4`). now, in the page `cart.php?a=confproduct&i=4`, how can I get the URL which redirect to current URL?(I mean find the `car.php?a=add&pid=8&carttpl=McSpace&bw=20M`) , I want to get the `bw=20M` param. ---- **EIDT-01** In the cart.php?a=confproduct&i=4 link when I get document.referrer, it shows http://102.24.5.7/dedicated_servers, can not the URL cart.php?a=add&pid=8&carttpl=McSpace&bw=20M.
-
With the WHMCS running, there have many cancelled services. How to deal with them when you run into this issue? You see there have many cancelled serives, 1)whether you delete them? or convert them to other client? 2)if delete them, is it possible to select multi service then delete once?
-
Hi, friends: I have a `b.example.com` for display my website, and I have a requirement, in it there is a login form, I want use my whmcs(exapmle.com)'s login API, when login success, it will transfer to `example.com`. How can we do this? I searched the API index, find a API named [Validate Login](https://developers.whmcs.com/api-reference/validatelogin/), I am not sure whether is this for I use in my `b.example.com` to login clients. So I checked it, there get 403 Forbidden error. Request General: Request URL: http://www.example.com/includes/api.php Request Method: POST Status Code: 403 Forbidden Remote Address: 15.11.42.58:80 Referrer Policy: no-referrer-when-downgrade Request Form data: action: ValidateLogin email: 726gg35611@gmail.com password2: 123456 responsetype: json and my example is with CDN on it.
-
How can I add customized div in `admin/affiliates.php` page?
malin replied to malin's topic in Developer Corner
Because I see the demo of [affiliates plush](https://www.whmcsservices.com/affiliatesplus.php). it achieve this. -
What's the `affaccid` meaning in `tblaffiliatespending`?
malin replied to malin's topic in Developer Corner
The` tblaffiliatesaccounts` instance is Product/Service right? -
Hi, friends: What's the `affaccid` meaning in `tblaffiliatespending`? mysql> select * from tblaffiliatespending limit 12; +----+----------+--------+--------------+ | id | affaccid | amount | clearingdate | +----+----------+--------+--------------+ | 1 | 1 | 0.03 | 2019-12-01 | +----+----------+--------+--------------+
-
Is it possible to show the sum of a month's affilicate commission? ---- I have two questions: 1) in the admin panel I want to show the affilicate one month's commission. 2) Can admin pay the commission to affilicate in a regular time? I mean if I am admin, I want to pay the commission to a affilicate one month's commission in every month's last day.
-
such as item named `$product` of `$products`, I want to use `$product->operating_system` directly.
-
I have custom fields in my product: When I query products: $products = Capsule::table('tblhosting')->where('domainstatus', 'Active')->get(); How can I query out the $products with `custom fields` in it? So I can then use it directly.
-
Thanks your response, brain. From your saying, I read [document](https://docs.whmcs.com/Disk_Space_and_Bandwidth_Overage_Billing#Invoicing > Usage charges are calculated on the last day of each month there do not says whether is the day's last time, is the last day 's ` 23:59` calculated?