wellconnit Posted May 14, 2018 Share Posted May 14, 2018 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. 0 Quote Link to comment Share on other sites More sharing options...
tasgray Posted May 15, 2018 Share Posted May 15, 2018 Any security on that code? 0 Quote Link to comment Share on other sites More sharing options...
wellconnit Posted May 16, 2018 Author Share Posted May 16, 2018 Was really just showing a bit of an example of how it can be done. If you'd like to post an example of how you'd make it more secure i'm sure it'd help many of the other users on here. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.