PHP - Whmcs New Frontend
Hi guys! I am working to create a new front end for WHMCS using the backend. Here is what I have so far:
http://inzernettechn...s.com/login.php
http://inzernettechn...om/register.php
http://inzernettechn.../clientarea.php
http://inzernettechn...setPassword.php
e-mail: cody-admin@inzernettechnologies.com
password: cmr432we
(To login to the login and to get to the client area, I know it isn't much but this is what I got done in a couple hours)
I am wondering if someone would like to help with this project with me
I was planning on selling this, so you could get some of the money from sales if you want. If you are interested, please let me know! Thanks!
Similar TutorialsI'm going through my project trying to find a way of separating the backend (the query and php code) from the frontend (html/css). I want to bring the two together with the include function. I've done other but I'm getting confused because the while loops html code. I don't want someone to do this for me, I just what someone to highlight the most logical way. <?php include 'auth.inc.php'; include 'db.inc.php'; include 'buy.inc.php'; //connect to database. $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); //select orders that this user has bought. $query2 = sprintf('SELECT d.name_id, d.order_id, d.order_qty, d.product_code, feedback, p.title, c.email FROM order_details d LEFT JOIN product p ON d.product_code = p.product_code LEFT JOIN contact c ON d.name_id = c.name_id WHERE d.buyer_id = "%u"', mysql_real_escape_string($_SESSION['name_id'])); $result2 = mysql_query($query2, $db) or die(mysql_error()); //echo out the information in a while loop, add pagination? $odd = true; while ($row2 = mysql_fetch_array($result2)) { echo ($odd == true) ? '<tr class="odd_row">' : '<tr class="even_row">'; $odd = !$odd; echo '<td style="text-align: center; width:100px;">' . $row2['title'] . ' <table> <tr> <th colspan="2">Shipping Information</th> </tr><tr> <td>First Name:</td> <td>' . $row2['title']. '</td> </tr><tr> <td>First Name:</td> <td>' . $row2['order_qty']. '</td> </tr><tr> <td>Last Name:</td> <td>' . $row2['product_code']. '</td> </tr><tr> <td>Billing Address:</td> <td>' . $row2['email'] . '</td> <td>' . $row2['order_id'] . '</td> </tr> </table> </tr>'; if ($row2['feedback'] == 0){ echo ' <form action="reputation.php" method="POST"><p>Please give the seller feedback on how you have received your product. <td><input type="hidden" name="name_id" value="' . $row2['name_id'] . '"></td> <td><input type="hidden" name="order_id" value="' . $row2['order_id'] . '"></td> <td><input type="submit" name="submit" value="Feedback"/></td> </form>'; } } ?> I am using WHMCS API and It gives me an array for the first name, last name, etc for the client information
Here is the code I have so far
checkLogin.php
<?php session_start(); echo "ID: " . $_SESSION['clientID']; $postfields = array(); $postfields["action"] = "getclientsdetails"; $postfields["clientid"] = $_SESSION['clientID']; $postfields["stats"] = true; $postfields["responsetype"] = "xml"; echo "<br>"; include('XMLAPI.php'); ?>XMLAPI.php <?php /* *** WHMCS XML API Sample Code *** */ $url = "http://inzernettechnologies.com/billing/includes/api.php"; # URL to WHMCS API file $username = "user"; # Admin username goes here $password = "pass"; # Admin password goes here $postfields["username"] = $username; $postfields["password"] = md5($password); $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, 30); 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); $xml = curl_exec($ch); if (curl_error($ch) || !$xml) $xml = '<whmcsapi><result>error</result>'. '<message>Connection Error</message><curlerror>'. curl_errno($ch).' - '.curl_error($ch).'</curlerror></whmcsapi>'; curl_close($ch); $arr = whmcsapi_xml_parser($xml); # Parse XML print_r($arr); # Output XML Response as Array /* Debug Output - Uncomment if needed to troubleshoot problems echo "<textarea rows=50 cols=100>Request: ".print_r($postfields,true); echo "\nResponse: ".htmlentities($xml)."\n\nArray: ".print_r($arr,true); echo "</textarea>"; */ function whmcsapi_xml_parser($rawxml) { $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $rawxml, $vals, $index); xml_parser_free($xml_parser); $params = array(); $level = array(); $alreadyused = array(); $x=0; foreach ($vals as $xml_elem) { if ($xml_elem['type'] == 'open') { if (in_array($xml_elem['tag'],$alreadyused)) { $x++; $xml_elem['tag'] = $xml_elem['tag'].$x; } $level[$xml_elem['level']] = $xml_elem['tag']; $alreadyused[] = $xml_elem['tag']; } if ($xml_elem['type'] == 'complete') { $start_level = 1; $php_stmt = '$params'; while($start_level < $xml_elem['level']) { $php_stmt .= '[$level['.$start_level.']]'; $start_level++; } $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];'; @eval($php_stmt); } } return($params); } ?>It outputs: ID: 1 Array ( [WHMCSAPI] => Array ( [ACTION] => getclientsdetails [RESULT] => success [CLIENT] => Array ( [USERID] => 1 [ID] => 1 [FIRSTNAME] => Cody [LASTNAME] => Robinson [FULLNAME] => Cody Robinson [COMPANYNAME] => InZernet Technologies [EMAIL] => cody-admin@inzernettechnologies.com [ADDRESS1] => Address [ADDRESS2] => [CITY] => 11 [FULLSTATE] => Michigan [STATE] => Michigan [POSTCODE] => 11111 [COUNTRYCODE] => US [COUNTRY] => US [STATECODE] => MI [COUNTRYNAME] => United States [PHONECC] => 1 [PHONENUMBER] => 1111111111 [PHONENUMBERFORMATTED] => 11111111 [BILLINGCID] => 0 [NOTES] => [PASSWORD] => PASSWORD [TWOFAENABLED] => [CURRENCY] => 1 [DEFAULTGATEWAY] => [CCTYPE] => [CCLASTFOUR] => [SECURITYQID] => 29 [SECURITYQANS] => Rogers [GROUPID] => 0 [STATUS] => Active [CREDIT] => 0.00 [TAXEXEMPT] => [LATEFEEOVERIDE] => [OVERIDEDUENOTICES] => [SEPARATEINVOICES] => [DISABLEAUTOCC] => [EMAILOPTOUT] => 0 [OVERRIDEAUTOCLOSE] => 0 [LANGUAGE] => [LASTLOGIN] => Date: 07/10/2014 17:43 IP Address: xx.xx.xx.xx.xx Host: xx.xx.xx.xx.xx.xx.xx [CUSTOMFIELDS1] => Other [CUSTOMFIELDS] => Array ( [ID] => 1 [VALUE] => Other ) [CURRENCY_CODE] => USD ) [STATS] => Array ( [NUMDUEINVOICES] => 0 [DUEINVOICESBALANCE] => $0.00 USD [INCOME] => $0.00 USD [INCREDIT] => [CREDITBALANCE] => $0.00 USD [NUMOVERDUEINVOICES] => 0 [OVERDUEINVOICESBALANCE] => $0.00 USD [NUMPAIDINVOICES] => 0 [PAIDINVOICESAMOUNT] => $0.00 USD [NUMUNPAIDINVOICES] => 0 [UNPAIDINVOICESAMOUNT] => $0.00 USD [NUMCANCELLEDINVOICES] => 0 [CANCELLEDINVOICESAMOUNT] => $0.00 USD [NUMREFUNDEDINVOICES] => 0 [REFUNDEDINVOICESAMOUNT] => $0.00 USD [NUMCOLLECTIONSINVOICES] => 0 [COLLECTIONSINVOICESAMOUNT] => $0.00 USD [PRODUCTSNUMACTIVEHOSTING] => 0 [PRODUCTSNUMHOSTING] => 0 [PRODUCTSNUMACTIVERESELLER] => 0 [PRODUCTSNUMRESELLER] => 0 [PRODUCTSNUMACTIVESERVERS] => 0 [PRODUCTSNUMSERVERS] => 0 [PRODUCTSNUMACTIVEOTHER] => 0 [PRODUCTSNUMOTHER] => 0 [PRODUCTSNUMACTIVE] => 0 [PRODUCTSNUMTOTAL] => 0 [NUMACTIVEDOMAINS] => 0 [NUMDOMAINS] => 0 [NUMACCEPTEDQUOTES] => 0 [NUMQUOTES] => 0 [NUMTICKETS] => 0 [NUMACTIVETICKETS] => 0 [NUMAFFILIATESIGNUPS] => 0 ) ) )How would I get that information into a variable I tried $params[1]; and that didn't work I tried to remove the return($params); and use it in CheckLogin.php and did echo $params; but it didn't work Any help appreciated!!!!! Hi All, Not sure if you could maybe help with basic PHP cURL coding... I have a module to get products from another site but I keep on getting the error code below: Quote
> ArgumentCountError: Too few arguments to function curlCall(), 1 passed in /clientzone/modules/products.php on line 33 and at least 2 expected in /clientzone/includes/functions.php:0 The PHP code for the error above is: function bright_getAllProducts() { $productRequest = curlCall('http://url'); return $productRequest; } Any idea why the above error is given and how I can resolve it? Edited September 9, 2020 by Brendonm96wrong format |