
malin
Member-
Content Count
60 -
Joined
-
Last visited
-
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?