Jump to content

Search the Community

Showing results for tags 'subdomain'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


WHMCS.Community

  • The latest WHMCS Release
  • The Latest from the WHMCS Team
    • News & Announcements
  • WHMCS.Community
    • Community Announcements
    • Introduce Yourself
  • Using WHMCS
    • Pre-Sales Questions
    • Admin & Configuration Questions
    • Installation, Upgrade, and Import Support
    • Using WHMCS
    • Troubleshooting Issues
    • Vendor Discussions
  • WHMCS Beta Program
  • WHMCS Showcase
    • Showcase Your Site
    • Share Your Best Practices & Tips
  • Developing & Extending WHMCS
    • Third Party Add-ons
    • Service Offers & Requests
    • Developer Corner
    • Building Modules
    • Share Ideas for WHMCS Modules
  • Community Competitions
    • Competitions
  • General Discussions
    • General Discussion
  • General Feedback & Assistance
    • WHMCS.Community Tips & Tricks
  • Third Party Developers's Topics
  • Turkish International Discussions's Topics
  • Russian International Discussions's Topics
  • Spanish International Discussions's Topics
  • Portuguese International Discussions's Topics
  • French International Discussions's Topics
  • Italian International Discussions's Argomenti
  • German International Discussions's Topics
  • WHMCS Brasil's Topics
  • WHMCS Brasil's Tópicos
  • ModulesGarden Club's Topics
  • Hungarian International Discussions's Segítség

