Jump to content

markhughes

Member
  • Posts

    28
  • Joined

  • Last visited

Everything posted by markhughes

  1. Are you trying to decrypt the password of a client? You can't. You can only decrypt service and server passwords/hashes. The client passwords are a one-way hash, using bcrypt. You can't even use a rainbow table as they are all attached with a unique salt. You generally use GetClientPassword to set a session. What are you trying to do?
  2. You have to use the new WHMCS\ClientArea class now. See this: https://developers.whmcs.com/advanced/creating-pages/
  3. Yes. Passwords for servers are reversible, if you use them. cPanel and some other software offers an access hash which you can restrict to IPs (aka, the WHMCS server) - so you would just use the username + access hash. You don't have to use the root password in this case! Actually, never use the root password or root account. Create a reseller account with root reseller privileges. If we don't have a password or access hash for the server you can not use automatic setup. Your password is encrypted with the hash set in your configuration file (do not change this) so other installations of WHMCS can not decrypt your passwords or hashes. See "Add a cPanel Server": http://docs.whmcs.com/CPanel/WHM#Adding_a_cPanel_Server I am fairly sure you can create a new Plesk reseller account with a different username and also restrict its IP to the WHMCS installation.
  4. I prefer putting things into modules than the hooks folder personally, seems more organised IMO! But then again I guess I tend to organise all my modules a little oddly too If you wanna add my on Skype or something just so you can test it quickly when I'm done? Won't charge you for it, just a better communication method
  5. Chris, This wiki page needs to be updated too: http://docs.whmcs.com/Premium_Domains#Hooks
  6. There is not an API method for this sadly. But what is your use case here? I have built Office365 OAuth integration that automatically creates the account in WHMCS etc - it's not documented, but you have to use the internal classes. I had to use the PHP function get_class_methods to find out how to do it. Is this what you're trying to do?
  7. I think we need some more information to understand whats happening: How does your javascript handle the result? Were there any PHP errors? Do you get "Email exist" or "false"? Why are you passing stats to ValidateLogin? A different array should be used for each request. I know WHMCS has logged me out when I call functions incorrectly or POST to pages incorrectly - so maybe something like that is happening. Heres an example: $values = [ "email" => $_POST["email"], "password2" => $_POST["password"] ]; // .. do call to ValidateLogin $values = [ "clientid" => $clientId, "email" => $email, "stats" => true ]; // .. do call to GetClientsDetails You could print_r the $results variable of validatelogin so we can verify it was a sucessful login?
  8. As well as ensuring your 3rd modules don't use the older ioncube encoder, its also important to make sure they aren't using the deprecated mysql_ package. (e.g. using functions like mysql_query, mysql_connect - it should be mysqli_query, mysqli_connect, etc) - or even better, PDO. As this has been removed all together in PHP 7. Theres some other stuff too: https://secure.php.net/manual/en/migration70.incompatible.php PHP 7 is faster. No questions asked, it is even faster than HHVM in many cases. We're not talking "the page will load 100x faster" but it will probably shave 1-2 seconds off page load time for heavy scripts (which is still really good) Take a look at this too: https://www.zend.com/en/resources/php7_infographic
  9. Using the cloudflare CDN should help you in regards to speeds from all geographic locations. But you will need to keep the fontawesome fonts if you wish to keep using the fontawesome icons
  10. We've used the module by Edge Hosting with one of our setups: https://edgehosting.uk/whmcs-xero-addon The Xero clients already existed and so did some invoices - a few years worth of existing data actually. But it worked it all out and synced everything perfectly first time round.
  11. It shouldn't be getting called twice though, this sounds like a bug. Are you sure you don't have duplicate code anywhere?
  12. Do you have the Stripe module on WHMCS? If so, you don't have to use the Stripe API you can just add cardtype, cardnum, expdate, and cvv to AddClient and the Stripe module will take over and update store the card remotely for you. But if you want to do it outside of WHMCS part you will need to store it using a database query.
  13. No worries! So with PHP I always start with my opening tag <?php on my first line. It's not required at the end of a document though, I think its best just to drop it unless you want to insert some html. Just some notes: After 'deptid' => $vars['deptid']) you forgot your end semicolon Your logActivity call is going to be called multiple times. Did you only want it called once? I would put it outside the loop. The first variable used in your add_hook is missing its first quote. Do you have $AdminUser defined for your localAPI function? I usually create a seperate WHMCS account called "api" and put it in it's own role called "API Only" with all it's permission unticked except for "API Access" (this permission grants all privileges on the API). I would not use a user from the loop to access the API - they probably won't have API Access (and shouldn't, for security purposes) BUT that API method will send an email to ALL admins. You will have to use the internal function sendAdminMessage for this. function Support_Admin_Reply_Notification_Function($vars) { $mergefields = [ 'messagename' => 'Admin Ticket Reply', 'ticket_id' => $vars['ticketid'], 'ticket_department' => $vars['deptname'], 'ticket_subject' => $vars['subject'], 'ticket_priority' => $vars['priority'], 'ticket_message' => nl2br($vars['message']), 'type' => 'support', 'deptid' => $vars['deptid'] ]; foreach (\WHMCS\User\Admin::all() as $admin) { if (in_array($vars["deptid"], $admin->supportDepartmentIds)) { sendAdminMessage("Admin Ticket Reply", $mergefields, null, $admin->id); } } } You can find the current admin username that is send the ticket in $vars["admin"] Because this is a support email they must have support emails enabled. If you're not a developer I'm happy to package this into a module for you.
  14. InvoiceCreated has been dodgy for me in the past. I think we need a WHMCS developer to come to a peek. How does InvoiceCreation work for you? InvoiceCreation is before the invoice is sent. It has worked for me in the past (I'll do some testing later)
  15. I think you will still want fontawesome. It is where all the icons come from. fontawesome-webfont.woff is only 98kb so it shouldn't be a concern, but it will only download once and then it should cache. Perhaps there is a server configuration error? You could change it to use a CDN if you don't have access to enable caching on your server. Perhaps change the link to: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff See: https://cdnjs.com/libraries/font-awesome If its taking 300ms for a 404 answer to appear that would mean the latency from you to your server is 250-300ms. If this is so, then the CDN would be your best bet. Perhaps move all your static assets onto a CDN like Amazon CloudFront‎?
  16. This should be posted in Customisation and Showcase >> Third Party Add-ons
  17. You are looking for whereDate - WHMCS uses the queries outlined in Laravel here: https://laravel.com/docs/5.4/queries You can use whereDate, for example: $invoices = Capsule::table('tblinvoices') ->whereDate('duedate', '2016-12-31') ->get() So we can also use Carbon objects here - I am kind of obsessed with making my code look/work beautifully, and carbon helps do this! Is this maybe what you're looking for? use Carbon; $invoices = Capsule::table("tblinvoices") ->where("status", "Unpaid") ->whereDate("duedate", "<=", Carbon::now()->subDays(2)) ->get() We can be better though, you know WHMCS has the Invoice class so you don't even have to play with the database? use Carbon; use WHMCS\Billing\Invoice; // You don't have to order by, this is just an example $invoices = Invoice::orderBy("id", "desc") ->where("status", "Unpaid") ->whereDate("duedate", "<=", Carbon::now()->subDays(2)) ->get(); foreach ($invoices as $invoice) { // these are all Invoice classes } Hopefully that helps
  18. You will discover slowly that the entire WHMCS website, wiki, and dev docs are full of dead links.
  19. As Brian said check your email type is SMTP. If you still have an issue, add this to your configuration file: $smtp_debug = true; Now, try to send a client (yourself..) an email from the admin control panel, and it will show you the full output. I know it doesn't solve your issue: But IMO you should really use a transactional email service for these things (such as mailgun, sendgrid, postmark, etc..). You can even have them take your inbound and forward it instantly to WHMCS. This would also increase the reliability of your emails. Just a thought
  20. So WHMCS is built on Laravel (I think? Partially? or at least it creates the models on eloquent and uses capsule through it..) and has a bunch of classes we can use that are built on it. These things aren't documented very well (like a lot of things in the dev of WHMCS). But this is the best way I can think of to do this: // I think we could even filter this somehow using eloquent, but this is how you get them all! foreach (\WHMCS\User\Admin::all() as $admin) { if (in_array($vars["deptid"], $admin->supportDepartmentIds)) { // Woah! lets send an email or something:-D print_r($admin); // this will be gross, don't do it :'( $id = $admin->id; // all columns are here now } } Then you can make your API call (or call internal methods - but this - - - Updated - - - Half my message got cut off: (or call internal methods - but this is getting a bit complex)
  21. Remember to always backup your database before you run destructive queries on it, be prepare to quickly revert back too. In your database in the table tblservers find the old ID and the old ID. Now you can quick switch them over with this query. https://pastebin.com/TbJz71Cx If you are concerned, run it has a transaction (https://dev.mysql.com/doc/refman/5.7/en/commit.html): https://pastebin.com/wDsp0mHp If it is all good run this: COMMIT; If something goes wrong you can rollback ROLLBACK (sorry for pastebins, cloudflare was blocking me from posting queries...) - - - Updated - - - By 'old id and old id' I mean, 'old id and new id' (I can't edit my post?) I clearly didn't spell check either, sorry. Haha.
  22. I haven't seen a module for it. After a quick look, there is this: http://www.nuvepro.com/vmunify.html They provide a WHMCS module too.
  23. Sorry the forum wont let me edit my post - you don't use bcrypt like that, you use it like this: $passwordHash = password_hash("password", PASSWORD_BCRYPT);
  24. You need to create an addon module and then enable that addon. There is an article here but let me give you a quick run down.. Your addon needs a name! Lets call it sarn ("Support Admin Reply Notifications") The structure for an addon module is like this: modules/addons/MODULE_NAME/MODULE_NAME.php -- main module file modules/addons/MODULE_NAME/hooks.php -- hooks file All the functions for your module are prefixed with MODULE_NAME, and at minimum your main module file needs the _config() function. This would be called MODULE_NAME_config() So if we are calling it sarn your structure changes to this: modules/addons/sarn/sarn.php -- main module file modules/addons/sarn/hooks.php -- hooks file The _config() function is to give WHMCS some information about your addon, you return a small array. Here is an example: <?php sarn_config() { $info = [ "name" => "SARN", "description" => "Providing awesome notifications!", "version" => "1.0", "author" => "markhughes" ]; return $info; } There are more functions you can put in this file if you want to read up on that. But since you only want to use hooks, we can move to the hooks file. You can add exactly what you've written into the hooks file. Then you can go ahead and enable the module in WHMCS. PROTIP: If you ever make changes to the hooks file you will have to disable and then reenable the module - as it is cached. Good luck! Hopefully that makes sense.
×
×
  • Create New...

Important Information

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