Jump to content

Subdomain register


Recommended Posts

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...

 

639195802_Capturadetelade2018-11-0622-10-03.png.9ec763e79cfe57648c3ed36c4cde9a8c.png

 

 

Thanks in advance

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • WHMCS Technical Analyst II

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 months later...

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"
    }
]

 

Link to comment
Share on other sites

  • 1 year later...
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!!!!

122116927_142715480890704_71872917818903122141030_142715444224041_73479731743643

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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