WHMCS Version

  • V7 Hotfixes
  • V7.1.x Hotfixes
  • V7.2.x Hotfixes
  • V7.3.x Hotfixes
  • V7.4.x Hotfixes
  • V7.5.x Hotfixes
  • V7.6.x Hotfixes

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 6 results

  1. When it comes time to order a hosting plan, sometimes you don't want your users to be able to enter in a subdomain when using an existing domain for their order. In this post I am going to walk you through a basic hook that prevents entering a subdomain by using some client-side JavaScript. Our first order of business will be to check out the WHMCS hooks index to see if there is a hook point that will fit our needs: https://developers.whmcs.com/hooks/hook-index/ It turns out, the ClientAreaFooterOutput hook will do nicely: https://developers.whmcs.com/hooks-reference/output/#clientareafooteroutput The reason for this is because that hook point will allow you to inject HTML code, which also can contain JavaScript, into the client-side template so you can make the magic happen. Before getting into more detail, let's go ahead and dive right into the code. You can also download it from this link block_subdomains.txt (then rename the extension to .php). Here is the entire snippet: <?php add_hook('ClientAreaFooterOutput', 1, function($vars) { $jqueryCode = '<script> $("#owndomainsld").on("keyup", function(e) { var str = $("#owndomainsld").val(); if ( str.indexOf(".") != -1 ) { $("#owndomainsld").val(""); alert("Subdomains are not allowed!"); } }); </script>'; if (strpos($_SERVER['REQUEST_URI'], 'cart.php') !== false ) { return $jqueryCode; } }); The first thing to notice is the add_hook function is being called with the ClientAreaFooterOutput hook point as the first argument and an anonymous function as the second argument. The anonymous function also has a $vars variable being passed into it. For this example the $vars variable is not actually being used in the body of the function, but it does contain some useful parameters should you need to access them. Those parameters can be found in the documentation for the hook point linked above. The next thing to notice is the $jqueryCode variable. which is actually a PHP string that contains the JavaScript code we will be injecting into our client-side page. Since WHMCS uses the jQuery JavaScript library and loads it on the page, we can use it in our code. First, we need to bind an event listener to the keyup event on the domain text box and provide it a callback function to execute when that event occurs. This can be easily done by targeting the element's HTML ID attribute. That is what is happening here: $("#owndomainsld").on("keyup", function(e) {... After that, the value of the domain text field is stored in a JavaScript variable called str. Since this code is inside our callback function, it will be executed every time the user presses a key on the keyboard and then releases it: var str = $("#owndomainsld").val(); Once we have that text stored in our str variable, we need to check it for a dot or period '.' character to see if it is a subdomain. This can be done with indexOf string function in JavaScript. If the text appears to be a subdomain, we'll go ahead and empty out the text field and then show an alert to the user to let them know that subdomains are not allowed: if ( str.indexOf(".") != -1 ) { $("#owndomainsld").val(""); alert("Subdomains are not allowed!"); } Finally, the last part of the hook does a case-insensitive string search on the $_SERVER['REQUEST_URI'] (the URL of the page you're visiting), to check and see if a cart page is being rendered. If a cart page is detected, the JavaScript code is injected into that page so it can run. if (strpos($_SERVER['REQUEST_URI'], 'cart.php') !== false ) { return $jqueryCode; } Putting it all together, we get the final results in WHMCS which look like the picture here: I hope this post proved helpful and gives some insight on some of the ways that WHMCS can be extended to do many different things outside the box! At the time of writing this post, this hook was tested on the latest stable release of WHMCS 7.4.2 and should work with any that fall under Active Support as per the LTS schedule here: https://docs.whmcs.com/Long_Term_Support#WHMCS_Version_.26_LTS_Schedule If you have any feedback, questions, or concerns that I did not cover in this post, please feel free to reach out!
  2. Hello, I was under the impression that by NOT entering anything into the disallowed subdomain prefixes (under products setup / other) that this would automatically mean that the ability to order a product using a subdomain would be disabled... But this is not the case. I do not want to allow anyone to order a product using a subdomain name, so what do I need to do to remove/disable this ability?? Thank you in advance!
  3. Hi i have create 1 group under this group have 2 products. i would like to execute some of my own script This script i will proceed to input Username, Password, Email, domain/subdomain to another database. beside that it will create subdomain and including ordering for new domain from my registrar account after they already paid and we manually AcceptOrder. This script only ran if user order under this 2 products. may i know how to write this sample code? thanks in advanced. i'm confusing for Hooks & Modules. should it create and upload under server folder ? or payment folder?
  4. urgid0

    disable subdomain register

    is there a way to prevent subdomain registration? tks
  5. So, I'm finishing a medical management system that'll be sell for some hospitals here in Brazil. Can WHMCS "sell" a subdomain and charge a installation fee (cause every hospital has different needs, so I'll have to set up it in a different way for every client). And if the client doesn't pay access to that subdomain would be blocked? I don't need auto setup and neither of this stuff, cause there's no way that I can automate this process… As I said, every client has different needs. Also, is it possible to integrate WHMCS with WordPress? My main website is WordPress based and I really don't want to migrate all my clients, content and other stuff from WP to WHMCS manually. Thank you in forward, Sergio Morganti.
  6. I had whmcs installed on example.com/clients. I moved it to billing.example.com. Now when I go to https://billing.example.com, it redirects me to http://example.com/clients/index.php ??? Why is it doing that? Even stranger. https://billing.example.com/cart.php, it takes me to http://example.com/cart.php... and it WORKS, no 404 message! That makes no sense, as WHMCS is not installed in the public_html root like that, it's in the billing subdomain (and the actual server location is in the root folder, UNDER public_html in a directory called billing! What is going on here?? I don't know if it's related, but I also changed SSL settings at the same time. When it was at example.com/clients, the SSL gave https to example.com. But when I moved it, I got a new SSL to give https just to billing.example.com. I've been following instructions from this thread (http://www.webhostingtalk.com/showthread.php?t=986580) I got as far as 4, but I don't really understand 5, but I think that is not the issue here. Also, from this thread: http://forum.whmcs.com/showthread.php?33288-move-whmcs-installtion-to-a-sub-domain are these instructions: I moved the folder and updated cron path, but I'm not sure what email forwarders or gateway callback URL means. Also, I have this redirect problem, so I can't log in to go to Setup > General Settings.
×

Important Information

By using this site, you agree to our Terms of Use & Guidelines