Jump to content

Opensrs existing clients module


Recommended Posts

The opensrs module that ships with whmcs is very good, but if you have existing opensrs users you have a slight problem using the module as the normal module stores the domain username & password when it registers the domain - opensrs is unusual as it requires a different username / password combo for each domain, you cant just use the reseller details and there is nowhere to put an existing opensrs domain username & password (if you know them).

 

I have created a module to allow integration with opensrs using the subscription field to store the username & password for the domain as I have no use of this field.

 

The module uses the open source opensrs-php library which is the same libary used by whmcs within the normal opensrs module.

 

Features supported:

 

Get / save Nameservers

Get / save Registrar lock

Get / save Contact details

Get EPP Code

Renew

 

NOT Implemented:

 

Register - you should use the normal opensrs module for new domains

All the DNS / Email Forwarding functionality

Transfer

 

The code is provided as is, dont blame me if it messes your system up, backup everything first.

 

Install instructions:

 

Create a new directory in your modules/registars directory called opensrsexisting and put the files in there.

 

Put your live / test api keys in the config section

 

Modify an existing domain - one which you have the opensrs domain username & password, put it into the subscription id field in the following format: username/password

 

Bill Chalmers

opensrsexisting.zip

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi Bill

 

Thanks for creating this, I am in desperate need but unable to unarchive the file with the zip or rar extension. A file called country_codes.php does come up but no place to put the api key.

 

Help please.

 

Lester

Edited by zondotca
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 1 month later...

So I have set this up following billchalmers instructions (thank you billchalmers) and added the Crypt & PEAR directories (thank you for the reminder w1zard). However I still get the following error when I save changes with the userid/password entered and opensrsexisting selected.

 

Registrar Error

Authentication Error.

 

Any suggestions folks?

Link to comment
Share on other sites

  • 2 weeks later...
The opensrs module that ships with whmcs is very good, but if you have existing opensrs users you have a slight problem using the module as the normal module stores the domain username & password when it registers the domain - opensrs is unusual as it requires a different username / password combo for each domain, you cant just use the reseller details and there is nowhere to put an existing opensrs domain username & password (if you know them).

 

I have created a module to allow integration with opensrs using the subscription field to store the username & password for the domain as I have no use of this field.

 

The module uses the open source opensrs-php library which is the same libary used by whmcs within the normal opensrs module.

 

Features supported:

 

Get / save Nameservers

Get / save Registrar lock

Get / save Contact details

Get EPP Code

Renew

 

NOT Implemented:

 

Register - you should use the normal opensrs module for new domains

All the DNS / Email Forwarding functionality

Transfer

 

The code is provided as is, dont blame me if it messes your system up, backup everything first.

 

Install instructions:

 

Create a new directory in your modules/registars directory called opensrsexisting and put the files in there.

 

Put your live / test api keys in the config section

 

Modify an existing domain - one which you have the opensrs domain username & password, put it into the subscription id field in the following format: username/password

 

Bill Chalmers

 

hi, one doubt, with the default module opensrs can not do the function before say?

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 1 month later...

Aside from the authentication error - which I am hopeful for an answer, I don't understand how to actually get the domain name into WHMCS in the first place? When I go to add a domain under the client my only option is the register/transfer a new domain as a new order to get it into the database, which defeats the purpose of this great addon.

 

What am I missing to add an existing domain without going through the register/transfer process?

 

Thanks!

 

Phil

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

I think I got this figured out guys. There seemed to be some problem with the code thinking the domainid for the session was good, so it wouldn't create a new one. I'm just forcing to always lookup the domain info. I commented out a couple lines in opensrsexisting.php and it's working, yay.

 

Here's what I changed. Just look for the "#" in the code and do the same in yours:

        //If the passed param is different to the session domain id, then we need a new cookie
       #if($params['domainid'] != $_SESSION['domainid'])
       #{
               /** Get domain details **/
               $domainAuth = getDomainUserPass();
               $domain_username = $domainAuth[0];
               $domain_password = $domainAuth[1];
               $fulldomain = $params['sld'].".".$params['tld'];

               /** Create command object **/
               $cmd = array(
                               'action'        => 'set',
                               'object'        => 'cookie',
                               'attributes'    => array(
                                               'domain'        => $fulldomain,
                                               'reg_username'  => $domain_username,
                                               'reg_password'  => $domain_password
                               )
               );

               /** Get the global srs class **/
               $O = $GLOBALS['OpenSRSExisting'];

               $result = $O->send_cmd($cmd);

               //write the current domain id into the session
               $_SESSION['domainid'] = $params['domainid'];

               /** If we get a sucsessful cookie from opensrs update the domain expiry and put the cookie into the session **/
               if(isset($result))
               {
                       $exptime =  strtotime($result['attributes']['expiredate']);

                       if($exptime)
                       {
                               $expiredate = date("Y-m-d",$exptime);
                               $query = "UPDATE tbldomains SET expirydate = '".$expiredate."', nextduedate = '".$expiredate."' WHERE id = ".$params['domainid'];
                               mysql_query($query);
                       }

                       if(isset($result['attributes']['cookie']))
                       {
                               $_SESSION['OpenSRSCookie'] = $result['attributes']['cookie'];
                       }
                       else
                       {
                               unset($_SESSION['OpenSRSCookie']);
                       }
               }
       #}

 

- Brian

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

Is anyone else is having a simular issue? I am using WHMCS 4.2.1, when i'm in the admin area I'm able to edit and manage a domain using the Opensrsexisting module assigned to the domain, but it seems when i'm logged in the client area lookups to OpenSRS don't seem to work correctly.

 

I've modified the following code for client area to work correctly:

 

#1 Change the call to the getDomainUserPass function.

 

$domainAuth = getDomainUserPass($params['domainid']);

 

#2 I modified the getDomainUserPass function to accept a param and do an SQL lookup of the domain to get the subscriptionid field which contains the user/pw.

 

function getDomainUserPass($domainid)
{
       /** Domain username & password from subscription id field**/
       $query = "SELECT * FROM tbldomains WHERE id = ".$domainid;
       $result = mysql_query($query);
       $row = mysql_fetch_assoc($result);
       $user_pass = $row['subscriptionid'];
       #if(empty($_SESSION['data']['subscriptionid']))
       #{
       #       $user_pass = $GLOBALS['subscriptionid'];
       #}
       #else
       #{
       #       $user_pass = $_SESSION['data']['subscriptionid'];
       #}

       $auth = explode("/", $user_pass);
       return $auth;
}

Link to comment
Share on other sites

  • 1 month later...

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