souzadavi Posted November 7, 2018 Share Posted November 7, 2018 I'm selling subdomains, it was working before in my template, after template update all of my subdomain returned with registered (unavailable), so the user cannot register a subdomain from my WHMCS. I don't remember where I changed years ago to enable sell subdomains like domains... How can I make a search of subdomain and enable it to be register? See the imagem below... Thanks in advance 0 Quote Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted November 7, 2018 Share Posted November 7, 2018 @souzadavi under your product pop into Other > Subdomain Options and ensure that your domain name is specified in there. 0 Quote Link to comment Share on other sites More sharing options...
souzadavi Posted November 7, 2018 Author Share Posted November 7, 2018 Thank you to reply, but I would like to sell the subdomain like domain, from this way the subdomain is free... I was trying to create a I aswer like whois, iserting information in whois.json file like that: { "extensions": ".criarsite.online", "uri": "https://mydomain.com.br/whmcs/whois_subdomain.php?domain=", "available": "HTTPREQUEST-available" } I already did the file whois_subdomain.php searching in the whmcs data base to check if the subdomain is free, but didn't work.... any direction will be very appreciate... thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 7, 2018 Share Posted November 7, 2018 2 hours ago, souzadavi said: Thank you to reply, but I would like to sell the subdomain like domain, from this way the subdomain is free... it's linked to a product - and you can charge for that product... this would be the usual way to offer subdomains in WHMCS, rather than pretend they're like other TLDs. 2 hours ago, souzadavi said: I already did the file whois_subdomain.php searching in the whmcs data base to check if the subdomain is free, but didn't work.... any direction will be very appreciate... did the script work in the previous version before the template update? 0 Quote Link to comment Share on other sites More sharing options...
souzadavi Posted November 7, 2018 Author Share Posted November 7, 2018 Hello Brian, thanks to writte back. it's linked to a product - and you can charge for that product... this would be the usual way to offer subdomains in WHMCS, rather than pretend they're like other TLDs. ---- the hosting is free the subdomain is paid... After a year my customer need upgrade a hosting account and pay subdomain renew. Did the script work in the previous version before the template update? ------ the solution with WHOIS I was trying now, before I changed it in base.js of my custom template and was working.... you can have a look at: https://cliente.linknacional.com.br/cart.php?a=add&pid=60&tld=.criarsite.online&carttpl=criarsite3 thanks 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Technical Analyst II WHMCS Lawrence Posted November 7, 2018 WHMCS Technical Analyst II Share Posted November 7, 2018 The "available" string in your WHOIS definition appears to be incorrect, as " HTTPREQUEST- " isn't normally part of a response like that. What I would do is ensure your custom script returns either available or unavailable and edit the "available" string in your WHOIS definition to look for just "available". That should work assuming the script itself works. 0 Quote Link to comment Share on other sites More sharing options...
souzadavi Posted November 7, 2018 Author Share Posted November 7, 2018 Thank you very much it works!!! I will leave here the code may for somebody else.... To create a WHOIS lookup for Subdomains to work like a domain, I did a small script (whoisSubdomain.php) and put on root folder of whmcs: <?php $domain = strtolower($_REQUEST['domain']); include ("configuration.php"); $conn = mysqli_connect($db_host, $db_username, $db_password, $db_name); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT * FROM tbldomains WHERE domain='$domain'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo ("unavailable"); } } else { echo ("available"); } $conn->close(); ?> After that I add this lines to the file /resource/domains/whois.json file { "extensions": ".mysubdomain.com", "uri": "https://www.yourdomain.com/whmcs/whoisSubdomain.php?domain=", "available": "available" } Don't forget to added the subdomain in the .TLD list price in whmcs, like a new domain, see the docs in: https://docs.whmcs.com/Domain_Pricing 0 Quote Link to comment Share on other sites More sharing options...
souzadavi Posted January 18, 2019 Author Share Posted January 18, 2019 I updated this code to work better: whoisSubdomain.php <? // reserve your subdomains registered outside whmcs. CHANGE as required. DON"T leave like this $mysubs = array ("whois.criarsite.online"); $domain = strtolower($_REQUEST['domain']); include ("configuration.php"); $conn = mysqli_connect($db_host, $db_username, $db_password, $db_name); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT * FROM tbldomains WHERE domain='$domain'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo ("Domain: ".$row['domain']." | USERID: ".$row['userid']." | Date Register: ".$row['registrationdate']); } } else { echo ("NOT FOUND"); } $conn->close(); /resource/domains/whois.json file [ { "extensions": ".mysubdomain.com", "uri": "https://domain.com.br/whoisSubdomain.php?domain=", "available": "NOT FOUND" } ] 0 Quote Link to comment Share on other sites More sharing options...
Bakingem Posted October 20, 2020 Share Posted October 20, 2020 2019. 01. 18.-án 14: 55-kor souzadavi azt mondta: Frissítettem ezt a kódot, hogy jobban működjön: whoisSubdomain.php /resource/domains/whois.json fájl A fenti kód hatalmas segítség volt. Az aldomain keresése sikeresen működik🙂Köszönöm a segítséget!!!! 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.