#2 Upgrade

Нээсэн
thurdata 2-ийг thurdata/update_3.1-оос thurdata/php8.1 руу нэгтгэхийг хүсэлт

+ 31 - 31
Net/EPP.php

@@ -1,31 +1,31 @@
-<?php
-
-/*	EPP Client class for PHP, Copyright 2005 CentralNic Ltd
-	This program is free software; you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation; either version 2 of the License, or
-	(at your option) any later version.
-
-	This program is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-
-	You should have received a copy of the GNU General Public License
-	along with this program; if not, write to the Free Software
-	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-/**
-* @package Net_EPP
-* @version 0.0.4
-* @author Gavin Brown <gavin.brown@nospam.centralnic.com>
-* @revision $Id: Client.php,v 1.13 2010/10/21 11:55:07 gavin Exp $
-*/
-
-require_once dirname(__FILE__).'/EPP/Exception.php';
-require_once dirname(__FILE__).'/EPP/ObjectSpec.php';
-require_once dirname(__FILE__).'/EPP/Protocol.php';
-require_once dirname(__FILE__).'/EPP/Frame.php';
-require_once dirname(__FILE__).'/EPP/Client.php';
-require_once dirname(__FILE__).'/EPP/Simple.php';
+<?php
+
+/*	EPP Client class for PHP, Copyright 2005 CentralNic Ltd
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/**
+* @package Net_EPP
+* @version 0.0.4
+* @author Gavin Brown <gavin.brown@nospam.centralnic.com>
+* @revision $Id: Client.php,v 1.13 2010/10/21 11:55:07 gavin Exp $
+*/
+
+require_once dirname(__FILE__).'/EPP/Exception.php';
+require_once dirname(__FILE__).'/EPP/ObjectSpec.php';
+require_once dirname(__FILE__).'/EPP/Protocol.php';
+require_once dirname(__FILE__).'/EPP/Frame.php';
+require_once dirname(__FILE__).'/EPP/Client.php';
+require_once dirname(__FILE__).'/EPP/Simple.php';

+ 12 - 12
Net/EPP/Frame/Command/Check/Domain.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Check_Domain extends Net_EPP_Frame_Command_Check {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Check_Domain extends Net_EPP_Frame_Command_Check {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Check/Host.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Check_Host extends Net_EPP_Frame_Command_Check {
-
-		function __construct() {
-			parent::__construct('host');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Check_Host extends Net_EPP_Frame_Command_Check {
+
+		function __construct() {
+			parent::__construct('host');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Create/Contact.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Create_Contact extends Net_EPP_Frame_Command_Create {
-
-		function __construct() {
-			parent::__construct('contact');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Create_Contact extends Net_EPP_Frame_Command_Create {
+
+		function __construct() {
+			parent::__construct('contact');
+		}
+	}
+?>

+ 13 - 13
Net/EPP/Frame/Command/Create/Domain.php

@@ -1,13 +1,13 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Create_Domain extends Net_EPP_Frame_Command_Create {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Create_Domain extends Net_EPP_Frame_Command_Create {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Create/Host.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Create_Host extends Net_EPP_Frame_Command_Create {
-
-		function __construct() {
-			parent::__construct('host');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Create_Host extends Net_EPP_Frame_Command_Create {
+
+		function __construct() {
+			parent::__construct('host');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Delete/Contact.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Delete_Contact extends Net_EPP_Frame_Command_Delete {
-
-		function __construct() {
-			parent::__construct('contact');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Delete_Contact extends Net_EPP_Frame_Command_Delete {
+
+		function __construct() {
+			parent::__construct('contact');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Delete/Domain.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Delete_Domain extends Net_EPP_Frame_Command_Delete {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Delete_Domain extends Net_EPP_Frame_Command_Delete {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Delete/Host.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Delete_Host extends Net_EPP_Frame_Command_Delete {
-
-		function __construct() {
-			parent::__construct('host');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Delete_Host extends Net_EPP_Frame_Command_Delete {
+
+		function __construct() {
+			parent::__construct('host');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Info/Contact.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Info_Contact extends Net_EPP_Frame_Command_Info {
-
-		function __construct() {
-			parent::__construct('contact');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Info_Contact extends Net_EPP_Frame_Command_Info {
+
+		function __construct() {
+			parent::__construct('contact');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Info/Domain.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Info_Domain extends Net_EPP_Frame_Command_Info {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Info_Domain extends Net_EPP_Frame_Command_Info {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Info/Host.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Info_Host extends Net_EPP_Frame_Command_Info {
-
-		function __construct() {
-			parent::__construct('host');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Info_Host extends Net_EPP_Frame_Command_Info {
+
+		function __construct() {
+			parent::__construct('host');
+		}
+	}
+?>

+ 18 - 18
Net/EPP/Frame/Command/Poll/Ack.php

@@ -1,18 +1,18 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Poll_Ack extends Net_EPP_Frame_Command_Poll {
-
-		function __construct() {
-			parent::__construct();
-			$this->setOp('ack');
-		}
-
-		function setMsgID($id) {
-			$this->command->setAttribute('msgID', $id);
-		}
-
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Poll_Ack extends Net_EPP_Frame_Command_Poll {
+
+		function __construct() {
+			parent::__construct();
+			$this->setOp('ack');
+		}
+
+		function setMsgID($id) {
+			$this->command->setAttribute('msgID', $id);
+		}
+
+	}
+?>

+ 14 - 14
Net/EPP/Frame/Command/Poll/Req.php

@@ -1,14 +1,14 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Poll_Req extends Net_EPP_Frame_Command_Poll {
-
-		function __construct() {
-			parent::__construct();
-			$this->setOp('req');
-		}
-
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Poll_Req extends Net_EPP_Frame_Command_Poll {
+
+		function __construct() {
+			parent::__construct();
+			$this->setOp('req');
+		}
+
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Renew/Domain.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Renew_Domain extends Net_EPP_Frame_Command_Renew {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Renew_Domain extends Net_EPP_Frame_Command_Renew {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Transfer/Contact.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Transfer_Contact extends Net_EPP_Frame_Command_Transfer {
-
-		function __construct() {
-			parent::__construct('contact');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Transfer_Contact extends Net_EPP_Frame_Command_Transfer {
+
+		function __construct() {
+			parent::__construct('contact');
+		}
+	}
+?>

+ 20 - 20
Net/EPP/Frame/Command/Transfer/Domain.php

@@ -1,20 +1,20 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Transfer_Domain extends Net_EPP_Frame_Command_Transfer {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-
-		function setPeriod($period, $units='y') {
-			$el = $this->createObjectPropertyElement('period');
-			$el->setAttribute('unit', $units);
-			$el->appendChild($this->createTextNode($period));
-			$this->payload->appendChild($el);
-		}
-
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Transfer_Domain extends Net_EPP_Frame_Command_Transfer {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+
+		function setPeriod($period, $units='y') {
+			$el = $this->createObjectPropertyElement('period');
+			$el->setAttribute('unit', $units);
+			$el->appendChild($this->createTextNode($period));
+			$this->payload->appendChild($el);
+		}
+
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Update/Contact.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Update_Contact extends Net_EPP_Frame_Command_Update {
-
-		function __construct() {
-			parent::__construct('contact');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Update_Contact extends Net_EPP_Frame_Command_Update {
+
+		function __construct() {
+			parent::__construct('contact');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Update/Domain.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Update_Domain extends Net_EPP_Frame_Command_Update {
-
-		function __construct() {
-			parent::__construct('domain');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Update_Domain extends Net_EPP_Frame_Command_Update {
+
+		function __construct() {
+			parent::__construct('domain');
+		}
+	}
+?>

+ 12 - 12
Net/EPP/Frame/Command/Update/Host.php

@@ -1,12 +1,12 @@
-<?php
-
-	/**
-	* @package Net_EPP
-	*/
-	class Net_EPP_Frame_Command_Update_Host extends Net_EPP_Frame_Command_Update {
-
-		function __construct() {
-			parent::__construct('host');
-		}
-	}
-?>
+<?php
+
+	/**
+	* @package Net_EPP
+	*/
+	class Net_EPP_Frame_Command_Update_Host extends Net_EPP_Frame_Command_Update {
+
+		function __construct() {
+			parent::__construct('host');
+		}
+	}
+?>

+ 2 - 1
Net/EPP/Protocol.php

@@ -142,8 +142,9 @@ class Net_EPP_Protocol {
 		$res = Net_EPP_Protocol::_fwrite_nb($socket, pack('N',$length) . $xml,$length);
 		// Check our write matches
 		if ($length != $res) {
-			throw new Exception("Short write when sending XML. Length of the XML: " . $length . " Response length: " . $res);
+			throw new Exception("Short write when sending XML");
 		}
+
 		return $res;
 	}
 }

+ 0 - 0
cert/cert.pem.rename


+ 2331 - 1791
demostrator/swicthepp_demonstrator.php

@@ -1,118 +1,132 @@
 <?php
+ini_set('display_errors', true);
 
 use Illuminate\Database\Capsule\Manager as Capsule;
 use WGSSWITCHEPP\IDNA\idna_convert as IDNA;
 
+
 include_once '../../../../init.php';
+
+if (!defined("WHMCS"))
+    die("This file cannot be accessed directly");
+
 if (!class_exists('Net_EPP_Protocol')) {
-    if (file_exists(dirname(__DIR__) . "/Net/EPP/Client.php"))
-        require_once dirname(__DIR__) . "/Net/EPP/Client.php";
+	if (file_exists(dirname(__DIR__) . "/Net/EPP/Client.php"))
+		require_once dirname(__DIR__) . "/Net/EPP/Client.php";
 }
-require_once(dirname(__DIR__) . '/idna_convert.class.php');
 
+if(!isset($_SESSION['adminid']) && $_SESSION['adminid'] == ""){
+    die("This file cannot be accessed directly. To access it first login as admin");
+}
 
-/* * ********************** Create table for store login detail **************************** */
+require_once(dirname(__DIR__) . '/idna_convert.class.php');
+/* * **********************Create table for store login detail**************************** */
 if (!Capsule::Schema()->hasTable('switchepp_login_details')) {
-    try {
-        Capsule::schema()->create('switchepp_login_details', function ($table) {
-        	$table->increments('id');
-        	$table->string('username');
-        	$table->string('password');
-        	$table->string('epp_url');
-        	$table->string('port');
-        	$table->string('passphrase');
-    	    }
-        );
-    } catch (\Exception $e) {
-        logActivity("Unable to create switchepp_login_details: {$e->getMessage()}");
-    }
+	try {
+		Capsule::schema()->create(
+			'switchepp_login_details',
+			function ($table) {
+				$table->increments('id');
+				$table->string('username');
+				$table->string('password');
+				$table->string('epp_url');
+				$table->string('port');
+				$table->string('passphrase');
+			}
+		);
+	} catch (\Exception $e) {
+		logActivity("Unable to create switchepp_login_details: {$e->getMessage()}");
+	}
 }
 if (Capsule::Schema()->hasTable('switchepp_login_details')) {
-    if (!Capsule::Schema()->hasColumn('switchepp_login_details', 'passphrase'))
-        $table->string('passphrase');
+	if (!Capsule::Schema()->hasColumn('switchepp_login_details', 'passphrase'))
+		$table->string('passphrase');
 }
 
 /* * *************************Create table for store user record****************************** */
 if (!Capsule::Schema()->hasTable('switchepp_contact_details')) {
-    try {
-        Capsule::schema()->create(
-                'switchepp_contact_details', function ($table) {
-            $table->increments('id');
-            $table->string('type');
-            $table->string('contact_id');
-        }
-        );
-    } catch (\Exception $e) {
-        logActivity("Unable to create switchepp_contact_details: {$e->getMessage()}");
-    }
+	try {
+		Capsule::schema()->create(
+			'switchepp_contact_details',
+			function ($table) {
+				$table->increments('id');
+				$table->string('type');
+				$table->string('contact_id');
+			}
+		);
+	} catch (\Exception $e) {
+		logActivity("Unable to create switchepp_contact_details: {$e->getMessage()}");
+	}
 }
 
 /* * **********************************save poll msgid******************************************** */
 if (!Capsule::Schema()->hasTable('switchepp_store_msgid')) {
-    try {
-        Capsule::schema()->create(
-                'switchepp_store_msgid', function ($table) {
-            $table->increments('id');
-            $table->string('msgid');
-        }
-        );
-    } catch (\Exception $e) {
-        logActivity("Unable to create switchepp_store_msgid: {$e->getMessage()}");
-    }
+	try {
+		Capsule::schema()->create(
+			'switchepp_store_msgid',
+			function ($table) {
+				$table->increments('id');
+				$table->string('msgid');
+			}
+		);
+	} catch (\Exception $e) {
+		logActivity("Unable to create switchepp_store_msgid: {$e->getMessage()}");
+	}
 }
 /* * ****************************create table to store country name*********************************** */
 if (!Capsule::Schema()->hasTable('switchepp_manage_country')) {
-    try {
-        Capsule::schema()->create(
-                'switchepp_manage_country', function ($table) {
-            $table->increments('id');
-            $table->string('country');
-            $table->string('country_key');
-        }
-        );
-    } catch (\Exception $e) {
-        logActivity("Unable to create switchepp_manage_country: {$e->getMessage()}");
-    }
+	try {
+		Capsule::schema()->create(
+			'switchepp_manage_country',
+			function ($table) {
+				$table->increments('id');
+				$table->string('country');
+				$table->string('country_key');
+			}
+		);
+	} catch (\Exception $e) {
+		logActivity("Unable to create switchepp_manage_country: {$e->getMessage()}");
+	}
 }
 $contrs = "Afghanistan__AF,Aland Islands__AX,Albania__AL,Algeria__DZ,American Samoa__AS,Andorra__AD,Angola__AO,Anguilla__AI,Antarctica__AQ,Antigua And Barbuda__AG,Argentina__AR,Armenia__AM,Aruba__AW,Australia__AU,Austria__AT,Azerbaijan__AZ,Bahamas__BS,Bahrain__BH,Bangladesh__BD,Barbados__BB,Belarus__BY,Belgium__BE,Belize__BZ,Benin__BJ,Bermuda__BM,Bhutan__BT,Bolivia__BO,Bosnia And Herzegovina__BA,Botswana__BW,Bouvet Island__BV,Brazil__BR,British Indian Ocean Territory__IO,Brunei Darussalam__BN,Bulgaria__BG,Burkina Faso__BF,Burundi__BI,Cambodia__KH,Cameroon__CM,Canada__CA,Cape Verde__CV,Cayman Islands__KY,Central African Republic__CF,Chad__TD,Chile__CL,China__CN,Christmas Island__CX,Cocos (Keeling) Islands__CC,Colombia__CO,Comoros__KM,Congo__CG,Congo__CD,Cook Islands__CK,Costa Rica__CR,Croatia__HR,Cuba__CU,Curacao__CW,Cyprus__CY,Czech Republic__CZ,Denmark__DK,Djibouti__DJ,Dominica__DM,Dominican Republic__DO,Ecuador__EC,Egypt__EG,El Salvador__SV,Equatorial Guinea__GQ,Eritrea__ER,Estonia__EE,Ethiopia__ET,Falkland Islands (Malvinas)__FK,Faroe Islands__FO,Fiji__FJ,Finland__FI,France__FR,French Guiana__GF,French Polynesia__PF,French Southern Territories__TF,Gabon__GA,Gambia__GM,Georgia__GE,Germany__DE,Ghana__GH,Gibraltar__GI,Greece__GR,Greenland__GL,Grenada__GD,Guadeloupe__GP,Guam__GU,Guatemala__GT,Guernsey__GG,Guinea__GN,Guinea-Bissau__GW,Guyana__GY,Haiti__HT,Heard Island & Mcdonald Islands__HM,Holy See (Vatican City State)__VA,Honduras__HN,Hong Kong__HK,Hungary__HU,Iceland__IS,India__IN,Indonesia__ID,Iran__IR,Iraq__IQ,Ireland__IE,Isle Of Man__IM,Israel__IL,Italy__IT,Jamaica__JM,Japan__JP,Jersey__JE,Jordan__JO,Kazakhstan__KZ,Kenya__KE,Kiribati__KI,Korea__KR,Kuwait__KW,Kyrgyzstan__KG,Latvia__LV,Lebanon__LB,Lesotho__LS,Liberia__LR,Libyan Arab Jamahiriya__LY,Liechtenstein__LI,Lithuania__LT,Luxembourg__LU,Macao__MO,Macedonia__MK,Madagascar__MG,Malawi__MW,Malaysia__MY,Maldives__MV,Mali__ML,Malta__MT,Marshall Islands__MH,Martinique__MQ,Mauritania__MR,Mauritius__MU,Mayotte__YT,Mexico__MX,Micronesia__FM,Moldova__MD,Monaco__MC,Mongolia__MN,Montenegro__ME,Montserrat__MS,Morocco__MA,Mozambique__MZ,Myanmar__MM,Namibia__NA,Nauru__NR,Nepal__NP,Netherlands__NL,Netherlands Antilles__AN,New Caledonia__NC,New Zealand__NZ,Nicaragua__NI,Niger__NE,Nigeria__NG,Niue__NU,Norfolk Island__NF,Northern Mariana Islands__MP,Norway__NO,Oman__OM,Pakistan__PK,Palau__PW,Palestinian Territory__PS,Panama__PA,Papua New Guinea__PG,Paraguay__PY,Peru__PE,Philippines__PH,Pitcairn__PN,Poland__PL,Portugal__PT,Puerto Rico__PR,Qatar__QA,Reunion__RE,Romania__RO,Russian Federation__RU,Rwanda__RW,Saint Barthelemy__BL,Saint Helena__SH,Saint Kitts And Nevis__KN,Saint Lucia__LC,Saint Martin__MF,Saint Pierre And Miquelon__PM,Saint Vincent And Grenadines__VC,Samoa__WS,San Marino__SM,Sao Tome And Principe__ST,Saudi Arabia__SA,Senegal__SN,Serbia__RS,Seychelles__SC,Sierra Leone__SL,Singapore__SG,Slovakia__SK,Slovenia__SI,Solomon Islands__SB,Somalia__SO,South Africa__ZA,South Georgia And Sandwich Isl.__GS,Spain__ES,Sri Lanka__LK,Sudan__SD,Suriname__SR,Svalbard And Jan Mayen__SJ,Swaziland__SZ,Sweden__SE,Switzerland__CH,Syrian Arab Republic__SY,Taiwan__TW,Tajikistan__TJ,Tanzania__TZ,Thailand__TH,Timor-Leste__TL,Togo__TG,Tokelau__TK,Tonga__TO,Trinidad And Tobago__TT,Tunisia__TN,Turkey__TR,Turkmenistan__TM,Turks And Caicos Islands__TC,Tuvalu__TV,Uganda__UG,Ukraine__UA,United Arab Emirates__AE,United Kingdom__GB,United States__US,United States Outlying Islands__UM,Uruguay__UY,Uzbekistan__UZ,Vanuatu__VU,Venezuela__VE,Viet Nam__VN,Virgin Islands__VG,Virgin Islands.__VI,Wallis And Futuna__WF,Western Sahara__EH,Yemen__YE,Zambia__ZM,Zimbabwe__ZW";
 
 $contrs01 = explode(',', $contrs);
 
 foreach ($contrs01 as $contrs02) {
-    $contrs03 = explode('__', $contrs02);
-    try {
-        Capsule::table('switchepp_manage_country')->insert(['country' => trim($contrs03[0]), 'country_key' => $contrs03[1]]);
-    } catch (Exception $ex) {
-        logActivity("Unable to insert data switchepp_manage_country: {$ex->getMessage()}");
-    }
+	$contrs03 = explode('__', $contrs02);
+	try {
+		Capsule::table('switchepp_manage_country')->insert(['country' => trim($contrs03[0]), 'country_key' => $contrs03[1]]);
+	} catch (Exception $ex) {
+		logActivity("Unable to insert data switchepp_manage_country: {$ex->getMessage()}");
+	}
 }
 
 /* * **************************Save login detail*************************************** */
 
 if (isset($_POST['save']) && $_POST['save'] == 'Save To Make Connection') {
-    $data = Capsule::table('switchepp_login_details')->first();
-    $data = (array) $data;
-    $rows = Capsule::table('switchepp_login_details')->count();
-    $dataArr = array(
-        'username' => (empty($_POST['login_id'])) ? '' : $_POST['login_id'],
-        'password' => (empty($_POST['password'])) ? '' : $_POST['password'],
-        'epp_url' => (empty($_POST['epp_url'])) ? '' : $_POST['epp_url'],
-        'port' => (empty($_POST['port'])) ? '' : $_POST['port'],
-        'passphrase' => (empty($_POST['passphrase'])) ? '' : $_POST['passphrase'],
-    );
-    if ($rows > 0) {
-        try {
-            Capsule::table('switchepp_login_details')->where('id', $data['id'])->update($dataArr);
-        } catch (Exception $ex) {
-            logActivity("Unable to update data switchepp_login_details: {$ex->getMessage()}");
-        }
-    } else {
-        try {
-            Capsule::table('switchepp_login_details')->insert($dataArr);
-        } catch (Exception $ex) {
-            logActivity("Unable to insert data switchepp_login_details: {$ex->getMessage()}");
-        }
-    }
+	$data = Capsule::table('switchepp_login_details')->first();
+	$data = (array) $data;
+	$rows = Capsule::table('switchepp_login_details')->count();
+	$dataArr = array(
+		'username' => (empty($_POST['login_id'])) ? '' : $_POST['login_id'],
+		'password' => (empty($_POST['password'])) ? '' : $_POST['password'],
+		'epp_url' => (empty($_POST['epp_url'])) ? '' : $_POST['epp_url'],
+		'port' => (empty($_POST['port'])) ? '' : $_POST['port'],
+		'passphrase' => (empty($_POST['passphrase'])) ? '' : $_POST['passphrase'],
+	);
+	if ($rows > 0) {
+		try {
+			Capsule::table('switchepp_login_details')->where('id', $data['id'])->update($dataArr);
+		} catch (Exception $ex) {
+			logActivity("Unable to update data switchepp_login_details: {$ex->getMessage()}");
+		}
+	} else {
+		try {
+			Capsule::table('switchepp_login_details')->insert($dataArr);
+		} catch (Exception $ex) {
+			logActivity("Unable to insert data switchepp_login_details: {$ex->getMessage()}");
+		}
+	}
 }
 $rows = Capsule::table('switchepp_login_details')->count();
 $logindata = Capsule::table('switchepp_login_details')->first();
@@ -121,38 +135,35 @@ $params = array('eppurl' => $logindata['epp_url'], 'eppport' => $logindata['port
 $error = $msg = '';
 
 if (!empty($_POST['eppCommand'])) {
-    /*     * ******************************* Hello command ************************************* */
-    if ($_POST['eppCommand'] == 'hello') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
+	/*     * *******************************Hello command************************************* */
+	if ($_POST['eppCommand'] == 'hello') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
 
-        if (is_array($client)) {
-            $error = $client['msg'];
-            print_r($error);
-            exit;
-        }
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                             <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                                 <hello/>
                             </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response = simplexml_load_string($request_xml);
-        
-        
-    /*     * ******************************* Login Command ************************************* */
-    } else if ($_POST['eppCommand'] == 'login') {  #login command
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        } else {
+		$request_xml = $client->request($request);
+		$response_xml = htmlentities($request_xml);
+		$response = simplexml_load_string($request_xml);
+	} else if ($_POST['eppCommand'] == 'login') {  #login command
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		} else {
+
+			//$xml1 = switchepp_loggedinepp($client, $params);
 
-            $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+			echo $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                     <command>
                         <login>
                             <clID>' . $_POST['username'] . '</clID>
-                            <pw>' . $_POST['old_pw'] . '</pw>
-                            <newPW>' . $_POST['new_pw'] . '</newPW>
+                            <pw>' . htmlentities($_POST['old_pw']) . '</pw>
+                            <newPW>' . htmlentities($_POST['new_pw']) . '</newPW>
                             <options>
                                 <version>1.0</version>
                                 <lang>en</lang>
@@ -167,1114 +178,1481 @@ if (!empty($_POST['eppCommand'])) {
                     </command>
                 </epp>';
 
-            $request_xml = $client->request($request);
-            $response_xml = htmlentities($request_xml);
-            $response_chnge = simplexml_load_string($request_xml);
-            $success = $response_chnge->response->result->attributes()->code[0];
-            if ($success == '1000') {
-                foreach ($response_chnge->response->result as $resp) {
-                    $msg = $resp->msg; //for whmcs 
-                }
-            } else {
-                foreach ($response_chnge->response->result as $resp) {
-                    $msg = $resp->msg; //for whmcs 
-                }
-            }
-        }
-    /*     * ******************************* Logout command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'logout') {  #Logout command
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <epp:command xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
-                                <epp:logout />
-                                <epp:clTRID>' . $data['username'] . '</epp:clTRID>
-                            </epp:command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Poll command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'poll') {  #Poll command
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                        <command>
-                            <poll op="req"/>
-                            <clTRID>POLL-' . rand(10000, 99999) . '</clTRID>
-                        </command>
-                    </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $poll_xml_code = simplexml_load_string($request_xml);
-        $msgid = $poll_xml_code->response->msgQ->attributes()->id[0];
-        $row = Capsule::table('switchepp_store_msgid')->count();
-        $id = Capsule::table('switchepp_store_msgid')->first();
-        $id = (array) $id;
-        if ($row > 0) {
-            try {
-                Capsule::table('switchepp_store_msgid')->where('id', $id['id'])->update(['msgid' => $msgid]);
-            } catch (Exception $ex) {
-                logActivity("Unable to update data switchepp_store_msgid: {$ex->getMessage()}");
-            }
-        } else {
-            try {
-                Capsule::table('switchepp_store_msgid')->insert(['msgid' => $msgid]);
-            } catch (Exception $ex) {
-                logActivity("Unable to insert data switchepp_store_msgid: {$ex->getMessage()}");
-            }
-        }
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Transfer Domain1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'transfer_domain1') {  # Transfer command
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['trnsfr_domain'];
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <transfer op="request">
-                                    <domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                        <domain:name>' . $domainname . '</domain:name>
-                                    <domain:authInfo>
-                                        <domain:pw>' . $_POST['trnsfr_pw'] . '</domain:pw>
-                                    </domain:authInfo>
-                                    </domain:transfer>
-                                </transfer>
-                            <clTRID>TRANS-' . rand(1000, 9999) . '</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Aknowledge Message command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'acknoledge_msg') {  #Poll Acknowledge message
-        $id = Capsule::table('switchepp_store_msgid')->first();
-        $id = (array) $id;
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <poll op="ack" msgID="' . $id['msgid'] . '"/>
-                                <clTRID>POLLCF-' . rand(1000, 9999) . '</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Check Contact1 Command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'check_contact1') {  #check contact 1
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <check>
-                                    <contact:check xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
-                                        <contact:id>' . $_POST['cont1'] . '</contact:id>
-                                        <contact:id>' . $_POST['cont2'] . '</contact:id>
-                                    </contact:check>
-                                </check>
-                            <clTRID>ABC-12345</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Create Contact1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'create_con1') {  #create contact 1
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <create>
-                                    <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
-                                        <contact:id>' . $_POST['contact_id1'] . '</contact:id>
-                                        <contact:postalInfo type="loc">
-                                            <contact:name>' . $_POST['cfullname'] . '</contact:name>
-                                            <contact:org>' . $_POST['ccompanyname'] . '</contact:org>
-                                            <contact:addr>
-                                                <contact:street>' . $_POST['caddress1'] . '</contact:street>
-                                                <contact:street>' . $_POST['caddress2'] . '</contact:street>
-                                                <contact:city>' . $_POST['ccity'] . '</contact:city>
-                                                <contact:pc>' . $_POST['cpostcode'] . '</contact:pc>
-                                                <contact:cc>' . $_POST['ccountry'] . '</contact:cc>
-                                            </contact:addr>
-                                        </contact:postalInfo>
-                                        <contact:voice>' . $_POST['cphone'] . '</contact:voice>
-                                        <contact:email>' . $_POST['cemail'] . '</contact:email>
-                                        <contact:authInfo>
-                                            <contact:pw>Con-' . time() . '</contact:pw>
-                                        </contact:authInfo>
-                                    </contact:create>
-                                </create>
-                            <clTRID>admin-' . rand(1000, 9999) . '</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_contact = simplexml_load_string($request_xml);
-        $success = $response_contact->response->result->attributes()->code[0];
-        $admin_id = $response_contact->response->resData->children('contact', true)->creData->id;
-        if ($success == '1000') {
-            $rows = Capsule::table('switchepp_contact_details')->where('type', 'admin')->count();
-            if ($rows > 0) {
-                try {
-                    Capsule::table('switchepp_contact_details')->where('type', 'admin')->update(['contact_id' => $admin_id]);
-                } catch (Exception $ex) {
-                    logActivity("Could't update into table switchepp_contact_details: {$ex->getMessage()}");
-                }
-            } else {
-                try {
-                    Capsule::table('switchepp_contact_details')->insert(['contact_id' => $admin_id]);
-                } catch (Exception $ex) {
-                    logActivity("Could't insert into table switchepp_contact_details: {$ex->getMessage()}");
-                }
-            }
-        }
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Create NS1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'create_ns1') {  #create hostname 1
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                               <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                    <command>
-                                        <create>
-                                            <host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0">
-                                                 <host:name>' . $_POST['host_name'] . '</host:name>
-                                                 <host:addr ip="v4">' . $_POST['ip'] . '</host:addr>
-                                            </host:create>
-                                        </create>
-                                    <clTRID>' . rand(9999999, 100000) . '</clTRID>
-                                    </command>
-                               </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-//if($success == '1000'){
-//$query = mysql_query("SELECT * FROM `switchepp_store_host`");
-//}
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Domain Info 1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'domain_info') {      #domain info 1
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <info>
-                                        <domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $_POST['domaininfo'] . '</domain:name>
-                                        </domain:info>
-                                    </info>
-                                <clTRID>DOMAININFO-' . rand(100, 999) . '</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Info Tech Contact command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'info_tech_contact') {  #Tech contact info
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
-        $result = (array) $data;
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
-						<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> 
-							 <command> 
-								 <info> 
-									 <contact:info 
-										 xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> 
-										 <contact:id>' . $_POST['cont_info'] . '</contact:id> 
-									 </contact:info> 
-								 </info> 
-							 <clTRID>ABC-12345</clTRID> 
-							 </command> 
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+				//                Capsule::table("switchepp_login_details")->where('id', $logindata['id'])->update(['username' => $_POST['username'], 'password' => $_POST['new_pw']]);
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+		}
+		switchepp_logoutinepp($client, $params);
+	} elseif ($_POST['eppCommand'] == 'logout') {  #Logout command
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<epp:command xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
+									<epp:logout />
+									<epp:clTRID>TEST-REGISTRAR-A</epp:clTRID>
+								</epp:command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+		}
+	} elseif ($_POST['eppCommand'] == 'poll') {  #Poll command
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="utf-8" standalone="no"?>
+						<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+						   <command>
+							  <poll op="req"/>
+							  <clTRID>POLL-' . rand(10000, 99999) . '</clTRID>
+						   </command>
 						</epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Update Domain1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'update_domain_1') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$poll_xml_code = simplexml_load_string($request_xml);
+			$msgid = $poll_xml_code->response->msgQ->attributes()->id[0];
+			$row = Capsule::table('switchepp_store_msgid')->count();
+			$id = Capsule::table('switchepp_store_msgid')->first();
+			$id = (array) $id;
+			if ($row > 0) {
+				try {
+					Capsule::table('switchepp_store_msgid')->where('id', $id['id'])->update(['msgid' => $msgid]);
+				} catch (Exception $ex) {
+					logActivity("Unable to update data switchepp_store_msgid: {$ex->getMessage()}");
+				}
+			} else {
+				try {
+					Capsule::table('switchepp_store_msgid')->insert(['msgid' => $msgid]);
+				} catch (Exception $ex) {
+					logActivity("Unable to insert data switchepp_store_msgid: {$ex->getMessage()}");
+				}
+			}
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'transfer_domain1') {  # Transfer command
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['trnsfr_domain'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<transfer op="request">
+										<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+											<domain:name>' . $domainname . '</domain:name>
+										<domain:authInfo>
+											<domain:pw>' . $_POST['trnsfr_pw'] . '</domain:pw>
+										</domain:authInfo>
+										</domain:transfer>
+									</transfer>
+								<clTRID>TRANS-' . rand(1000, 9999) . '</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'acknoledge_msg') {  #Poll Acknowledge message
+		$id = Capsule::table('switchepp_store_msgid')->first();
+		$id = (array) $id;
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="utf-8" standalone="no"?>
+						<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+						   <command>
+							  <poll op="req"/>
+							  <clTRID>POLL-' . rand(10000, 99999) . '</clTRID>
+						   </command>
+						</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$poll_xml_code = simplexml_load_string($request_xml);
+			$msgid = $poll_xml_code->response->msgQ->attributes()->id[0];
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<poll op="ack" msgID="' . $msgid . '"/>
+									<clTRID>POLLCF-' . rand(1000, 9999) . '</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'check_contact1') {  #check contact 1
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<check>
+										<contact:check xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+											<contact:id>' . $_POST['cont1'] . '</contact:id>
+										</contact:check>
+									</check>
+								<clTRID>ABC-12345</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'create_con1') {  #create contact 1
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<create>
+										<contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+											<contact:id>' . $_POST['contact_id'] . '</contact:id>
+											<contact:postalInfo type="loc">
+												<contact:name>' . $_POST['cfullname'] . '</contact:name>
+												<contact:org>' . $_POST['ccompanyname'] . '</contact:org>
+												<contact:addr>
+													<contact:street>' . $_POST['caddress1'] . '</contact:street>
+													<contact:street>' . $_POST['caddress2'] . '</contact:street>
+													<contact:city>' . $_POST['ccity'] . '</contact:city>
+													<contact:pc>' . $_POST['cpostcode'] . '</contact:pc>
+													<contact:cc>' . $_POST['ccountry'] . '</contact:cc>
+												</contact:addr>
+											</contact:postalInfo>
+											<contact:voice>' . $_POST['cphone'] . '</contact:voice>
+											<contact:email>' . $_POST['cemail'] . '</contact:email>
+											<contact:authInfo>
+												<contact:pw>Con-' . time() . '</contact:pw>
+											</contact:authInfo>
+										</contact:create>
+									</create>
+								<clTRID>admin-' . rand(1000, 9999) . '</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_contact = simplexml_load_string($request_xml);
+			$success = $response_contact->response->result->attributes()->code[0];
+			$admin_id = $response_contact->response->resData->children('contact', true)->creData->id;
+			if ($success == '1000') {
+				$rows = Capsule::table('switchepp_contact_details')->where('type', 'admin')->count();
+				if ($rows > 0) {
+					try {
+						Capsule::table('switchepp_contact_details')->where('type', 'admin')->update(['contact_id' => $admin_id]);
+					} catch (Exception $ex) {
+						logActivity("Could't update into table switchepp_contact_details: {$ex->getMessage()}");
+					}
+				} else {
+					try {
+						Capsule::table('switchepp_contact_details')->insert(['contact_id' => $admin_id]);
+					} catch (Exception $ex) {
+						logActivity("Could't insert into table switchepp_contact_details: {$ex->getMessage()}");
+					}
+				}
+			}
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'create_ns1') {  #create hostname 1
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								   <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+										<command>
+											<create>
+												<host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0">
+													 <host:name>' . $_POST['host_name'] . '</host:name>
+													 <host:addr ip="v4">' . $_POST['ip'] . '</host:addr>
+												</host:create>
+											</create>
+										<clTRID>' . rand(9999999, 100000) . '</clTRID>
+										</command>
+                                   </epp>';
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
+                                   <command>
+                                   <create>
+                                   <host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd">
+                                   <host:name>' . $_POST['host_name'] . '</host:name>
+                                   </host:create>
+                                   </create>
+                                   <clTRID>' . rand(9999999, 100000) . '</clTRID>
+                                   </command>
+                                   </epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			//if($success == '1000'){
+			//$query = mysql_query("SELECT * FROM `switchepp_store_host`");
+			//}
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'domain_info') {      #domain info 1
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<info>
+											<domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $_POST['domaininfo'] . '</domain:name>
+											</domain:info>
+										</info>
+									<clTRID>DOMAININFO-' . rand(100, 999) . '</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'domain_info1') {      #domain info 1
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$IDN = new IDNA();
+		$input = $_POST['domaininfo'];
+		$domainname = $IDN->encode($input);
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<info>
+											<domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:info>
+										</info>
+									<clTRID>DOMAININFO-' . rand(100, 999) . '</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'info_tech_contact') {  #Tech contact info
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$result = (array) $data;
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								 <command>
+									 <info>
+										 <contact:info
+											 xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+											 <contact:id>' . $_POST['cont_info'] . '</contact:id>
+										 </contact:info>
+									 </info>
+								 <clTRID>ABC-12345</clTRID>
+								 </command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'update_domain_1_ctsd') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
-	# Generate XML for nameservers
-        if ($nameserver1 = $_POST["ns1"]) {
-            $add_hosts = ' <domain:hostObj>' . $nameserver1 . '</domain:hostObj> ';
-        }
-        if ($nameserver2 = $_POST["ns2"]) {
-            $add_hosts .= ' <domain:hostObj>' . $nameserver2 . '</domain:hostObj> ';
-        }
-        if ($nameserver3 = $_POST["ns3"]) {
-            $add_hosts .= ' <domain:hostObj>' . $nameserver3 . '</domain:hostObj> ';
-        }
-        if ($nameserver4 = $_POST["ns4"]) {
-            $add_hosts .= ' <domain:hostObj>' . $nameserver4 . '</domain:hostObj> ';
-        }
-        if ($nameserver5 = $_POST["ns5"]) {
-            $add_hosts .= ' <domain:hostObj>' . $nameserver5 . '</domain:hostObj> ';
-        }
-        $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
-        $data = (array) $data;
-        $IDN = new IDNA();
-        $input = $_POST['up_domain_name'];
-        $domainname = $IDN->encode($input);
-        $add_input = $_POST['up_add_ns'];
-        $add_ns = $IDN->encode($add_input);
-        $rem_input = $_POST['up_rem_ns'];
-        $rem_ns = $IDN->encode($rem_input);
-        $dnssec = '';
-        if (isset($_POST['up_d_dnssec']) && $_POST['up_d_dnssec'] == '1') {
-            $dnssec = '<extension>
-                                        <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
-                                            <secDNS:add> 
-                                                <secDNS:dsData> 
-                                                    <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag> 
-                                                    <secDNS:alg>3</secDNS:alg> 
-                                                    <secDNS:digestType>1</secDNS:digestType> 
-                                                        <secDNS:digest>' . strtoupper(bin2hex(uniqid())) . '</secDNS:digest>
-                                                </secDNS:dsData>
-                                            </secDNS:add>
-                                        </secDNS:update> 
-                                    </extension>';
-        }
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$data = (array) $data;
+			$IDN = new IDNA();
+			$input = $_POST['up_domain_name2'];
+			$domainname = $IDN->encode($input);
+			$add_input = $_POST['up_add_ns'];
+			$add_ns = $IDN->encode($add_input);
+			$rem_input = $_POST['up_rem_ns'];
+			$rem_ns = $IDN->encode($rem_input);
+			$dnssec = '';
+			if (isset($_POST['up_d_dnssec']) && $_POST['up_d_dnssec'] == '1') {
+				$dnssec = '<extension>
+											<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+												<secDNS:add>
+													<secDNS:dsData>
+														<secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+														<secDNS:alg>3</secDNS:alg>
+														<secDNS:digestType>1</secDNS:digestType>
+															<secDNS:digest>' . strtoupper(bin2hex(uniqid())) . '</secDNS:digest>
+													</secDNS:dsData>
+												</secDNS:add>
+											</secDNS:update>
+										</extension>';
+			}
 
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <update>
-                                        <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            <domain:add>
-                                                <domain:ns>
-                                                <domain:hostObj>' . $add_ns . '</domain:hostObj>
-                                                </domain:ns>
-                                                <domain:contact type="tech">' . $_POST['up_contact_id'] . '</domain:contact>
-                                            </domain:add>
-                                            <domain:rem>
-                                                <domain:ns>
-                                                    <domain:hostObj>' . $rem_ns . '</domain:hostObj>
-                                                </domain:ns>
-                                            </domain:rem>
-                                            <domain:chg>
-                                            <domain:registrant>' . $_POST['up_contact_id'] . '</domain:registrant>
-                                            </domain:chg>
-                                        </domain:update>
-                                    </update>
-                                    ' . $dnssec . '
-                                <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
-                                </command>
-                           </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-        
-    /*     * ******************************* Update Domain1 contact command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'update_domain_1_contact') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $IDN = new IDNA();
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $input = $_POST['c_up_domain_name'];
-        error_log("INPUT: \"" . $input . "\" POST: \"" . $_POST['c_up_domain_name'] . "\"");
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <update>
-                                        <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            <domain:chg>
-	                                        <domain:registrant>' . $_POST['c_up_contact_id'] . '</domain:registrant>
-                                            </domain:chg>
-                                        </domain:update>
-                                    </update>
-                                <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
-                                </command>
-                           </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Create Contact 2 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'create_con2') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <create>
-                                    <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
-                                        <contact:id>' . $_POST['contact_id2'] . '</contact:id>
-                                        <contact:postalInfo type="loc">
-                                            <contact:name>' . $_POST['cfullname2'] . '</contact:name>
-                                            <contact:org>' . $_POST['ccompanyname2'] . '</contact:org>
-                                            <contact:addr>
-                                                <contact:street>' . $_POST['caddress12'] . '</contact:street>
-                                                <contact:street>' . $_POST['caddress22'] . '</contact:street>
-                                                <contact:city>' . $_POST['ccity2'] . '</contact:city>
-                                                <contact:pc>' . $_POST['cpostcode2'] . '</contact:pc>
-                                                <contact:cc>' . $_POST['ccountry2'] . '</contact:cc>
-                                            </contact:addr>
-                                        </contact:postalInfo>
-                                        <contact:voice>' . $_POST['cphone2'] . '</contact:voice>
-                                        <contact:email>' . $_POST['cemail2'] . '</contact:email>
-                                        <contact:authInfo>
-                                            <contact:pw>Con-' . time() . '</contact:pw>
-                                        </contact:authInfo>
-                                    </contact:create>
-                                </create>
-                            <clTRID>admin-' . rand(1000, 9999) . '</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_contact = simplexml_load_string($request_xml);
-        $success = $response_contact->response->result->attributes()->code[0];
-        $tech_id = $response_contact->response->resData->children('contact', true)->creData->id;
-        if ($success == '1000') {
-            $rows = Capsule::table('switchepp_contact_details')->where('type', 'tech')->count();
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<update>
+											<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+													<domain:add>
+													<domain:ns>
+													<domain:hostObj>' . $add_ns . '</domain:hostObj>
+													</domain:ns>
+													<domain:contact type="tech">' . $_POST['add_contact_id'] . '</domain:contact>
+													</domain:add>
+													<domain:rem>
+													<domain:ns>
+													<domain:hostObj>' . $rem_ns . '</domain:hostObj>
+													</domain:ns>
+													</domain:rem>
+												<domain:chg>
+													<domain:registrant>' . $_POST['chng_contact_id'] . '</domain:registrant>
+												</domain:chg>
+											</domain:update>
+										</update>
+										' . $dnssec . '
+									<clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+									</command>
+							   </epp>';
 
-            if ($rows > 0) {
-                try {
-                    Capsule::table('switchepp_contact_details')->where('type', 'tech')->update(['contact_id' => $tech_id]);
-                } catch (Exception $ex) {
-                    logActivity("Could't update into table switchepp_contact_details: {$ex->getMessage()}");
-                }
-            } else {
-                try {
-                    Capsule::table('switchepp_contact_details')->insert(['contact_id' => $tech_id]);
-                } catch (Exception $ex) {
-                    logActivity("Could't insert into table switchepp_contact_details: {$ex->getMessage()}");
-                }
-            }
-        }
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Domain 1 Delete command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'domain_delete1') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['domaininfo'];
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <delete>
-                                        <domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                        </domain:delete>
-                                    </delete>
-                                <clTRID>ABC-12345</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Create Domain1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'create_domain_1') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'update_domain_1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
-        $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
-        $data = (array) $data;
+			$IDN = new IDNA();
+			$input = $_POST['up_domain_name1'];
+			$domainname = $IDN->encode($input);
+			$dnssec = '';
+			if (isset($_POST['up_d_dnssec']) && $_POST['up_d_dnssec'] == '1') {
+				$dnssec = '<extension>
+											<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+												<secDNS:add>
+													<secDNS:dsData>
+														<secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+														<secDNS:alg>3</secDNS:alg>
+														<secDNS:digestType>1</secDNS:digestType>
+															<secDNS:digest>' . strtoupper(bin2hex(uniqid())) . '</secDNS:digest>
+													</secDNS:dsData>
+												</secDNS:add>
+											</secDNS:update>
+										</extension>';
+			}
+			/* '<domain:add>
+			  <domain:ns>
+			  <domain:hostObj>' . $add_ns . '</domain:hostObj>
+			  </domain:ns>
+			  <domain:contact type="tech">' . $_POST['up_contact_id'] . '</domain:contact>
+			  </domain:add>
+			  <domain:rem>
+			  <domain:ns>
+			  <domain:hostObj>' . $rem_ns . '</domain:hostObj>
+			  </domain:ns>
+			  </domain:rem>' */
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<update>
+											<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+												<domain:add/>
+												<domain:rem/>
+												<domain:chg>
+													<domain:registrant>' . $_POST['up_contact_id'] . '</domain:registrant>
+												</domain:chg>
+											</domain:update>
+										</update>
+										' . $dnssec . '
+									<clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+									</command>
+							   </epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'replace_domain_dnssec') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
-        $data1 = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first();
-        $data1 = (array) $data1;
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$data = (array) $data;
+			$IDN = new IDNA();
+			$input = $_POST['up_domain_name'];
+			$domainname = $IDN->encode($input);
+			$dnssec = '';
+			$dnssec = '<extension>
+						<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+							<secDNS:rem>
+								<secDNS:dsData>
+									<secDNS:keyTag>12346</secDNS:keyTag>
+									<secDNS:alg>5</secDNS:alg>
+									<secDNS:digestType>1</secDNS:digestType>
+									<secDNS:digest>461B5C021BD7E68BF5013F1BA4BB76F4B436FE19</secDNS:digest>
+								</secDNS:dsData>
+							</secDNS:rem>
+							<secDNS:add>
+								<secDNS:dsData>
+									<secDNS:keyTag>' . $_POST['keyTag'] . '</secDNS:keyTag>
+									<secDNS:alg>' . $_POST['alg'] . '</secDNS:alg>
+									<secDNS:digestType>' . $_POST['digesttype'] . '</secDNS:digestType>
+										<secDNS:digest>4C1D176C756572C6BFE3D72E87F8B18EF185E55A348480B61D894881AAC381BC</secDNS:digest>
+								</secDNS:dsData>
+							</secDNS:add>
+						</secDNS:update>
+					</extension>';
 
-	//******************* NameServer *************
-        if ($_POST['ns1']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns1'] . '</domain:hostObj>';
-        }
-        if ($_POST['ns2']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns2'] . '</domain:hostObj>';
-        }
-        if ($_POST['ns3']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns3'] . '</domain:hostObj>';
-        }
-        if ($_POST['ns4']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns4'] . '</domain:hostObj>';
-        }
-        if ($ns) {
-            $nsnameserver = ' <domain:ns>
-                                    ' . $ns . '
-                             </domain:ns>';
-        }
-        $dnssec = '';
-        if (isset($_POST['cr_d1_dnssec']) && $_POST['cr_d1_dnssec'] == '1') {
-            $dnssec = '<extension>
-                                        <secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
-                                             <secDNS:dsData> 
-                                                        <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag> 
-                                                        <secDNS:alg>3</secDNS:alg> 
-                                                        <secDNS:digestType>1</secDNS:digestType> 
-                                                        <secDNS:digest>' . strtoupper(bin2hex(uniqid())) . '</secDNS:digest>
-                                              </secDNS:dsData>
-                                        </secDNS:create>
-                                   </extension>';
-        }
-        $IDN = new IDNA();
-        $input = $_POST['domain_name'];
-        $domainname = $IDN->encode($input);
 
-	//domian create command
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <create>
-                                        <domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            ' . $nsnameserver . '
-                                             <domain:registrant>' . $_POST['reg_con_id'] . '</domain:registrant>
-                                             <domain:authInfo>
-                                             <domain:pw>switchpwd' . uniqid() . '</domain:pw>
-                                             </domain:authInfo>
-                                        </domain:create>
-                                    </create>
-                                   ' . $dnssec . '
-                                <clTRID>' . rand(9999999, 100000) . '</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Contact Delete 1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'contact_delete_1') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<update>
+											<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:update>
+										</update>
+										' . $dnssec . '
+									<clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+									</command>
+							   </epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'update_domain_1_dnssec') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
-        $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
-        $data = (array) $data;
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <delete>
-                                        <contact:delete xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
-                                            <contact:id>' . $_POST['del_contact_id'] . '</contact:id>
-                                        </contact:delete>
-                                    </delete>
-                                <clTRID>ABC-12345</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Delete NS1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'delete_ns_1') {
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$data = (array) $data;
+			$IDN = new IDNA();
+			$input = $_POST['up_domain_name'];
+			$domainname = $IDN->encode($input);
+			$dnssec = '';
+			$dnssec = '<extension>
+						<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+							<secDNS:add>
+								<secDNS:dsData>
+									<secDNS:keyTag>' . $_POST['keyTag'] . '</secDNS:keyTag>
+									<secDNS:alg>' . $_POST['alg'] . '</secDNS:alg>
+									<secDNS:digestType>' . $_POST['digesttype'] . '</secDNS:digestType>
+										<secDNS:digest>461B5C021BD7E68BF5013F1BA4BB76F4B436FE19</secDNS:digest>
+								</secDNS:dsData>
+							</secDNS:add>
+						</secDNS:update>
+					</extension>';
 
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['nameserver'];
-        $nameserver = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <delete>
-                                    <host:delete xmlns:host="urn:ietf:params:xml:ns:host-1.0">
-                                        <host:name>' . $nameserver . '</host:name>
-                                    </host:delete>
-                                </delete>
-                            <clTRID>ABC-12345</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Check Domain 2 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'check_domain_2') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['domain_name2'];
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <check>
-                                        <domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                        </domain:check>
-                                    </check>
-                                <clTRID>ABC-12345</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Create Domain 2 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'create_domain_2') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
 
-        $data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
-        $data = (array) $data;
-        $data1 = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first();
-        $data1 = (array) $data1;
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<update>
+											<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:update>
+										</update>
+										' . $dnssec . '
+									<clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+									</command>
+							   </epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'create_con2') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<create>
+										<contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+											<contact:id>' . $_POST['contact_id2'] . '</contact:id>
+											<contact:postalInfo type="loc">
+												<contact:name>' . $_POST['fullname'] . '</contact:name>
+												<contact:org>' . $_POST['companyname'] . '</contact:org>
+												<contact:addr>
+													<contact:street>' . $_POST['address1'] . '</contact:street>
+													<contact:street>' . $_POST['address2'] . '</contact:street>
+													<contact:city>' . $_POST['city'] . '</contact:city>
+													<contact:pc>' . $_POST['postcode'] . '</contact:pc>
+													<contact:cc>' . $_POST['country'] . '</contact:cc>
+												</contact:addr>
+											</contact:postalInfo>
+											<contact:voice>' . $_POST['phone'] . '</contact:voice>
+											<contact:email>' . $_POST['email2'] . '</contact:email>
+											<contact:authInfo>
+												<contact:pw>Con-' . time() . '</contact:pw>
+											</contact:authInfo>
+										</contact:create>
+									</create>
+								<clTRID>admin-' . rand(1000, 9999) . '</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_contact = simplexml_load_string($request_xml);
+			$success = $response_contact->response->result->attributes()->code[0];
+			$tech_id = $response_contact->response->resData->children('contact', true)->creData->id;
+			if ($success == '1000') {
+				$rows = Capsule::table('switchepp_contact_details')->where('type', 'tech')->count();
 
-	//*******************NameServer*************#
-        if ($_POST['ns1']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns1'] . '</domain:hostObj>';
-        }
-        if ($_POST['ns2']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns2'] . '</domain:hostObj>';
-        }
-        if ($_POST['ns3']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns3'] . '</domain:hostObj>';
-        }
-        if ($_POST['ns4']) {
-            $ns .= '<domain:hostObj>' . $_POST['ns4'] . '</domain:hostObj>';
-        }
-        if ($ns) {
-            $nsnameserver = ' <domain:ns>
-                                    ' . $ns . '
-                             </domain:ns>';
-        }
-        $IDN = new IDNA();
-        $input = $_POST['domain_name'];
-        $domainname = $IDN->encode($input);
+				if ($rows > 0) {
+					try {
+						Capsule::table('switchepp_contact_details')->where('type', 'tech')->update(['contact_id' => $tech_id]);
+					} catch (Exception $ex) {
+						logActivity("Could't update into table switchepp_contact_details: {$ex->getMessage()}");
+					}
+				} else {
+					try {
+						Capsule::table('switchepp_contact_details')->insert(['contact_id' => $tech_id]);
+					} catch (Exception $ex) {
+						logActivity("Could't insert into table switchepp_contact_details: {$ex->getMessage()}");
+					}
+				}
+			}
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'domain_delete1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domaininfo'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<delete>
+											<domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:delete>
+										</delete>
+									<clTRID>ABC-12345</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'create_domain_1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
-	//domian create command
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <create>
-                                        <domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            ' . $nsnameserver . '
-                                             <domain:registrant>' . $_POST['tech_con_id'] . '</domain:registrant>
-                                             <domain:authInfo>
-                                             <domain:pw>switchpwd' . uniqid() . '</domain:pw>
-                                             </domain:authInfo>
-                                        </domain:create>
-                                    </create>
-                                <clTRID>' . rand(9999999, 100000) . '</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Create NS2 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'create_ns2') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                               <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                    <command>
-                                        <create>
-                                            <host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0">
-                                                 <host:name>' . $_POST['host_name'] . '</host:name>
-                                                 <host:addr ip="v4">' . $_POST['ip'] . '</host:addr>
-                                            </host:create>
-                                        </create>
-                                    <clTRID>' . rand(9999999, 100000) . '</clTRID>
-                                    </command>
-                               </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Update Domain 1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'update_domain1w_2') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['domain'];
-        $domainname = $IDN->encode($input);
-        $input1 = $_POST['upd_nameserver'];
-        $nameserver = $IDN->encode($input1);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <update>
-                                        <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            <domain:add>
-                                                <domain:ns>
-                                                <domain:hostObj>' . $nameserver . '</domain:hostObj>
-                                                </domain:ns>
-                                            </domain:add>
-                                            <domain:rem/>
-                                            <domain:chg/>
-                             </domain:update>
-                             </update>
-                             <clTRID>Test3</clTRID>
-                             </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Update Contact 2 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'update_con_2') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-//<contact:id>' . $data['contact_id'] . '</contact:id>
-        $data = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first();
-        $data = (array) $data;
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                            <command>
-                                <update>
-                                    <contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
-                                        <contact:id>' . $_POST['contact_id'] . '</contact:id>
-                                        <contact:chg>
-                                            <contact:postalInfo type="loc">
-                                                <contact:org>' . $_POST['cname'] . '</contact:org>
-                                                <contact:addr>
-                                                    <contact:street>' . $_POST['add1'] . '</contact:street>
-                                                    <contact:street>' . $_POST['add2'] . '</contact:street>
-                                                    <contact:city>' . $_POST['up_city'] . '</contact:city>
-                                                    <contact:sp>' . $_POST['up_city'] . '</contact:sp>
-                                                    <contact:pc>' . $_POST['up_city'] . '</contact:pc>
-                                                    <contact:cc>' . $_POST['up_country'] . '</contact:cc>
-                                                </contact:addr>
-                                            </contact:postalInfo>
-                                            <contact:voice>' . $_POST['up_phone'] . '</contact:voice>
-                                            <contact:fax/>
-                                            <contact:email>' . $_POST['email'] . '</contact:email>
-                                            <contact:authInfo>
-                                                <contact:pw>con-' . time() . '</contact:pw>
-                                            </contact:authInfo>
-                                        </contact:chg>
-                                    </contact:update>
-                                </update>
-                            <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
-                            </command>
-                        </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Delete Domain 1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'del_domain1') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['domaininfo'];
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <delete>
-                                        <domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                        </domain:delete>
-                                    </delete>
-                                <clTRID>ABC-12345</clTRID>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Restore Domain 1 command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'restore_domain_1') {
-	error_log("RESTORE DOMAIN 1");
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        error_log("PARAMS: " . print_r($params,true));
-        $xml1 = switchepp_loggedinepp($client, $params);
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$data = (array) $data;
 
-        $IDN = new IDNA();
-        $input = $_POST['domain_name1'];
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-                                <command>
-                                    <update>
-                                        <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            <domain:chg/>
-                                        </domain:update>
-                                    </update>
-                                    <extension>
-                                        <rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd">
-                                    	    <rgp:restore op="request"/>
-                                        </rgp:update>
-                                    </extension>
-                                </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    /*     * ******************************* Update Domain Auth command ************************************* */
-    } elseif ($_POST['eppCommand'] == 'update_domain_auth') {
-        $client = switchepp_clientloginepp($params);      #Epp Connection
-        if (is_array($client)) {
-            $error = $client['msg'];
-        }
-        $xml1 = switchepp_loggedinepp($client, $params);
-        $IDN = new IDNA();
-        $input = $_POST['domain_update'];
-        $domainname = $IDN->encode($input);
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
-                                <command>
-                                    <update>
-                                        <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
-                                            <domain:name>' . $domainname . '</domain:name>
-                                            <domain:chg>
-                                                <domain:authInfo>
-                                                    <domain:pw>' . $_POST['auth'] . '</domain:pw>
-                                                </domain:authInfo>
-                                            </domain:chg>
-                             </domain:update>
-                             </update>
-                             <clTRID>Test3</clTRID>
-                             </command>
-                            </epp>';
-        $request_xml = $client->request($request);
-        $response_xml = htmlentities($request_xml);
-        $response_chnge = simplexml_load_string($request_xml);
-        $success = $response_chnge->response->result->attributes()->code[0];
-        if ($success == '1000') {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        } else {
-            foreach ($response_chnge->response->result as $resp) {
-                $msg = $resp->msg; //for whmcs 
-            }
-        }
-    }
-}
+			$data1 = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first();
+			$data1 = (array) $data1;
 
+			#*******************NameServer*************#
+			if ($_POST['ns1']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns1'] . '</domain:hostObj>';
+			}
+			if ($_POST['ns2']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns2'] . '</domain:hostObj>';
+			}
+			if ($_POST['ns3']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns3'] . '</domain:hostObj>';
+			}
+			if ($_POST['ns4']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns4'] . '</domain:hostObj>';
+			}
+			if ($ns) {
+				$nsnameserver = ' <domain:ns>
+										' . $ns . '
+								 </domain:ns>';
+			}
+			$dnssec = '';
+			if (isset($_POST['cr_d1_dnssec']) && $_POST['cr_d1_dnssec'] == '1') {
+				$dnssec = '<extension>
+											<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+												 <secDNS:dsData>
+															<secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+															<secDNS:alg>3</secDNS:alg>
+															<secDNS:digestType>1</secDNS:digestType>
+															<secDNS:digest>' . strtoupper(bin2hex(uniqid())) . '</secDNS:digest>
+												  </secDNS:dsData>
+											</secDNS:create>
+									   </extension>';
+			}
+			$IDN = new IDNA();
+			$input = $_POST['domain_name'];
+			$domainname = $IDN->encode($input);
 
+			#domian create command
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<create>
+											<domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+												' . $nsnameserver . '
+												 <domain:registrant>' . $_POST['reg_con_id'] . '</domain:registrant>
+												 <domain:authInfo>
+												 <domain:pw>switchpwd' . uniqid() . '</domain:pw>
+												 </domain:authInfo>
+											</domain:create>
+										</create>
+									   ' . $dnssec . '
+									<clTRID>' . rand(9999999, 100000) . '</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'contact_delete_1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$data = (array) $data;
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<delete>
+											<contact:delete xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+												<contact:id>' . $_POST['del_contact_id'] . '</contact:id>
+											</contact:delete>
+										</delete>
+									<clTRID>ABC-12345</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'delete_ns_1') {
 
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['nameserver'];
+			$nameserver = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<delete>
+										<host:delete xmlns:host="urn:ietf:params:xml:ns:host-1.0">
+											<host:name>' . $nameserver . '</host:name>
+										</host:delete>
+									</delete>
+								<clTRID>ABC-12345</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'check_domain_1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domain_name1'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<check>
+											<domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:check>
+										</check>
+									<clTRID>ABC-12345</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'check_domain_2') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domain_name2'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<check>
+											<domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:check>
+										</check>
+									<clTRID>ABC-12345</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'create_domain_2') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
 
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+			$data = (array) $data;
+			$data1 = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first();
+			$data1 = (array) $data1;
 
-function switchepp_clientloginepp($params) {
-    try {
-        $certFile = __DIR__ . '/../cert/cert.pem';
-        $client = new Net_EPP_Client();
-        $use_ssl = true;
-        if (file_exists($certFile)) {
-            $context = stream_context_create();
-            stream_context_set_option($context, 'ssl', 'verify_peer', false);
-            stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
-            stream_context_set_option($context, 'ssl', 'local_cert', $certFile);
-            stream_context_set_option($context, 'ssl', 'passphrase', $params['passphrase']);
-            $client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
-        } else {
-            $context = false;
-            $client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
-        }
-    } catch (Exception $e) {
-        $port = $params['eppport'];
-        $client = array("error" => 'true', 'msg' => "Connection Error: " . $e->getMessage());
-    }
-    return $client;
+			#*******************NameServer*************#
+			if ($_POST['ns1']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns1'] . '</domain:hostObj>';
+			}
+			if ($_POST['ns2']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns2'] . '</domain:hostObj>';
+			}
+			if ($_POST['ns3']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns3'] . '</domain:hostObj>';
+			}
+			if ($_POST['ns4']) {
+				$ns .= '<domain:hostObj>' . $_POST['ns4'] . '</domain:hostObj>';
+			}
+			if ($ns) {
+				$nsnameserver = ' <domain:ns>
+										' . $ns . '
+								 </domain:ns>';
+			}
+			$IDN = new IDNA();
+			$input = $_POST['domain_name'];
+			$domainname = $IDN->encode($input);
 
-    return $client;
+			#domian create command
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<create>
+											<domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+												' . $nsnameserver . '
+												 <domain:registrant>' . $_POST['reg_con_id'] . '</domain:registrant>
+												 <domain:authInfo>
+												 <domain:pw>switchpwd' . uniqid() . '</domain:pw>
+												 </domain:authInfo>
+											</domain:create>
+										</create>
+									<clTRID>' . rand(9999999, 100000) . '</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'create_ns2') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								   <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+										<command>
+											<create>
+												<host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0">
+													 <host:name>' . $_POST['host_name'] . '</host:name>
+													 <host:addr ip="v4">' . $_POST['ip'] . '</host:addr>
+												</host:create>
+											</create>
+										<clTRID>' . rand(9999999, 100000) . '</clTRID>
+										</command>
+								   </epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'update_domain1w_2') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domain'];
+			$domainname = $IDN->encode($input);
+			$input1 = $_POST['upd_nameserver'];
+			$nameserver = $IDN->encode($input1);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<update>
+											<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+												<domain:add>
+													<domain:ns>
+													<domain:hostObj>' . $nameserver . '</domain:hostObj>
+													</domain:ns>
+												</domain:add>
+												<domain:rem/>
+												<domain:chg/>
+								 </domain:update>
+								 </update>
+								 <clTRID>Test3</clTRID>
+								 </command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'update_con_2') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+
+			$data = Capsule::table('switchepp_contact_details')->where('type', 'tech')->first();
+			$data = (array) $data;
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								<command>
+									<update>
+										<contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+											<contact:id>' . $_POST['contact_id_2'] . '</contact:id>
+											<contact:chg>
+												<contact:postalInfo type="loc">
+													<contact:org>' . $_POST['cname'] . '</contact:org>
+													<contact:addr>
+														<contact:street>' . $_POST['add1'] . '</contact:street>
+														<contact:street>' . $_POST['add2'] . '</contact:street>
+														<contact:city>' . $_POST['up_city'] . '</contact:city>
+														<contact:pc>' . $_POST['pcode'] . '</contact:pc>
+														<contact:cc>' . $_POST['up_country'] . '</contact:cc>
+													</contact:addr>
+												</contact:postalInfo>
+												<contact:voice>' . $_POST['up_phone'] . '</contact:voice>
+												<contact:fax/>
+												<contact:email>' . $_POST['email'] . '</contact:email>
+												<contact:authInfo>
+													<contact:pw>con-' . time() . '</contact:pw>
+												</contact:authInfo>
+											</contact:chg>
+										</contact:update>
+									</update>
+								<clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+								</command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'del_domain1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domaininfo'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<delete>
+											<domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+											</domain:delete>
+										</delete>
+									<clTRID>ABC-12345</clTRID>
+									</command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'restore_domain1') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domaininfo'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+							<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+								 <command>
+									 <update>
+										 <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+											<domain:name>' . $domainname . '</domain:name>
+											<domain:chg />
+										 </domain:update>
+									 </update>
+									 <extension>
+										 <rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
+											<rgp:restore op="request" />
+										 </rgp:update>
+									 </extension>
+								 </command>
+							</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	} elseif ($_POST['eppCommand'] == 'update_domain_auth') {
+		$client = switchepp_clientloginepp($params);      #Epp Connection
+		if (is_array($client)) {
+			$error = $client['msg'];
+		}
+		$xml1 = switchepp_loggedinepp($client, $params);
+		$msg = $xml1['status'];
+		$request = $xml1['request'];
+		$response_xml = htmlentities($xml1['response']);
+		if ($xml1['status'] == "success") {
+			$IDN = new IDNA();
+			$input = $_POST['domain_update'];
+			$domainname = $IDN->encode($input);
+			$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+								<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+									<command>
+										<update>
+											<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+												<domain:name>' . $domainname . '</domain:name>
+												<domain:chg>
+													<domain:authInfo>
+														<domain:pw>' . $_POST['auth'] . '</domain:pw>
+													</domain:authInfo>
+												</domain:chg>
+								 </domain:update>
+								 </update>
+								 <clTRID>Test3</clTRID>
+								 </command>
+								</epp>';
+			$request_xml = $client->request($request);
+			$response_xml = htmlentities($request_xml);
+			$response_chnge = simplexml_load_string($request_xml);
+			$success = $response_chnge->response->result->attributes()->code[0];
+			if ($success == '1000') {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			} else {
+				foreach ($response_chnge->response->result as $resp) {
+					$msg = $resp->msg; //for whmcs
+				}
+			}
+			switchepp_logoutinepp($client, $params);
+		}
+	}
+}
+
+function switchepp_clientloginepp($params)
+{
+	try {
+		$certFile = __DIR__ . '/../cert/cert.pem';
+		$client = new Net_EPP_Client();
+		$use_ssl = true;
+		if (file_exists($certFile)) {
+			$context = stream_context_create();
+			stream_context_set_option($context, 'ssl', 'verify_peer', false);
+			stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
+			stream_context_set_option($context, 'ssl', 'local_cert', $certFile);
+			stream_context_set_option($context, 'ssl', 'passphrase', $params['passphrase']);
+			$client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
+		} else {
+			$context = false;
+			$client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
+		}
+	} catch (Exception $e) {
+		$port = $params['eppport'];
+		$client = array("error" => 'true', 'msg' => "Connection Error: " . $e->getMessage());
+	}
+	return $client;
+
+	return $client;
+}
+
+function switchepp_logoutinepp($client, $params)
+{
+	if (is_array($client)) {
+		$error = $client['msg'];
+		return $error;
+	}
+	$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+                            <epp:command xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
+                                <epp:logout />
+                                <epp:clTRID>TEST-REGISTRAR-A</epp:clTRID>
+                            </epp:command>
+                        </epp>';
+	$response = $client->request($request);
+	return $response;
 }
 
-function switchepp_loggedinepp($client, $params) {
-    if (is_array($client)) {
-        $error = $client['msg'];
-        return $error;
-    }
-    if ($params['eppurl'] != '' && $params['eppport'] != '' && $params['registrar_password'] != '' && $params['registrar_id'] != '') {
-        $request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+function switchepp_loggedinepp($client, $params)
+{
+	if (is_array($client)) {
+		$error = $client['msg'];
+		return $error;
+	}
+	if ($params['eppurl'] != '' && $params['eppport'] != '' && $params['registrar_password'] != '' && $params['registrar_id'] != '') {
+		$request = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                     <command>
                         <login>
@@ -1288,27 +1666,37 @@ function switchepp_loggedinepp($client, $params) {
                                 <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
                                 <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
                                 <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
-                                <svcExtension>
-                                    <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
-                                    <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
-                                    <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
-                                </svcExtension>
+								<svcExtension>
+								 <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
+								 <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
+								 <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
+								 <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
+								 <extURI>urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0</extURI>
+								</svcExtension>
                             </svcs>
                         </login>
                     <clTRID>' . rand(9999999, 100000) . '</clTRID>
                     </command>
                 </epp>';
-        //error_log("switchepp_loggedinepp: " . $client . " | " . $params);
-        $response = $client->request($request);
-        return $response;
-    }
+		$response = $client->request($request);
+		$response_chnge = simplexml_load_string($response);
+		$success = $response_chnge->response->result->attributes()->code[0];
+		if ($success != '1000') {
+			foreach ($response_chnge->response->result as $resp) {
+				$status = $resp->msg; //for whmcs
+			}
+		} else
+			$status = "success";
+		return ["status" => $status, "request" => $request, "response" => $response];
+	}
 }
 
-function switchepp_domain_info($domain) {
-    $IDN = new IDNA();
-    $input = $domain;
-    $domainname = $IDN->encode($input);
-    $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+function switchepp_domain_info($domain)
+{
+	$IDN = new IDNA();
+	$input = $domain;
+	$domainname = $IDN->encode($input);
+	$xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                     <command>
                         <info>
@@ -1319,611 +1707,763 @@ function switchepp_domain_info($domain) {
                     <clTRID>clientref-' . rand(100, 999) . '</clTRID>
                     </command>
                 </epp>';
-    return $xml;
+	return $xml;
 }
 ?><html>
-    <head>
-        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
-        <script>
-            $(document).ready(function () {
-                $('#selectcommand').change(function () {
-                    var command = this.value;
-                    
-                    if (command == 'create_con1') {
-                	//alert(command);
-                        $('#createContact1').css('display', 'block');
-                        $('#contactInfo').css('display', 'none');
-                    } else {
-                        $('#createContact1').css('display', 'none');
-                    }
-                    
-                    if (command == 'create_con2') {
-                	//alert(command);
-                        $('#createContact2').css('display', 'block');
-                        $('#contactInfo').css('display', 'none');
-                    } else {
-                        $('#createContact2').css('display', 'none');
-                    }
 
-                    if (command == 'update_con_2') {
-                	alert(command);
-                        $("#updateContact").css("display", "block");
-                    } else {
-                        $("#updateContact").css("display", "none");
-                    }
-                    if (command == 'info_tech_contact') {
-                        $("#info_tech_contact").css("display", "block");
-                    } else {
-                        $("#info_tech_contact").css("display", "none");
-                    }
-                    if (command == 'transfer_domain1') {
-                        $('#transferDomain').css('display', 'block');
-                    } else {
-                        $('#transferDomain').css('display', 'none');
-                    }
-                    if (command == 'create_ns1' || command == 'create_ns2') {
-                        $("#create_name_server1").css("display", "block");
-                    } else {
-                        $("#create_name_server1").css("display", "none");
-                    }
-                    if (command == 'check_contact1') {
-                        $("#check_contact1").css("display", "block");
-                    } else {
-                        $("#check_contact1").css("display", "none");
-                    }
-                    if (command == 'update_domain1w_2') {
-                        $("#update_domain1_2").css("display", "block");
-                    } else {
-                        $("#update_domain1_2").css("display", "none");
-                    }
-                    if (command == 'update_domain_auth') {
-                        $("#update_domain_auth").css("display", "block");
-                    } else {
-                        $("#update_domain_auth").css("display", "none");
-                    }
-                    if (command == 'delete_ns_1') {
-                        $("#delete_ns_1").css("display", "block");
-                    } else {
-                        $("#delete_ns_1").css("display", "none");
-                    }
-                    if (command == 'contact_delete_1') {
-                        $("#contact_delete_1").css("display", "block");
-                    } else {
-                        $("#contact_delete_1").css("display", "none");
-                    }
-                    if (command == 'check_domain_2') {
-                        $("#check_domain_2").css("display", "block");
-                    } else {
-                        $("#check_domain_2").css("display", "none");
-                    }
-                    if (command == 'create_domain_1' || command == 'create_domain_2') {
-                        $("#create_domain").css("display", "block");
-                    } else {
-                        $("#create_domain").css("display", "none");
-                    }
-                    if (command == 'restore_domain_1') {
-                        $("#restore_domain_1").css("display", "block");
-                    } else {
-                        $("#restore_domain_1").css("display", "none");
-                    }
-                    if (command == 'update_domain_1') {
-                        $("#update_domain_1").css("display", "block");
-                    } else {
-                        $("#update_domain_1").css("display", "none");
-                    }
-                    if (command == 'update_domain_1_contact') {
-                        $("#update_domain_1_contact").css("display", "block");
-                    } else {
-                        $("#update_domain_1_contact").css("display", "none");
-                    }
-                    if (command == 'login') {
-                        $("#changepw").css('display', 'block');
-                    } else {
-                        $("#changepw").css('display', 'none');
-                    }
-                    if (command == 'logout') {
-                        $("#update_domain_auth").css("display", "none");
-                    }
-                    if (command == 'contact_info') {
-                        $('#contactInfo').css('display', 'block');
-                        $('#createContact').css('display', 'none');
-                    } else {
-                        $('#contactInfo').css('display', 'none');
-                    }
+<head>
+	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
+	<script>
+		$(document).ready(function() {
+			$('#selectcommand').change(function() {
+				var command = this.value;
+				//alert(command);
+				if (command == 'create_con1') {
+					$('#createContact1').css('display', 'block');
+				} else {
+					$('#createContact1').css('display', 'none');
+				}
+				if (command == 'update_con_2') {
+					$("#updateContact").css("display", "block");
+				} else {
+					$("#updateContact").css("display", "none");
+				}
+				if (command == 'info_tech_contact') {
+					$("#info_tech_contact").css("display", "block");
+				} else {
+					$("#info_tech_contact").css("display", "none");
+				}
+				if (command == 'create_con2') {
+					$('#createContact').css('display', 'block');
+					$('#contactInfo').css('display', 'none');
+				} else {
+					$('#createContact').css('display', 'none');
+				}
+				if (command == 'transfer_domain1') {
+					$('#transferDomain').css('display', 'block');
+				} else {
+					$('#transferDomain').css('display', 'none');
+				}
+				if (command == 'create_ns1' || command == 'create_ns2') {
+					$("#create_name_server1").css("display", "block");
+				} else {
+					$("#create_name_server1").css("display", "none");
+				}
+				if (command == 'check_contact1') {
+					$("#check_contact1").css("display", "block");
+				} else {
+					$("#check_contact1").css("display", "none");
+				}
+				if (command == 'update_domain1w_2') {
+					$("#update_domain1_2").css("display", "block");
+				} else {
+					$("#update_domain1_2").css("display", "none");
+				}
+				if (command == 'update_domain_auth') {
+					$("#update_domain_auth").css("display", "block");
+				} else {
+					$("#update_domain_auth").css("display", "none");
+				}
+				if (command == 'delete_ns_1') {
+					$("#delete_ns_1").css("display", "block");
+				} else {
+					$("#delete_ns_1").css("display", "none");
+				}
+				if (command == 'contact_delete_1') {
+					$("#contact_delete_1").css("display", "block");
+				} else {
+					$("#contact_delete_1").css("display", "none");
+				}
+				if (command == 'check_domain_1') {
+					$("#check_domain_1").css("display", "block");
+				} else {
+					$("#check_domain_1").css("display", "none");
+				}
+				if (command == 'check_domain_2') {
+					$("#check_domain_2").css("display", "block");
+				} else {
+					$("#check_domain_2").css("display", "none");
+				}
+				if (command == 'create_domain_1' || command == 'create_domain_2') {
+					$("#create_domain").css("display", "block");
+				} else {
+					$("#create_domain").css("display", "none");
+				}
+				if (command == 'update_domain_1') {
+					$("#update_domain_1").css("display", "block");
+				} else {
+					$("#update_domain_1").css("display", "none");
+				}
+				if (command == 'update_domain_1_ctsd') {
+					$("#update_domain_1_ctsd").css("display", "block");
+				} else {
+					$("#update_domain_1_ctsd").css("display", "none");
+				}
+				if (command == 'update_domain_1_dnssec' || command == 'replace_domain_dnssec') {
+					$("#update_domain_1_dnssec").css("display", "block");
+				} else {
+					$("#update_domain_1_dnssec").css("display", "none");
+				}
+				if (command == 'login') {
+					$("#changepw").css('display', 'block');
+				} else {
+					$("#changepw").css('display', 'none');
+				}
+				if (command == 'logout') {
+					$("#update_domain_auth").css("display", "none");
+				}
+				if (command == 'contact_info') {
+					$('#contactInfo').css('display', 'block');
+					$('#createContact').css('display', 'none');
+				} else {
+					$('#contactInfo').css('display', 'none');
+				}
+
+				//                    if (command == 'contact_delete1') {
+				//                        $('#contactInfo').css('display', 'block');
+				//                        //$('#createContact').css('display', 'none');
+				//                    } else {
+				//                        $('#contactInfo').css('display', 'none');
+				//                    }
+				if (command == 'domain_create') {
+					$('#optionsforcontacts').css('display', 'block');
 
-                    //                    if (command == 'contact_delete1') {
-                    //                        $('#contactInfo').css('display', 'block');
-                    //                        //$('#createContact').css('display', 'none');
-                    //                    } else {
-                    //                        $('#contactInfo').css('display', 'none');
-                    //                    }
-                    if (command == 'domain_create') {
-                        $('#optionsforcontacts').css('display', 'block');
+				} else {
+					$('#optionsforcontacts').css('display', 'none');
+				}
 
-                    } else {
-                        $('#optionsforcontacts').css('display', 'none');
-                    }
+				if (command == 'domain_info' || command == 'domain_check' || command == 'domain_delete1' || command == 'del_domain1' || command == 'domain_info1' || command == 'restore_domain1') {
+					$('#domaininfo').css('display', 'block');
+				} else {
+					$('#domaininfo').css('display', 'none');
+				}
 
-                    if (command == 'domain_info' || command == 'domain_check' || command == 'domain_delete1' || command == 'del_domain1') {
-                        $('#domaininfo').css('display', 'block');
-                    } else {
-                        $('#domaininfo').css('display', 'none');
-                    }
 
+				$('.det').click(function() {
+					// alert(this.id);
+					var selected = this.id;
+					if (selected == 'existing') {
+						$('#selectedoption').val('existing');
+					} else {
+						$('#selectedoption').val('newdetails');
+						$('#createContactfordomain').css('display', 'block');
+					}
+				});
 
-                    $('.det').click(function () {
-                        // alert(this.id);
-                        var selected = this.id;
-                        if (selected == 'existing') {
-                            $('#selectedoption').val('existing');
-                        } else {
-                            $('#selectedoption').val('newdetails');
-                            $('#createContactfordomain').css('display', 'block');
-                        }
-                    });
+			});
+		});
+	</script>
+</head>
 
-                });
-            });
-        </script>
-    </head>
-    <body>
-        <?php
-        $rows = Capsule::table('switchepp_login_details')->count();
-        $data = Capsule::table('switchepp_login_details')->first();
-        $data = (array) $data;
-        ?>
-        <div style="border:1px solid red;float:left;width: 50%;background: #dff0d8;margin-left: 25%;  padding: 10px;border: 1px solid gray;border-radius: 7px;">
+<body>
+	<?php
+	$rows = Capsule::table('switchepp_login_details')->count();
+	$data = Capsule::table('switchepp_login_details')->first();
+	$data = (array) $data;
+	?>
+	<div style="border:1px solid red;float:left;width: 50%;background: #dff0d8;margin-left: 25%;  padding: 10px;border: 1px solid gray;border-radius: 7px;">
 
-            <form action="" method="POST">
-                <h3 style="text-align: center;margin-top: 5px;">Try our EPP Demonstrator:</h3>
+		<form action="" method="POST">
+			<h3 style="text-align: center;margin-top: 5px;">Try Our EPP Demonstrator:</h3>
 
-                <table style="margin: 12px 88px;">
-                    <tr>
-                        <td>
-                            <table>
-                                <tr>
-                                    <td>Socket Url :</td><td><input type="text" required="required" name="epp_url" value="<?php echo $data['epp_url']; ?>"></td>
-                                </tr>
-                                <tr>
-                                    <td>login Id :</td><td><input type="text" required="required" name="login_id" value="<?php echo $data['username']; ?>"></td>
-                                </tr>
-                            </table>
-                        </td>
-                        <td>
-                            <table>
-                                <tr>
-                                    <td>Port :</td><td><input type="text" required="required" name="port" value="<?php echo $data['port']; ?>"></td>
-                                </tr>
-                                <tr>
-                                    <td>Password :</td><td><input type="text" required="required" name="password" value="<?php echo $data['password']; ?>"></td>
-                                </tr>
-                            </table>
-                        </td>
-                    </tr>
-                    <input type="hidden" name="save" value="Save To Make Connection">
-<!--                        <tr>
+			<table style="margin: 12px 88px;">
+				<tr>
+					<td>
+						<table>
+							<tr>
+								<td>Socket Url :</td>
+								<td><input type="text" required="required" name="epp_url" value="<?php echo $data['epp_url']; ?>"></td>
+							</tr>
+							<tr>
+								<td>login Id :</td>
+								<td><input type="text" required="required" name="login_id" value="<?php echo $data['username']; ?>"></td>
+							</tr>
+						</table>
+					</td>
+					<td>
+						<table>
+							<tr>
+								<td>Port :</td>
+								<td><input type="text" required="required" name="port" value="<?php echo $data['port']; ?>"></td>
+							</tr>
+							<tr>
+								<td>Password :</td>
+								<td><input type="text" required="required" name="password" value="<?php echo $data['password']; ?>"></td>
+							</tr>
+						</table>
+					</td>
+				</tr>
+				<input type="hidden" name="save" value="Save To Make Connection">
+				<!--                        <tr>
                         <td colspan="3"><input type="submit" name="save" value="Save To Make Connection"></td>
                     </tr>-->
-                </table>
-                <?php //} if ($rows > 0) {                        ?>
-                <p align="center">Select Command to execute</p>
-                <p align="center"><select name="eppCommand" id="selectcommand">
-                        <option value="">Select an EPP command ...</option>
-                        <!--<optgroup label="EPP Core Commands">-->
-                        <option value="hello">Hello Command</option>
-                        <option value="login">1: Login and change password</option>
-                        <option value="poll">2: Poll and confirm messages</option>
-                        <option value="transfer_domain1">3: Transfer domain 1</option>
-                        <option value="acknoledge_msg">4: Acknowledge messages </option>
-                        <!--</optgroup>-->
-                        <!--<optgroup label="EPP Contact Commands">-->
-                        <option value="check_contact1">5: Check contact 1</option>
-                        <option value="create_con1">6: Create contact 1</option>
-                        <option value="create_ns1">7: Create name server 1</option>
-                        <option value="domain_info">8: Info domain 1</option>
-                        <option value="info_tech_contact">9: Info Tech Contact</option>
-                        <!--</optgroup>-->
-                        <!--<optgroup label="EPP Domain Commands">-->
-                        <option value="update_domain_1">10: Update domain 1</option>
-                        <option value="create_con2">11: Create contact 2</option>
-                        <option value="domain_delete1">12: Delete domain 1 (for a holder transfer)</option>
-                        <option value="restore_domain_1">13: Restore domain 1</option>
-                        <option value="update_domain_1_contact">14: Update domain 1 Contact</option>
-                        <option value="contact_delete_1">15: Delete contact 1</option>
-                        <option value="delete_ns_1">16: Delete name server 1</option>
-                        <option value="check_domain_2">17: Check domain</option>
-                        <option value="create_domain_2">18: Create domain 2</option>
-                        <option value="create_ns2">19: Create name server 2</option>
-                        <option value="update_domain1w_2">20: Update domain 1 with ns 2</option>
-                        <option value="update_con_2">21: Update contact 2</option>
-                        <option value="update_domain_auth">22: Update domain 2 with authinfo</option>
-                        <option value="create_domain_1">Create domain 1</option>
-                        <option value="del_domain1">Delete domain 1</option>
-                        <option value="logout">Logout</option>
-                        <!--</optgroup>-->
-                    </select>
-                </p>
-                <p align="center" style="color: #ff0000;"><?php echo $error; ?></p>
-                <?php //}                        ?>
-                <p style="display: none;" id="hostip" align="center">Enter  <input type="text" name="ipaddress" id="field" placeholder="ns1.example-12345.com"></p>
-                <p style="display: none;" id="optionsforcontacts">
-                    Enter Domain Name : <input type="text" name="domain" placeholder="xyz123.qa"> <br> <br> 
-                                <input type="radio" name="usedetails" class="det" id="existing">Use Existing Contacts<br>
-                                        <input type="radio" class="det" name="usedetails" id="newdetails">Make New
-                                            <input type="hidden" id="selectedoption" name="selectedoption" value="">
-                                                </p>
-                                                </table>
-                                                <table style="display: none" id="createContactfordomain">
-                                                    <tbody>
-                                                        <tr><td>Name </td><td><input type="text" name="c_fullname" placeholder="your fullname"></td></tr>
-                                                        <tr><td>Company name </td><td><input type="text" name="c_companyname" placeholder="your company name"></td></tr>
-                                                        <tr><td>Address1 </td><td><input type="text" name="c_address1" placeholder="your address"></td></tr>
-                                                        <tr><td>Address2 </td><td><input type="text" name="c_address2" placeholder="alternate address"></td></tr>
-                                                        <tr><td>City </td><td><input type="text" name="c_city" placeholder="your city"></td></tr>
-                                                        <tr><td>Postcode </td><td><input type="text" name="c_postcode" placeholder="zip code"></td></tr>
-                                                        <tr><td>Country </td><td><select name="country" id="country" tabindex="13"><?php
-                                                                    foreach (Capsule::table('switchepp_manage_country')->get() as $rowdata) {
-                                                                        $rowdata = (array) $rowdata;
-                                                                        ?>
-                                                                        <option value="<?php echo $rowdata['country_key']; ?>"><?php echo $rowdata['country']; ?></option>
-                                                                    <?php } ?></select></td></tr>
-                                                        <tr><td>Phone Number</td><td><input type="text" name="c_phone" placeholder="+1.123456789"></td></tr>
-                                                        <tr><td>Email</td><td><input type="email" name="c_email" placeholder="abc@abc123.com"></td></tr>
-                                                    </tbody>
-                                                </table>
-                                                <table style="display: none;" id="createContact">
-                                                    <tbody>
-                                                        <tr><td>Contact id</td><td><input name="contact_id2" type="text" value="" placeholder="TEST-123456"></td></tr>
-                                                        <tr><td>Name </td><td><input type="text" name="fullname" placeholder="your fullname"></td></tr>
-                                                        <tr><td>Company name </td><td><input type="text" name="companyname" placeholder="your company name"></td></tr>
-                                                        <tr><td>Address1 </td><td><input type="text" name="address1" placeholder="your address"></td></tr>
-                                                        <tr><td>Address2 </td><td><input type="text" name="address2" placeholder="alternate address"></td></tr>
-                                                        <tr><td>City </td><td><input type="text" name="city" placeholder="your city"></td></tr>
-                                                        <tr><td>Postcode </td><td><input type="text" name="postcode" placeholder="zip code"></td></tr>
-                                                        <tr><td>Country </td><td><select name="country" id="country" tabindex="13">
-                                                    		<option value="CH">Switzerland</option>
-                                                    		<option value="DE">Germany</option>
-                                                    		<option value="LI">Liechtenstein</option>
-                                                    		<option value="IT">Italy</option>
-                                                    		<option value="FR">France</option>
-                                                        </select></td></tr>
-                                                        <tr><td>Phone Number</td><td><input type="text" name="phone" placeholder="0123567890"></td></tr>
-                                                        <tr><td>Email</td><td><input type="email" name="email" placeholder="abc@abc123.com"></td></tr>
-                                                    </tbody>
-                                                </table>
-                                                <table style="display: none;" id="check_contact1">
-                                                    <tr>
-                                                        <td>Contact id 1:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="cont1"</td>
-                                                    </tr>
-                                                    <tr>
+			</table>
+			<?php //} if ($rows > 0) {
+			?>
+			<p align="center">Select Command to execute</p>
+			<p align="center"><select name="eppCommand" id="selectcommand">
+					<option value="">Select an EPP command ...</option>
+					<!--<optgroup label="EPP Core Commands">-->
+					<option value="hello">1 (Hello Command)</option>
+					<option value="login">2 (Login and change password)</option>
+					<option value="poll">3 (Poll and confirm messages)</option>
+					<option value="transfer_domain1">4 (Transfer domain 1)</option>
+					<option value="acknoledge_msg">5 (Acknowledge messages) </option>
+					<!--</optgroup>-->
+					<!--<optgroup label="EPP Contact Commands">-->
+					<option value="check_contact1">6 (Check contact 1)</option>
+					<option value="create_con1">7 (Create contact 1)</option>
+					<option value="create_domain_1">8 (Create domain 1)</option>
+					<option value="check_domain_1">9 (Check domain 1)</option>
+					<option value="create_ns1">10 (Create name server 1)</option>
+					<option value="domain_info">11 (Info domain 1)</option>
+					<option value="info_tech_contact">12 (Info Tech Contact)</option>
+					<!--</optgroup>-->
+					<!--<optgroup label="EPP Domain Commands">-->
+					<option value="update_domain_1_ctsd">13 (Update domain 1 (complete transfer))</option>
+					<option value="create_con2">14 (Create contact 2)</option>
+					<option value="del_domain1">15 (Delete domain 1)</option>
+					<option value="restore_domain1">16 (Restore domain 1)</option>
+					<option value="update_domain_1">17 (Update domain 1)</option>
+					<option value="contact_delete_1">18 (Delete contact 1)</option>
+					<option value="delete_ns_1">19 (Delete name server 1)</option>
+					<option value="check_domain_2">20 (Check domain 2)</option>
+					<option value="create_domain_2">21 (Create domain 2)</option>
+					<option value="create_ns2">22 (Create name server 2 subordinate of domain 2</option>
+					<option value="update_domain1w_2">23 (Update domain 1 with ns 2)</option>
+					<option value="update_con_2">24 (Update contact 2)</option>
+					<option value="update_domain_auth">25 (Update domain 2 with authinfo)</option>
+					<option value="update_domain_1_dnssec">26 (Update domain 1 with DNSSEC data)</option>
+					<option value="domain_info1">27 (Check update with domain info)</option>
+					<option value="replace_domain_dnssec">28 (Replace DNSSEC data)</option>
+					<option value="logout">29 (Logout)</option>
+					<!--                        <option value="domain_delete1">Delete domain 1 (for a holder transfer)</option>
+                                                <option value="create_domain_1">Create domain 1</option>
+                                                <option value="check_domain_1">Check domain</option>-->
+					<!--</optgroup>-->
+				</select>
+			</p>
+			<p align="center" style="color: #ff0000;"><?php echo $error; ?></p>
+			<?php //}
+			?>
+			<p style="display: none;" id="hostip" align="center">Enter <input type="text" name="ipaddress" id="field" placeholder="ns1.example-12345.com"></p>
+			<p style="display: none;" id="optionsforcontacts">
+				Enter Domain Name : <input type="text" name="domain" placeholder="xyz123.qa"> <br> <br>
+				<input type="radio" name="usedetails" class="det" id="existing">Use Existing Contacts<br>
+				<input type="radio" class="det" name="usedetails" id="newdetails">Make New
+				<input type="hidden" id="selectedoption" name="selectedoption" value="">
+			</p>
+			</table>
+			<table style="display: none" id="createContactfordomain">
+				<tbody>
+					<tr>
+						<td>Name </td>
+						<td><input type="text" name="c_fullname" placeholder="your fullname"></td>
+					</tr>
+					<tr>
+						<td>Company name </td>
+						<td><input type="text" name="c_companyname" placeholder="your company name"></td>
+					</tr>
+					<tr>
+						<td>Address1 </td>
+						<td><input type="text" name="c_address1" placeholder="your address"></td>
+					</tr>
+					<tr>
+						<td>Address2 </td>
+						<td><input type="text" name="c_address2" placeholder="alternate address"></td>
+					</tr>
+					<tr>
+						<td>City </td>
+						<td><input type="text" name="c_city" placeholder="your city"></td>
+					</tr>
+					<tr>
+						<td>Postcode </td>
+						<td><input type="text" name="c_postcode" placeholder="zip code"></td>
+					</tr>
+					<tr>
+						<td>Country </td>
+						<td><select name="country" id="country" tabindex="13"><?php
+																				foreach (Capsule::table('switchepp_manage_country')->get() as $rowdata) {
+																					$rowdata = (array) $rowdata;
+																				?>
+									<option value="<?php echo $rowdata['country_key']; ?>"><?php echo $rowdata['country']; ?></option>
+								<?php } ?>
+							</select></td>
+					</tr>
+					<tr>
+						<td>Phone Number</td>
+						<td><input type="text" name="c_phone" placeholder="+1.123456789"></td>
+					</tr>
+					<tr>
+						<td>Email</td>
+						<td><input type="email" name="c_email" placeholder="abc@abc123.com"></td>
+					</tr>
+				</tbody>
+			</table>
+			<table style="display: none;" id="createContact">
+				<tbody>
+					<tr>
+						<td>Contact id</td>
+						<td><input name="contact_id2" type="text" value="" placeholder="TEST-123456"></td>
+					</tr>
+					<tr>
+						<td>Name </td>
+						<td><input type="text" name="fullname" placeholder="your fullname"></td>
+					</tr>
+					<tr>
+						<td>Company name </td>
+						<td><input type="text" name="companyname" placeholder="your company name"></td>
+					</tr>
+					<tr>
+						<td>Address1 </td>
+						<td><input type="text" name="address1" placeholder="your address"></td>
+					</tr>
+					<tr>
+						<td>Address2 </td>
+						<td><input type="text" name="address2" placeholder="alternate address"></td>
+					</tr>
+					<tr>
+						<td>City </td>
+						<td><input type="text" name="city" placeholder="your city"></td>
+					</tr>
+					<tr>
+						<td>Postcode </td>
+						<td><input type="text" name="postcode" placeholder="zip code"></td>
+					</tr>
+					<tr>
+						<td>Country </td>
+						<td><select name="country" id="country" tabindex="13"><?php
+																				foreach (Capsule::table('switchepp_manage_country')->get() as $rowdata) {
+																					$rowdata = (array) $rowdata;
+																				?>
+									<option value="<?php echo $rowdata['country_key']; ?>"><?php echo $rowdata['country']; ?></option>
+								<?php } ?>
+							</select></td>
+					</tr>
+					<tr>
+						<td>Phone Number</td>
+						<td><input type="text" name="phone" placeholder="0123567890"></td>
+					</tr>
+					<tr>
+						<td>Email</td>
+						<td><input type="email" name="email2" placeholder="abc@abc123.com"></td>
+					</tr>
+				</tbody>
+			</table>
+			<table style="display: none;" id="check_contact1">
+				<tr>
+					<td>Contact id 1:</td>
+					<td></td>
+					<td><input type="text" value="" name="cont1"></td>
+				</tr>
+				<!--                                                    <tr>
                                                         <td>Contact id 2:</td>
                                                         <td></td>
-                                                        <td><input type="text" value="" name="cont2"</td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display:none;" id="info_tech_contact">
-                                                    <tr>
-                                                        <td>Contact id:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="cont_info" value="" placeholder="TEST-12345"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display:none;" id="contact_delete_1">
-                                                    <tr>
-                                                        <td>Contact Id:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="del_contact_id" placeholder="TEST-12345"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="createContact1">
-                                                    <tbody>
-                                                        <tr><td>Contact id</td><td><input name="contact_id1" type="text" value="" placeholder="TEST-123456"></td></tr>
-                                                        <tr><td>Name </td><td><input type="text" name="cfullname" placeholder="your fullname"></td></tr>
-                                                        <tr><td>Company name </td><td><input type="text" name="ccompanyname" placeholder="your company name"></td></tr>
-                                                        <tr><td>Address1 </td><td><input type="text" name="caddress1" placeholder="your address"></td></tr>
-                                                        <tr><td>Address2 </td><td><input type="text" name="caddress2" placeholder="alternate address"></td></tr>
-                                                        <tr><td>City </td><td><input type="text" name="ccity" placeholder="your city"></td></tr>
-                                                        <tr><td>Postcode </td><td><input type="text" name="cpostcode" placeholder="zip code"></td></tr>
-                                                        <tr><td>Country </td><td><select name="ccountry" id="country" tabindex="13">
-                                                    		<option value="CH">Switzerland</option>
-                                                    		<option value="DE">Germany</option>
-                                                    		<option value="LI">Liechtenstein</option>
-                                                    		<option value="IT">Italy</option>
-                                                    		<option value="FR">France</option>
+                                                        <td><input type="text" value="" name="cont2"></td>
+                                                    </tr>-->
+			</table>
+			<table style="display:none;" id="info_tech_contact">
+				<tr>
+					<td>Contact id:</td>
+					<td></td>
+					<td><input type="text" name="cont_info" value="" placeholder="TEST-12345"></td>
+				</tr>
+			</table>
+			<table style="display:none;" id="contact_delete_1">
+				<tr>
+					<td>Contact Id:</td>
+					<td></td>
+					<td><input type="text" value="" name="del_contact_id" placeholder="TEST-12345"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="createContact1">
+				<tbody>
+					<tr>
+						<td>Contact id</td>
+						<td><input name="contact_id" type="text" value="" placeholder="TEST-123456"></td>
+					</tr>
+					<tr>
+						<td>Name </td>
+						<td><input type="text" name="cfullname" placeholder="your fullname"></td>
+					</tr>
+					<tr>
+						<td>Company name </td>
+						<td><input type="text" name="ccompanyname" placeholder="your company name"></td>
+					</tr>
+					<tr>
+						<td>Address1 </td>
+						<td><input type="text" name="caddress1" placeholder="your address"></td>
+					</tr>
+					<tr>
+						<td>Address2 </td>
+						<td><input type="text" name="caddress2" placeholder="alternate address"></td>
+					</tr>
+					<tr>
+						<td>City </td>
+						<td><input type="text" name="ccity" placeholder="your city"></td>
+					</tr>
+					<tr>
+						<td>Postcode </td>
+						<td><input type="text" name="cpostcode" placeholder="zip code"></td>
+					</tr>
+					<tr>
+						<td>Country </td>
+						<td><select name="ccountry" id="country" tabindex="13"><?php
+																				foreach (Capsule::table('switchepp_manage_country')->get() as $rowdata) {
+																					$rowdata = (array) $rowdata;
+																				?>
+									<option value="<?php echo $rowdata['country_key']; ?>"><?php echo $rowdata['country']; ?></option>
+								<?php } ?>
+							</select></td>
+					</tr>
+					<tr>
+						<td>Phone Number</td>
+						<td><input type="text" name="cphone" placeholder="0123567890"></td>
+					</tr>
+					<tr>
+						<td>Email</td>
+						<td><input type="email" name="cemail" placeholder="abc@abc123.com"></td>
+					</tr>
+				</tbody>
+			</table>
+			<?php
+			$client = switchepp_clientloginepp($params);      #Epp Connection
+			if (is_array($client)) {
+				$error = $client['msg'];
+			} {
+				$xml1 = switchepp_loggedinepp($client, $params);
 
-                                                            </select></td></tr>
-                                                        <tr><td>Phone Number</td><td><input type="text" name="cphone" placeholder="0123567890"></td></tr>
-                                                        <tr><td>Email</td><td><input type="email" name="cemail" placeholder="abc@abc123.com"></td></tr>
-                                                    </tbody>
-                                                </table>
-                                                <table style="display: none;" id="createContact2">
-                                                    <tbody>
-                                                        <tr><td>Contact id</td><td><input name="contact_id2" type="text" value="" placeholder="TEST-123456"></td></tr>
-                                                        <tr><td>Name </td><td><input type="text" name="cfullname2" placeholder="your fullname"></td></tr>
-                                                        <tr><td>Company name </td><td><input type="text" name="ccompanyname2" placeholder="your company name"></td></tr>
-                                                        <tr><td>Address1 </td><td><input type="text" name="caddress12" placeholder="your address"></td></tr>
-                                                        <tr><td>Address2 </td><td><input type="text" name="caddress22" placeholder="alternate address"></td></tr>
-                                                        <tr><td>City </td><td><input type="text" name="ccity2" placeholder="your city"></td></tr>
-                                                        <tr><td>Postcode </td><td><input type="text" name="cpostcode2" placeholder="zip code"></td></tr>
-                                                        <tr><td>Country </td><td><select name="ccountry2" id="ccountry2" tabindex="13">
-                                                    		<option value="CH">Switzerland</option>
-                                                    		<option value="DE">Germany</option>
-                                                    		<option value="LI">Liechtenstein</option>
-                                                    		<option value="IT">Italy</option>
-                                                    		<option value="FR">France</option>
-                                                            </select></td></tr>
-                                                        <tr><td>Phone Number</td><td><input type="text" name="cphone2" placeholder="0123567890"></td></tr>
-                                                        <tr><td>Email</td><td><input type="email" name="cemail2" placeholder="abc@abc123.com"></td></tr>
-                                                    </tbody>
-                                                </table>
-                                                <?php
-                                                $client = switchepp_clientloginepp($params);      #Epp Connection
-                                                if (is_array($client)) {
-                                                    $error = $client['msg'];
-                                                } {
-                                                    $xml1 = switchepp_loggedinepp($client, $params);
-
-                                                    $result = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
-                                                    $result = (array) $result;
-                                                    if ($result['contact_id'] != '') {
-                                                        $request_xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
-						<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> 
-							 <command> 
-								 <info> 
-									 <contact:info 
-										 xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> 
-										 <contact:id>' . $result['contact_id'] . '</contact:id> 
-									 </contact:info> 
-								 </info> 
-							 <clTRID>ABC-12345</clTRID> 
-							 </command> 
+				$result = Capsule::table('switchepp_contact_details')->where('type', 'admin')->first();
+				$result = (array) $result;
+				if ($result['contact_id'] != '') {
+					$request_xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+						<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+							 <command>
+								 <info>
+									 <contact:info
+										 xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
+										 <contact:id>' . $result['contact_id'] . '</contact:id>
+									 </contact:info>
+								 </info>
+							 <clTRID>ABC-12345</clTRID>
+							 </command>
 						</epp>';
-                                                        $get_response_xml = $client->request($request_xml);
-                                                        $get_xml_data = simplexml_load_string($get_response_xml);
-                                                        $get_data = $get_xml_data->response->resData->children("contact", true)->infData;
-                                                    }
-                                                }
-                                                ?>
-                                                <table style="display: none;" id="updateContact">
-                                                    <tbody>
-                                                        <!--<tr><td>Contact Type </td><td><select name="typeOfcontact"><option value="">Choose</option><option value="registrant">Registrant</option><option value="tech">Tech</option><option value="billing">Billing</option><option value="admin">Admin</option></select></td></tr>-->
-                                                        <tr><td>Contact id</td><td><input name="contact_id" type="text" value="" placeholder="TEST-123456"></td></tr>
-                                                        <tr><td>Name </td><td><input type="text" name="fname" placeholder="your fullname" value="<?php echo $get_data->postalInfo->name; ?>"></td></tr>
-                                                        <tr><td>Company name </td><td><input type="text" name="cname" placeholder="your company name" value="<?php echo $get_data->postalInfo->org; ?>"></td></tr>
-                                                        <tr><td>Address1 </td><td><input type="text" name="add1" placeholder="your address" value="<?php echo $get_data->postalInfo->addr->street[0]; ?>"></td></tr>
-                                                        <tr><td>Address2 </td><td><input type="text" name="add2" placeholder="alternate address" value="<?php echo $get_data->postalInfo->addr->street[1]; ?>"></td></tr>
-                                                        <tr><td>City </td><td><input type="text" name="up_city" placeholder="your city" value="<?php echo $get_data->postalInfo->addr->city; ?>"></td></tr>
-                                                        <tr><td>Postcode </td><td><input type="text" name="pcode" placeholder="zip code" value="<?php echo $get_data->postalInfo->addr->pc; ?>"></td></tr>
-                                                        <tr><td>Country </td><td><select name="up_country" id="country" tabindex="13"><?php
-                                                                    foreach (Capsule::table('switchepp_manage_country')->get() as $rowdata) {
-                                                                        $rowdata = (array) $rowdata;
-                                                                        ?>
-                                                                        <option value="<?php echo $rowdata['country_key']; ?>" <?php if ($rowdata['country_key'] == $get_data->postalInfo->addr->cc) { ?> selected="selected" <?php } ?>><?php echo $rowdata['country']; ?></option>
-                                                                    <?php } ?></select></td></tr>
-                                                        <tr><td>Phone Number</td><td><input type="text" name="up_phone" placeholder="+1.123456789" value="<?php echo $get_data->voice; ?>"></td></tr>
-                                                        <tr><td>Email</td><td><input type="up_email" name="email" placeholder="abc@abc123.com" value="<?php echo $get_data->email; ?>"></td></tr>
-                                                    </tbody>
-                                                </table>
-                                                <table style="display: none;" id="contactInfo">
-                                                    <tbody>
-                                                        <tr>
-                                                        </tr>
-                                                    </tbody>
-                                                </table>
-                                                <table style="display: none;" id="transferDomain">
-                                                    <tr>
-                                                        <td>Transfer Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="trnsfr_domain" value="" placeholder="example.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Password:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="trnsfr_pw" value=""></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="update_domain_auth">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="domain_update" placeholder="example.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Domain Password:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="auth"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="update_domain1_2">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="domain" placeholder="example.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Name Server:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="upd_nameserver"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display:none" id="create_name_server1">
-                                                    <tr>
-                                                        <td>Name Server:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="host_name" value="" placeholder="ns1.yourdomain.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Ip Address:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="ip" value="" placeholder="xx.xx.xx.xx"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="create_domain">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="domain_name" placeholder="example.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Reg Contact id:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="reg_con_id" placeholder="TEST-12345"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Tech Contact id:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="tech_con_id" placeholder="TEST-12345"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Name Server 1:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="ns1.yourdomain.com" name="ns1"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Name Server 2:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="ns2.yourdomain.com" name="ns2"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Name Server 3:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="ns3"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Name Server 4:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="ns4"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Name Server 5:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="ns5"></td>
-                                                    </tr>
+					$get_response_xml = $client->request($request_xml);
+					$get_xml_data = simplexml_load_string($get_response_xml);
+					$get_data = $get_xml_data->response->resData->children("contact", true)->infData;
+				}
+			}
+			?>
+			<table style="display: none;" id="updateContact">
+				<tbody>
+					<!--<tr><td>Contact Type </td><td><select name="typeOfcontact"><option value="">Choose</option><option value="registrant">Registrant</option><option value="tech">Tech</option><option value="billing">Billing</option><option value="admin">Admin</option></select></td></tr>-->
+					<tr>
+						<td>Contact ID 2 </td>
+						<td><input type="text" name="contact_id_2" placeholder="TEXT-123344" value=""></td>
+					</tr>
+					<tr>
+						<td>Name </td>
+						<td><input type="text" name="fname" placeholder="your fullname" value="<?php echo $get_data->postalInfo->name; ?>"></td>
+					</tr>
+					<tr>
+						<td>Company name </td>
+						<td><input type="text" name="cname" placeholder="your company name" value="<?php echo $get_data->postalInfo->org; ?>"></td>
+					</tr>
+					<tr>
+						<td>Address1 </td>
+						<td><input type="text" name="add1" placeholder="your address" value="<?php echo $get_data->postalInfo->addr->street[0]; ?>"></td>
+					</tr>
+					<tr>
+						<td>Address2 </td>
+						<td><input type="text" name="add2" placeholder="alternate address" value="<?php echo $get_data->postalInfo->addr->street[1]; ?>"></td>
+					</tr>
+					<tr>
+						<td>City </td>
+						<td><input type="text" name="up_city" placeholder="your city" value="<?php echo $get_data->postalInfo->addr->city; ?>"></td>
+					</tr>
+					<tr>
+						<td>Postcode </td>
+						<td><input type="text" name="pcode" placeholder="zip code" value="<?php echo $get_data->postalInfo->addr->pc; ?>"></td>
+					</tr>
+					<tr>
+						<td>Country </td>
+						<td><select name="up_country" id="country" tabindex="13"><?php
+																					foreach (Capsule::table('switchepp_manage_country')->get() as $rowdata) {
+																						$rowdata = (array) $rowdata;
+																					?>
+									<option value="<?php echo $rowdata['country_key']; ?>" <?php if ($rowdata['country_key'] == $get_data->postalInfo->addr->cc) { ?> selected="selected" <?php } ?>><?php echo $rowdata['country']; ?></option>
+								<?php } ?>
+							</select></td>
+					</tr>
+					<tr>
+						<td>Phone Number</td>
+						<td><input type="text" name="up_phone" placeholder="+1.123456789" value="<?php echo $get_data->voice; ?>"></td>
+					</tr>
+					<tr>
+						<td>Email</td>
+						<td><input type="up_email" name="email" placeholder="abc@abc123.com" value="<?php echo $get_data->email; ?>"></td>
+					</tr>
+				</tbody>
+			</table>
+			<table style="display: none;" id="contactInfo">
+				<tbody>
+					<tr>
+					</tr>
+				</tbody>
+			</table>
+			<table style="display: none;" id="transferDomain">
+				<tr>
+					<td>Transfer Domain Name:</td>
+					<td></td>
+					<td><input type="text" name="trnsfr_domain" value="" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>Password:</td>
+					<td></td>
+					<td><input type="text" name="trnsfr_pw" value=""></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="update_domain_auth">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="domain_update" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>Domain Password:</td>
+					<td></td>
+					<td><input type="text" value="" name="auth"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="update_domain1_2">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="domain" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>Name Server:</td>
+					<td></td>
+					<td><input type="text" value="" name="upd_nameserver"></td>
+				</tr>
+			</table>
+			<table style="display:none" id="create_name_server1">
+				<tr>
+					<td>Name Server:</td>
+					<td></td>
+					<td><input type="text" name="host_name" value="" placeholder="ns1.yourdomain.ch"></td>
+				</tr>
+				<tr>
+					<td>Ip Address:</td>
+					<td></td>
+					<td><input type="text" name="ip" value="" placeholder="xx.xx.xx.xx"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="create_domain">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="domain_name" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>Reg Contact id:</td>
+					<td></td>
+					<td><input type="text" value="" name="reg_con_id" placeholder="TEST-12345"></td>
+				</tr>
+				<tr>
+					<td>Tech Contact id:</td>
+					<td></td>
+					<td><input type="text" value="" name="tech_con_id" placeholder="TEST-12345"></td>
+				</tr>
+				<tr>
+					<td>Name Server 1:</td>
+					<td></td>
+					<td><input type="text" value="ns1.yourdomain.com" name="ns1"></td>
+				</tr>
+				<tr>
+					<td>Name Server 2:</td>
+					<td></td>
+					<td><input type="text" value="ns2.yourdomain.com" name="ns2"></td>
+				</tr>
+				<tr>
+					<td>Name Server 3:</td>
+					<td></td>
+					<td><input type="text" value="" name="ns3"></td>
+				</tr>
+				<tr>
+					<td>Name Server 4:</td>
+					<td></td>
+					<td><input type="text" value="" name="ns4"></td>
+				</tr>
+				<tr>
+					<td>Name Server 5:</td>
+					<td></td>
+					<td><input type="text" value="" name="ns5"></td>
+				</tr>
 
-                                                    <tr>
-                                                        <td>DNSSEC:</td>
-                                                        <td></td>
-                                                        <td><input type="checkbox" value="1" name="cr_d1_dnssec"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="update_domain_1">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="up_domain_name" placeholder="example.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Registrant Id:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="up_contact_id" placeholder="TEST-12345-1"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Add Name Server:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="ns2.yourdomain.com" name="up_add_ns"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Remove Name Server:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="ns1.yourdomain.com" name="up_rem_ns"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>DNSSEC:</td>
-                                                        <td></td>
-                                                        <td><input type="checkbox" value="1" name="up_d_dnssec"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="update_domain_1_contact">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="c_up_domain_name" placeholder="example.ch"></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Registrant Id:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="c_up_contact_id" placeholder="TEST-12345-1"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="check_domain_2">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="domain_name2" placeholder="example.ch"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="restore_domain_1">
-                                                    <tr>
-                                                        <td>Domain Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" value="" name="domain_name1" placeholder="example.ch"></td>
-                                                    </tr>
-                                                </table>
-                                                <table id="delete_ns_1" style="display:none;">
-                                                    <tr>
-                                                        <td>Name Server</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="nameserver" value="" placeholder="ns1.yourdomain.ch"></td>
-                                                    </tr>
-                                                </table>
-                                                <table style="display: none;" id="changepw">
-                                                    <tr>
-                                                        <td>Username Name:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="username" value=""></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>Old Password:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="old_pw" value=""></td>
-                                                    </tr>
-                                                    <tr>
-                                                        <td>New Password:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="new_pw" value=""></td>
-                                                    </tr>
-                                                </table>
-                                                <table id="domaininfo" style="display: none;">
-                                                    <tr>
-                                                        <td>Enter domain:</td>
-                                                        <td></td>
-                                                        <td><input type="text" name="domaininfo" placeholder="example.ch"></td>
-                                                    </tr>
-                                                </table>
+				<tr>
+					<td>DNSSEC:</td>
+					<td></td>
+					<td><input type="checkbox" value="1" name="cr_d1_dnssec"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="update_domain_1">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="up_domain_name1" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>Registrant Id:</td>
+					<td></td>
+					<td><input type="text" value="" name="up_contact_id" placeholder="TEST-12345-1"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="update_domain_1_ctsd">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="up_domain_name2" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>Registrant Id (For Change):</td>
+					<td></td>
+					<td><input type="text" value="" name="chng_contact_id" placeholder="TEST-12345-1"></td>
+				</tr>
+				<tr>
+					<td>Tech Id (For Add):</td>
+					<td></td>
+					<td><input type="text" value="" name="add_contact_id" placeholder="TEST-12345-1"></td>
+				</tr>
+				<tr>
+					<td>Add Name Server:</td>
+					<td></td>
+					<td><input type="text" value="ns2.yourdomain.com" name="up_add_ns"></td>
+				</tr>
+				<tr>
+					<td>Remove Name Server:</td>
+					<td></td>
+					<td><input type="text" value="ns1.yourdomain.com" name="up_rem_ns"></td>
+				</tr>
+				<!--                                                    <tr>
+        <td>DNSSEC:</td>
+        <td></td>
+        <td><input type="checkbox" value="1" name="up_d_dnssec"></td>
+    </tr>-->
+			</table>
+			<table style="display: none;" id="update_domain_1_dnssec">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="up_domain_name" placeholder="example.ch"></td>
+				</tr>
+				<tr>
+					<td>KeyTag:</td>
+					<td></td>
+					<td><input type="text" value="" name="keyTag" placeholder="123456"></td>
+				</tr>
+				<tr>
+					<td>Alg:</td>
+					<td></td>
+					<td><select name="alg">
+							<option>5</option>
+							<option>7</option>
+							<option>8</option>
+							<option>10</option>
+							<option>13</option>
+							<option>14</option>
+							<option>15</option>
+							<option>16</option>
+						</select></td>
+				</tr>
+				<tr>
+					<td>DigestType:</td>
+					<td></td>
+					<td><select name="digesttype">
+							<option>1</option>
+							<option>2</option>
+							<option>4</option>
+						</select></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="check_domain_1">
+				<tr>
+					<td>Domain Name:</td>
+					<td></td>
+					<td><input type="text" value="" name="domain_name1" placeholder="example.ch"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="check_domain_2">
+				<tr>
+					<td>Domain Name 2:</td>
+					<td></td>
+					<td><input type="text" value="" name="domain_name2" placeholder="example2.ch"></td>
+				</tr>
+			</table>
+			<table id="delete_ns_1" style="display:none;">
+				<tr>
+					<td>Name Server</td>
+					<td></td>
+					<td><input type="text" name="nameserver" value="" placeholder="ns1.yourdomain.ch"></td>
+				</tr>
+			</table>
+			<table style="display: none;" id="changepw">
+				<tr>
+					<td>Username Name:</td>
+					<td></td>
+					<td><input type="text" name="username" value=""></td>
+				</tr>
+				<tr>
+					<td>Old Password:</td>
+					<td></td>
+					<td><input type="text" name="old_pw" value=""></td>
+				</tr>
+				<tr>
+					<td>New Password:</td>
+					<td></td>
+					<td><input type="text" name="new_pw" value=""></td>
+				</tr>
+			</table>
+			<table id="domaininfo" style="display: none;">
+				<tr>
+					<td>Enter domain:</td>
+					<td></td>
+					<td><input type="text" name="domaininfo" placeholder="example.ch"></td>
+				</tr>
+			</table>
+
+			<?php
+			// if ($rows > 0) {
+			?>
+			<p align="center"><input type="submit" name="execute" value="Execute"></p>
+			<p align="center"><?php echo $msg; ?></p>
+			<?php // }
+			?>
+		</form>
+		Epp Request : <textarea rows="15" cols="85" style="line-height: 20px;padding: 5px;word-break: break-word;display:<?php
+																															if (!empty($request)) {
+																																echo 'display:block';
+																															} else {
+																																echo 'display:none';
+																															}
+																															?>"><?php
+																																if (!empty($request)) {
+																																	echo $request;
+																																}
+																																?></textarea>
+		<p>************************************************************************************</p>
+		Epp Response : <textarea rows="20" cols="85" style="line-height: 20px;padding: 5px;word-break: break-word;display:<?php
+																															if (!empty($response_xml)) {
+																																echo 'display:block';
+																															} else {
+																																echo 'display:none';
+																															}
+																															?>"><?php
+																																if (!empty($response_xml)) {
+																																	echo $response_xml;
+																																}
+																																?></textarea>
+	</div>
+</body>
 
-                                                <?php
-// if ($rows > 0) {
-                                                ?>
-                                                <p align="center"><input type="submit" name="execute" value="Execute"></p>
-                                                <p align="center"><?php echo $msg; ?></p>
-                                                <?php // }
-                                                ?>
-                                                </form>
-                                                Epp Request : <textarea rows="15" cols="85" style="line-height: 20px;padding: 5px;word-break: break-word;display:<?php
-                                                if (!empty($request)) {
-                                                    echo 'display:block';
-                                                } else {
-                                                    echo'display:none';
-                                                }
-                                                ?>"><?php
-                                                                            if (!empty($request)) {
-                                                                                echo $request;
-                                                                            }
-                                                                            ?></textarea>
-                                                <p>************************************************************************************</p>
-                                                Epp Response : <textarea rows="20" cols="85" style="line-height: 20px;padding: 5px;word-break: break-word;display:<?php
-                                                                         if (!empty($response_xml)) {
-                                                                             echo 'display:block';
-                                                                         } else {
-                                                                             echo'display:none';
-                                                                         }
-                                                                         ?>"><?php
-                                                                             if (!empty($response_xml)) {
-                                                                                 echo $response_xml;
-                                                                             }
-                                                                             ?></textarea>
-                                                </div>
-                                                </body>
-                                                </html>
+</html>

+ 331 - 0
hooks.php

@@ -0,0 +1,331 @@
+<?php
+
+use Illuminate\Database\Capsule\Manager as Capsule;
+
+add_hook('ClientAreaPage', 1, function ($vars) {
+	global $whmcs;
+	if (!class_exists('Net_EPP_Protocol')) {
+		if (file_exists(__DIR__ . "/Net/EPP/Client.php"))
+			require_once __DIR__ . "/Net/EPP/Client.php";
+	}
+	
+	function getSwitchEPP_settinghook($id)
+	{
+		#select table domain data
+		$domain_select_data = Capsule::table('tbldomains')->where('id', $id)->first();
+
+		#select registrar data
+		foreach (Capsule::table('tblregistrars')->where('registrar', $domain_select_data->registrar)->get() as $registrar_data) {
+			$data[$registrar_data->setting] = decrypt($registrar_data->value);
+		}
+		return $data;
+	}
+
+	#*********************Create Epp Connection**************************#
+
+	function switchepp_clientloginepp_hook($params)
+	{
+		try {
+			$certFile = __DIR__ . '/cert/cert.pem';
+			$client = new Net_EPP_Client();
+			$use_ssl = true;
+			if (file_exists($certFile)) {
+				$context = stream_context_create();
+				stream_context_set_option($context, 'ssl', 'verify_peer', false);
+				stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
+				stream_context_set_option($context, 'ssl', 'local_cert', $certFile);
+				stream_context_set_option($context, 'ssl', 'passphrase', $params['passphrase']);
+				$client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
+			} else {
+				$context = false;
+				$client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
+			}
+		} catch (Exception $e) {
+			$port = $params['eppport'];
+			throw new exception("Connection Error: " . $e->getMessage());
+		}
+		return $client;
+	}
+
+	#*********************Epp client login**************************#
+
+	function switchepp_loggedinepp_hook($client, $params)
+	{
+		$xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+	                <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+	                    <command>
+	                        <login>
+	                            <clID>' . $params['registrar_id'] . '</clID>
+	                            <pw>' . $params['registrar_password'] . '</pw>
+	                            <options>
+	                                <version>1.0</version>
+	                                <lang>en</lang>
+	                            </options>
+	                            <svcs>
+	                                <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
+	                                <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
+	                                <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
+									<svcExtension>
+									 <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
+									 <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
+									 <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
+									 <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
+									 <extURI>urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0</extURI>
+									</svcExtension>
+	                            </svcs>
+	                        </login>
+	                    <clTRID>' . rand(9999999, 100000) . '</clTRID>
+	                    </command>
+	                </epp>';
+		$response = $client->request($xml);
+		logModuleCall('SWITCH EPP', 'login', $xml, $response);
+		$result = new SimpleXMLElement($response);
+
+		if ($result->response->result->attributes()->code >= 2000) {
+			throw new exception($result->response->result->msg . '. ' . $result->response->result->extValue->reason);
+		}
+		return $result;
+	}
+
+	function switchepp_write_xml_hook($client, $xml, $action, $extra = NULL)
+	{
+		$response = $client->request($xml);
+		if (empty($extra)) {
+			logModuleCall('SWITCH EPP hook', 'domain update extension(DNSSEC)', $xml, $response);
+			$result = new SimpleXMLElement($response);
+
+			if ($result->response->result->attributes()->code >= 2000) {
+				throw new exception($result->response->result->msg . '. ' . $result->response->result->extValue->reason);
+			}
+			return $result;
+		}
+	}
+
+	function switchepp_logoutepp_hook($client, $params)
+	{
+		$xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+	                        <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+	                            <epp:command xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
+	                                <epp:logout />
+	                                <epp:clTRID>' . $params['registrar_id'] . '</epp:clTRID>
+	                            </epp:command>
+	                        </epp>';
+		$response = $client->request($xml);
+		logModuleCall('SWITCH EPP', 'logout', $xml, $response);
+	}
+
+	function switchepp_generateDigestRandomString_hook($length = 15)
+	{
+		$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+		$charactersLength = strlen($characters);
+		$randomString = '';
+		for ($i = 0; $i < $length; $i++) {
+			$randomString .= $characters[rand(0, $charactersLength - 1)];
+		}
+		return $randomString;
+	}
+
+	if (isset($_POST['updatednsdata']) && isset($_POST['dnscheck']) && !empty($whmcs->get_req_var('id'))) {
+		$params = [];
+		$dnscheck = $whmcs->get_req_var('dnscheck');
+		$domain_zoneid = $whmcs->get_req_var('id');
+		$domaindata = Capsule::table('dns_manager2_zone')->where('id', $domain_zoneid)->first();
+
+		$domainname = $domaindata->name;
+		$domaindetail = Capsule::table('tbldomains')->where('domain', $domainname)->first();
+
+		$settingArr = getSwitchEPP_settinghook($domaindetail->id);
+		$params = array_merge($params, $settingArr);
+
+		$client = switchepp_clientloginepp_hook($params);      #Epp Connection
+		$login = switchepp_loggedinepp_hook($client, $params);
+		/*$digestType = $params['digest_type'];
+		if (empty($digestType))
+			$digestType = 1;
+		if ($digestType == 1) {
+			$string = switchepp_generateDigestRandomString_hook(40);
+			$digest = strtoupper(bin2hex($string));
+			$digest = substr($digest, 0, 40);
+		} elseif ($digestType == 2) {
+			$string = switchepp_generateDigestRandomString_hook(64);
+			$digest = strtoupper(bin2hex($string));
+			$digest = substr($digest, 0, 64);
+		} elseif ($digestType == 3 || $digestType == 4) {
+			$string = switchepp_generateDigestRandomString_hook(96);
+			$digest = strtoupper(bin2hex($string));
+			$digest = substr($digest, 0, 96);
+		}*/
+
+		//$params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
+		//$params['algorithm'] = 13;
+
+		$algorithm = $whmcs->get_req_var('algotype');
+		$digestType = $whmcs->get_req_var('digesttype');
+		$digest = $whmcs->get_req_var('digest');
+		$keytag = $whmcs->get_req_var('keytag');
+
+		if ($dnscheck == 'disableDnssec') {
+			$dnssec = '<extension>
+		                <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+		                    <secDNS:rem>
+						 		<secDNS:all>true</secDNS:all>
+						 	</secDNS:rem>
+		                </secDNS:update> 
+		            </extension>';
+		}
+		if ($dnscheck == 'enableDnssec') {
+			$dnssec = '<extension>
+			                <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+			                    <secDNS:add> 
+			                        <secDNS:dsData> 
+			                            <secDNS:keyTag>' . $keytag . '</secDNS:keyTag> 
+			                            <secDNS:alg>' . $algorithm . '</secDNS:alg> 
+			                            <secDNS:digestType>' . $digestType . '</secDNS:digestType> 
+			                            <secDNS:digest>' . $digest . '</secDNS:digest>
+			                        </secDNS:dsData>
+			                    </secDNS:add>
+			                </secDNS:update> 
+			            </extension>';
+		}
+
+		try {
+
+			$xmlUpdate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+                            <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+                                <command>
+                                    <update>
+                                        <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+                                            <domain:name>' . $domainname . '</domain:name>
+                                        </domain:update>
+                                    </update>
+                                    ' . $dnssec . '
+                                <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+                                </command>
+                           </epp>';
+
+			$update_domain = switchepp_write_xml_hook($client, $xmlUpdate, __FUNCTION__ . ' (Domain update)');
+		} catch (Exception $ex) {
+			$error = $ex->getMessage();
+		}
+
+		switchepp_logoutepp_hook($client, $params);
+	}
+});
+
+function hook_changedns($vars)
+{
+	global $whmcs;
+
+	if ($whmcs->get_req_var('m') == 'DNSManager3' && $whmcs->get_req_var('mg-action') == 'dnssec' && !empty($whmcs->get_req_var('id'))) {
+
+		$domaindata = Capsule::table('dns_manager2_zone')->where('id', $_GET['id'])->first();
+
+		$domaindetail = Capsule::table('tbldomains')->where('domain', $domaindata->name)->first();
+
+		$check = end(explode('.', $domaindata->name));
+
+		if ($domaindetail->registrar == 'switchepp') {
+			return <<<HTML
+<script type="text/javascript">
+	jQuery(document).ready(function () {
+		
+		var checkdns = "";
+		jQuery(".customNav").next('div').find('a').each(function(){
+			if(jQuery(this).data("id") == "enableDNSSecButton"){
+				if(jQuery(this).hasClass('lu-d-none'))
+					checkdns = "disableDnssec";
+			}else if(jQuery(this).data("id") == "disableDNSSecButton"){
+				if(jQuery(this).hasClass('lu-d-none'))
+					checkdns = "enableDnssec";
+			}
+		});
+		dnsmanage(checkdns);
+	});	
+	function dnsmanage(checkdns){
+		var intervalcheck = setInterval(function(){ 
+			if(jQuery(".toast-message").html()){
+				jQuery("body").append("<input type='hidden' id='customdnssec' value='yes'>");
+				cleartimedcheck();
+			}
+		});
+		function cleartimedcheck(){
+			clearInterval(intervalcheck);
+		}
+		var intervalId = setInterval(function(){
+			
+			var tbody = jQuery("#delegationSignerRecordsDataTable table tbody");
+			console.log(tbody.children().length);
+			console.log(jQuery("#customdnssec").val());
+			console.log(checkdns);
+			if (tbody.children().length != 0 && jQuery("#customdnssec").val() == "yes" && checkdns == "enableDnssec") {
+				cleartime();
+				var getkeytagtd = jQuery('#delegationSignerRecordsDataTable table tbody tr').eq(1).find('td').eq(0).text();
+				var getsecondtd = jQuery('#delegationSignerRecordsDataTable table tbody tr').eq(1).find('td').eq(1).text();
+				var getthirdtd = jQuery('#delegationSignerRecordsDataTable table tbody tr').eq(1).find('td').eq(2).text();
+				var digest = jQuery('#delegationSignerRecordsDataTable table tbody tr').eq(1).find('td').eq(3).find('input').val();
+				var algo =  getsecondtd.split(" - ")[0];
+				var digesttype =  getthirdtd.split(" - ")[0];
+			
+				jQuery.ajax({
+					"url": "",
+					"type": "post",
+					"data": "updatednsdata=true&dnscheck="+checkdns+"&algotype="+algo+"&digesttype="+digesttype+"&digest="+digest+"&keytag="+getkeytagtd,
+					"success": function (response) {
+						setTimeout(function(){
+							jQuery(".customNav").next('div').find('a').each(function(){
+							if(jQuery(this).data("id") == "enableDNSSecButton"){
+								jQuery(this).attr('onClick','dnsmanage("enableDnssec")');	
+							}else if(jQuery(this).data("id") == "disableDNSSecButton"){
+								jQuery(this).attr('onClick','dnsmanage("disableDnssec")');	
+							}
+						});
+						}, 3000); 
+					}
+				});
+				
+			}else if(tbody.children().length == 0 && jQuery("#customdnssec").val() == "yes" && checkdns == "disableDnssec"){
+				cleartime();
+				jQuery.ajax({
+				"url": "",
+				"type": "post",
+				"data": "updatednsdata=true&dnscheck="+checkdns,
+				"success": function (response) {
+						setTimeout(function(){
+							jQuery(".customNav").next('div').find('a').each(function(){
+								if(jQuery(this).data("id") == "enableDNSSecButton"){
+									jQuery(this).attr('onClick','dnsmanage("enableDnssec")');	
+								}else if(jQuery(this).data("id") == "disableDNSSecButton"){
+									jQuery(this).attr('onClick','dnsmanage("disableDnssec")');	
+								}
+							});
+						}, 3000); 
+					}
+				});
+			} 
+				
+			}, 3000);
+
+		function cleartime(){
+			clearInterval(intervalId);
+			jQuery("#customdnssec").remove();
+			var checkdns = "";
+			jQuery(".customNav").next('div').find('a').each(function(){
+				if(jQuery(this).data("id") == "enableDNSSecButton"){
+					if(jQuery(this).hasClass('lu-d-none'))
+						checkdns = "disableDnssec";
+				}else if(jQuery(this).data("id") == "disableDNSSecButton"){
+					if(jQuery(this).hasClass('lu-d-none'))
+						checkdns = "enableDnssec";
+				}
+			});
+			dnsmanage(checkdns);
+		}
+	}
+
+</script>
+HTML;
+		}
+	}
+}
+
+add_hook('ClientAreaHeadOutput', 1, 'hook_changedns');

+ 3 - 2
idna_convert.class.php

@@ -1199,8 +1199,9 @@ class owncloud_Encoding {
 
     protected static function utf8_decode($text, $option) {
         if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
-            $o = mb_convert_encoding(
-                    str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text)), 'ISO-8859-1', 'UTF-8');
+            $o = utf8_decode(
+                    str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
+            );
         } else {
             $o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
         }

BIN
logo.png


+ 394 - 189
switchepp.php

@@ -3,20 +3,20 @@
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  *  SWITCH EPP REGISTRAR WHMCS Module By whmcsglobalservices.com
  *  Copyright whmcsglobalservices, All Rights Reserved
- *  
+ *
  *  Release: 21 January, 2015
- *  Version: 3.0.6
- *  WHMCS Version: v6,v7
- *  Update Date: 04 Sep, 2019
- * 
+ *  Version: 3.1.0
+ *  WHMCS Version: v6,v7,V8
+ *  Update Date: 17 April, 2025
+ *
  *  By WHMCSGLOBALSERVICES    https://whmcsglobalservices.com
  *  Contact                   info@whmcsglobalservices.com
- *  
+ *
  *  This module is made under license issued by whmcsglobalservices.com
- *  and used under all terms and conditions of license.    Ownership of 
+ *  and used under all terms and conditions of license.    Ownership of
  *  module can not be changed.     Title and copy of    module  is  not
  *  available to any other person.
- *  
+ *
  *  @owner <whmcsglobalservices.com>
  *  @author <WHMCSGLOBALSERVICES>
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -33,11 +33,12 @@ if (!class_exists('Net_EPP_Protocol')) {
         require_once __DIR__ . "/Net/EPP/Client.php";
 }
 
-require_once(__DIR__ . '/idna_convert.class.php');
+// require_once(__DIR__ . '/idna_convert.class.php');
 
 #*********************Registrar config options***************************#
 
-function switchepp_getConfigArray() {
+function switchepp_getConfigArray()
+{
     $configarray = array(
         "FriendlyName" => array(
             "Type" => "System",
@@ -47,21 +48,54 @@ function switchepp_getConfigArray() {
             "FriendlyName" => "Registrar Id",
             "Type" => "text",
             "Size" => "50",
+            'Description' => 'Enter production SwitchEPP User ID (Client Identifier clIDs)',
         ),
         "registrar_password" => array(
             "FriendlyName" => "Password",
             "Type" => "password",
             "Size" => "50",
+            'Description' => 'Enter production SwitchEPP EPP Login password',
         ),
         "eppurl" => array(
             "FriendlyName" => "EPP URL",
             "Type" => "text",
             "Size" => "50",
+            'Description' => 'Enter production SwitchEPP URL epp.nic.ch',
         ),
         "eppport" => array(
             "FriendlyName" => "Port Number",
             "Type" => "text",
             "Size" => "50",
+            'Description' => 'Enter  SwitchEPP port 700',
+        ),
+        'testMode' => [
+            'FriendlyName' => 'Test Mode',
+            'Type' => 'yesno',
+            'Description' => 'Tick to enable the test mode (OTE)',
+        ],
+        "ote_registrar_id" => array(
+            "FriendlyName" => "OTE Registrar Id",
+            "Type" => "text",
+            "Size" => "50",
+            'Description' => 'Enter OTE/Test SwitchEPP User ID (Client Identifier clIDs)',
+        ),
+        "ote_registrar_password" => array(
+            "FriendlyName" => "OTE Password",
+            "Type" => "password",
+            "Size" => "50",
+            'Description' => 'Enter OTE/Test SwitchEPP EPP Login password',
+        ),
+        "ote_eppurl" => array(
+            "FriendlyName" => "OTE EPP URL",
+            "Type" => "text",
+            "Size" => "50",
+            'Description' => 'Enter OTE SwitchEPP URL epp-test.switch.ch',
+        ),
+        "ote_eppport" => array(
+            "FriendlyName" => "OTE Port Number",
+            "Type" => "text",
+            "Size" => "50",
+            'Description' => 'Enter OTE port 7001',
         ),
         "licensenum" => array(
             "FriendlyName" => "License  Key",
@@ -96,12 +130,14 @@ function switchepp_getConfigArray() {
             "Description" => "Tick if svcExtension supported."
         ),
         "switchepp_version" => array(
+            'Type' => 'system',
             "FriendlyName" => "Version",
-            "Description" => "3.0.6",
+            "Description" => "3.1.0",
         ),
         "switchepp_update" => array(
+            'Type' => 'system',
             "FriendlyName" => "Updated Date",
-            "Description" => "04 Sep, 2019",
+            "Description" => "17 April, 2025",
         )
     );
     return $configarray;
@@ -109,9 +145,13 @@ function switchepp_getConfigArray() {
 
 #*******************Get Nameserver***********************#
 
-function switchepp_GetNameservers($params) {
+function switchepp_GetNameservers($params)
+{
     try {
+        // $check_license = switchepp_license_status($params);     #Check License
+
         $client = switchepp_clientloginepp($params);      #Epp Connection
+       
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
         $xml = switchepp_domain_info($params);
@@ -135,8 +175,10 @@ function switchepp_GetNameservers($params) {
 
 #*********************Save mameserver**************************#
 
-function switchepp_SaveNameservers($params) {
+function switchepp_SaveNameservers($params)
+{
     try {
+        // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
@@ -144,6 +186,20 @@ function switchepp_SaveNameservers($params) {
         $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
 
         $ns = $info_domain->response->resData->children("domain", true)->infData->ns->hostObj;
+
+        $newarray = [$params["ns1"], $params["ns2"], $params["ns3"], $params["ns4"], $params["ns5"]];
+
+        $exist = false;
+
+        foreach ($ns as $nn) {
+            if (in_array($nn, $newarray)) {
+                $exist = true;
+            } else {
+                $exist = false;
+                break;
+            }
+        }
+
         $rem_hosts = '';
         foreach ($ns as $nn) {
             $rem_hosts .= ' <domain:hostObj>' . $nn . '</domain:hostObj> ';
@@ -165,9 +221,7 @@ function switchepp_SaveNameservers($params) {
             $add_hosts .= ' <domain:hostObj>' . $nameserver5 . '</domain:hostObj> ';
         }
 
-        $IDN = new idna_convert();
-        $input = switcheppGetDomainName($params['domainid']);
-        $domainname = $IDN->encode($input);
+        $domainname = $params['domain_punycode'];
         if ($params['dnssec'] == "on") {
             $digestType = $params['digest_type'];
             if (empty($digestType))
@@ -188,15 +242,15 @@ function switchepp_SaveNameservers($params) {
             $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
             $dnssec = '<extension>
                                         <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
-                                            <secDNS:add> 
-                                                <secDNS:dsData> 
-                                                    <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag> 
-                                                    <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg> 
-                                                    <secDNS:digestType>' . $digestType . '</secDNS:digestType> 
+                                            <secDNS:add>
+                                                <secDNS:dsData>
+                                                    <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+                                                    <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
+                                                    <secDNS:digestType>' . $digestType . '</secDNS:digestType>
                                                     <secDNS:digest>' . $digest . '</secDNS:digest>
                                                 </secDNS:dsData>
                                             </secDNS:add>
-                                        </secDNS:update> 
+                                        </secDNS:update>
                                     </extension>';
         }
         $xmlUpdate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -209,7 +263,7 @@ function switchepp_SaveNameservers($params) {
                                                 <domain:ns>
                                                 ' . $add_hosts . '
                                                 </domain:ns>
-                                            </domain:add>    
+                                            </domain:add>
                                             <domain:rem>
                                                 <domain:ns>
                                                 ' . $rem_hosts . '
@@ -221,7 +275,10 @@ function switchepp_SaveNameservers($params) {
                                 <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
                                 </command>
                            </epp>';
-        $update_domain = switchepp_write_xml($client, $xmlUpdate, __FUNCTION__);
+        if ($exist)
+            return "success";
+        else
+            $update_domain = switchepp_write_xml($client, $xmlUpdate, __FUNCTION__);
     } catch (Exception $ex) {
         $values['error'] = $ex->getMessage();
     }
@@ -232,10 +289,14 @@ function switchepp_SaveNameservers($params) {
 
 #*************************Domain Register****************************#
 
-function switchepp_RegisterDomain($params) {
+function switchepp_RegisterDomain($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
+
+      
+      
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
         $xmlcheck = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -290,7 +351,7 @@ function switchepp_RegisterDomain($params) {
         } else {
             $reg_contact_id = $regContactId;
         }
-        #*************tech create*****************#     
+        #*************tech create*****************#
         $techContactId = strtoupper(switchepp_generateContactID(6) . $params['domainid']);
         $contactCheckXml = switchepp_checkContact($techContactId);
         $contact_check = switchepp_write_xml($client, $contactCheckXml, __FUNCTION__ . ' (check contact)');
@@ -327,7 +388,7 @@ function switchepp_RegisterDomain($params) {
         } else {
             $tech_contact_id = $techContactId;
         }
-        #*******************NameServer*************#                
+        #*******************NameServer*************#
         if ($params['ns1']) {
             $ns .= '<domain:hostObj>' . $params['ns1'] . '</domain:hostObj>';
         }
@@ -345,10 +406,7 @@ function switchepp_RegisterDomain($params) {
                                     ' . $ns . '
                              </domain:ns>';
         }
-
-        $IDN = new idna_convert();
-        $input = switcheppGetDomainName($params['domainid']);
-        $domainname = $IDN->encode($input);
+        $domainname = $params['domain_punycode'];
 
         if ($params['dnssec'] == "on") {
             $digestType = $params['digest_type'];
@@ -370,10 +428,10 @@ function switchepp_RegisterDomain($params) {
             $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
             $dnssec = '<extension>
                                         <secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
-                                             <secDNS:dsData> 
-                                                        <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag> 
-                                                        <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg> 
-                                                        <secDNS:digestType>' . $digestType . '</secDNS:digestType> 
+                                             <secDNS:dsData>
+                                                        <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+                                                        <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
+                                                        <secDNS:digestType>' . $digestType . '</secDNS:digestType>
                                                         <secDNS:digest>' . $digest . '</secDNS:digest>
                                               </secDNS:dsData>
                                         </secDNS:create>
@@ -408,30 +466,10 @@ function switchepp_RegisterDomain($params) {
     return $values;
 }
 
-#**********************************Renew Domain*******************************#
-/*
-function switchepp_RenewDomain($params) {
-    $userIdentifier = $params['APIUsername'];
-    $apiKey = $params['APIKey'];
-    $testMode = $params['TestMode'];
-    $accountMode = $params['AccountMode'];
-    $emailPreference = $params['EmailPreference'];
-
-    // registration parameters
-    $sld = $params['sld'];
-    $tld = $params['tld'];
-    $registrationPeriod = $params['regperiod'];
-
-    // domain addon purchase status
-    $enableDnsManagement = (bool) $params['dnsmanagement'];
-    $enableEmailForwarding = (bool) $params['emailforwarding'];
-    $enableIdProtection = (bool) $params['idprotection'];
-
-}*/
-
 #**********************************Get Contact Detail*******************************#
 
-function switchepp_GetContactDetails($params) {
+function switchepp_GetContactDetails($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
@@ -456,13 +494,13 @@ function switchepp_GetContactDetails($params) {
         $info_contact = switchepp_write_xml($client, $xml2, __FUNCTION__ . '(registrant contact info)');
         $contactdataArr = $info_contact->response->resData->children("contact", true)->infData;
         $results["Registrant"]["Contact Name"] = $contactdataArr->postalInfo->name;
-        $results["Registrant"]["Organisation"] = $contactdataArr->postalInfo->org;
+        $results["Registrant"]["Company Name"] = $contactdataArr->postalInfo->org;
         $results["Registrant"]["Address line 1"] = $contactdataArr->postalInfo->addr->street[0];
-        $results["Registrant"]["Address line 2"] = $contactdataArr->postalInfo->addr->street[1];
-        $results["Registrant"]["TownCity"] = $contactdataArr->postalInfo->addr->city;
-        $results["Registrant"]["Zip code"] = $contactdataArr->postalInfo->addr->pc;
-        $results["Registrant"]["Country Code"] = $contactdataArr->postalInfo->addr->cc;
-        $results["Registrant"]["Phone"] = $contactdataArr->voice;
+        $results["Registrant"]["Address 2"] = $contactdataArr->postalInfo->addr->street[1];
+        $results["Registrant"]["City"] = $contactdataArr->postalInfo->addr->city;
+        $results["Registrant"]["Postcode"] = $contactdataArr->postalInfo->addr->pc;
+        $results["Registrant"]["Country"] = $contactdataArr->postalInfo->addr->cc;
+        $results["Registrant"]["Phone Number"] = $contactdataArr->voice;
         $results["Registrant"]["Email"] = $contactdataArr->email;
         if (!empty($Tech_id)) {
             #get tech detail
@@ -481,13 +519,13 @@ function switchepp_GetContactDetails($params) {
             #*************************Show tech information in field****************************#
             $techdataArr = $tect_info_contact->response->resData->children("contact", true)->infData;
             $results["Technical"]["Contact Name"] = $techdataArr->postalInfo->name;
-            $results["Technical"]["Organisation"] = $techdataArr->postalInfo->org;
+            $results["Technical"]["Company Name"] = $techdataArr->postalInfo->org;
             $results["Technical"]["Address line 1"] = $techdataArr->postalInfo->addr->street[0];
-            $results["Technical"]["Address line 2"] = $techdataArr->postalInfo->addr->street[1];
-            $results["Technical"]["TownCity"] = $techdataArr->postalInfo->addr->city;
-            $results["Technical"]["Zip code"] = $techdataArr->postalInfo->addr->pc;
-            $results["Technical"]["Country Code"] = $techdataArr->postalInfo->addr->cc;
-            $results["Technical"]["Phone"] = $techdataArr->voice;
+            $results["Technical"]["Address 2"] = $techdataArr->postalInfo->addr->street[1];
+            $results["Technical"]["City"] = $techdataArr->postalInfo->addr->city;
+            $results["Technical"]["Postcode"] = $techdataArr->postalInfo->addr->pc;
+            $results["Technical"]["Country"] = $techdataArr->postalInfo->addr->cc;
+            $results["Technical"]["Phone Number"] = $techdataArr->voice;
             $results["Technical"]["Email"] = $techdataArr->email;
         }
     } catch (Exception $ex) {
@@ -500,7 +538,8 @@ function switchepp_GetContactDetails($params) {
 
 #******************Save Contact/Tech Detail*********************#
 
-function switchepp_SaveContactDetails($params) {
+function switchepp_SaveContactDetails($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
@@ -509,7 +548,7 @@ function switchepp_SaveContactDetails($params) {
         $xml = switchepp_domain_info($params);
         $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
         $registrant_id = $info_domain->response->resData->children("domain", true)->infData->registrant;   #registrant id
-        $Tech_id = $info_domain->response->resData->children("domain", true)->infData->contact;    #Tech id        
+        $Tech_id = $info_domain->response->resData->children("domain", true)->infData->contact;    #Tech id
 
         $contactArr = ['Registrant' => $registrant_id, 'Technical' => $Tech_id];
         $updateContactArr = $getContactArr = [];
@@ -518,23 +557,23 @@ function switchepp_SaveContactDetails($params) {
             if (!empty($contactArr[$type])) {
                 $contact = [];
                 $contact = $params['contactdetails'][$type];
-                $updateName = ($contact['Full Name']) ? $contact['Full Name'] : $contact['Contact Name'];
-                $updateOrg = ($contact['Organisation Name']) ? $contact['Organisation Name'] : $contact['Organisation'];
-                $updateAdd1 = ($contact['Address 1']) ? $contact['Address 1'] : $contact['Address line 1'];
-                $updateAdd2 = ($contact['Address 2']) ? $contact['Address 2'] : $contact['Address line 2'];
-                $updateCity = ($contact['City']) ? $contact['City'] : $contact['TownCity'];
-                $updateZip = ($contact['Postcode']) ? $contact['Postcode'] : $contact['Zip code'];
-                $updateCc = ($contact['Country']) ? $contact['Country'] : $contact['Country Code'];
+                $updateName = ($contact['Full Name']) ? $contact['Full Name'] : $contact['Full Name'];
+                $updateOrg = ($contact['Company Name']) ? $contact['Company Name'] : $contact['Company Name'];
+                $updateAdd1 = ($contact['Address 1']) ? $contact['Address 1'] : $contact['Address 1'];
+                $updateAdd2 = ($contact['Address 2']) ? $contact['Address 2'] : $contact['Address 2'];
+                $updateCity = ($contact['City']) ? $contact['City'] : $contact['City'];
+                $updateZip = ($contact['Postcode']) ? $contact['Postcode'] : $contact['Postcode'];
+                $updateCc = ($contact['Country']) ? $contact['Country'] : $contact['Country'];
                 $updateEmail = $contact['Email'];
-                $updatePhn = ($contact['Phone Number']) ? $contact['Phone Number'] : $contact['Phone'];
-                $updateContactArr['Contact Name'] = htmlspecialchars(trim($updateName));
-                $updateContactArr['Organisation'] = htmlspecialchars(trim($updateOrg));
-                $updateContactArr['Address line 1'] = htmlspecialchars(trim($updateAdd1));
-                $updateContactArr['Address line 2'] = htmlspecialchars(trim($updateAdd2));
-                $updateContactArr['TownCity'] = htmlspecialchars(trim($updateCity));
-                $updateContactArr['Zip code'] = htmlspecialchars(trim($updateZip));
-                $updateContactArr['Country Code'] = htmlspecialchars(trim($updateCc));
-                $updateContactArr['Phone'] = htmlspecialchars(trim($updatePhn));
+                $updatePhn = ($contact['Phone Number']) ? $contact['Phone Number'] : $contact['Phone Number'];
+                $updateContactArr['Full Name'] = htmlspecialchars(trim($updateName));
+                $updateContactArr['Company Name'] = htmlspecialchars(trim($updateOrg));
+                $updateContactArr['Address 1'] = htmlspecialchars(trim($updateAdd1));
+                $updateContactArr['Address 2'] = htmlspecialchars(trim($updateAdd2));
+                $updateContactArr['City'] = htmlspecialchars(trim($updateCity));
+                $updateContactArr['Postcode'] = htmlspecialchars(trim($updateZip));
+                $updateContactArr['Country'] = htmlspecialchars(trim($updateCc));
+                $updateContactArr['Phone Number'] = htmlspecialchars(trim($updatePhn));
                 $updateContactArr['Email'] = htmlspecialchars(trim($updateEmail));
 
                 $contactInfo = switchepp_contact_info($client, $contactId, 'Get ' . $type);
@@ -548,17 +587,17 @@ function switchepp_SaveContactDetails($params) {
                     $getCity = htmlspecialchars($contactFromSwitch->addr->city);
                     $getZip = htmlspecialchars($contactFromSwitch->addr->pc);
                     $getCc = htmlspecialchars($contactFromSwitch->addr->cc);
-                    $getContactArr['Contact Name'] = trim($getName);
-                    $getContactArr['Organisation'] = trim($getOrg);
-                    $getContactArr['Address line 1'] = trim($getAdd1);
-                    $getContactArr['Address line 2'] = trim($getAdd2);
-                    $getContactArr['TownCity'] = trim($getCity);
-                    $getContactArr['Zip code'] = trim($getZip);
-                    $getContactArr['Country Code'] = trim($getCc);
+                    $getContactArr['Full Name'] = trim($getName);
+                    $getContactArr['Company Name'] = trim($getOrg);
+                    $getContactArr['Address 1'] = trim($getAdd1);
+                    $getContactArr['Address 2'] = trim($getAdd2);
+                    $getContactArr['City'] = trim($getCity);
+                    $getContactArr['Postcode'] = trim($getZip);
+                    $getContactArr['Country'] = trim($getCc);
                 }
                 $getEmail = htmlspecialchars($contactdataArr->email);
                 $getPhn = htmlspecialchars($contactdataArr->voice);
-                $getContactArr['Phone'] = trim($getPhn);
+                $getContactArr['Phone Number'] = trim($getPhn);
                 $getContactArr['Email'] = trim($getEmail);
                 if ($getContactArr == $updateContactArr)
                     continue;
@@ -571,18 +610,18 @@ function switchepp_SaveContactDetails($params) {
                                         <contact:id>' . $contactId . '</contact:id>
                                         <contact:chg>
                                             <contact:postalInfo type="loc">
-                                                <contact:name>' . $updateContactArr['Contact Name'] . '</contact:name>
-                                                <contact:org>' . $updateContactArr['Organisation'] . '</contact:org>
+                                                <contact:name>' . $updateContactArr['Full Name'] . '</contact:name>
+                                                <contact:org>' . $updateContactArr['Company Name'] . '</contact:org>
                                                 <contact:addr>
-                                                    <contact:street>' . $updateContactArr['Address line 1'] . '</contact:street>
-                                                    <contact:street>' . $updateContactArr['Address line 2'] . '</contact:street>
-                                                    <contact:city>' . $updateContactArr['TownCity'] . '</contact:city>
-                                                    <contact:sp>' . $updateContactArr['TownCity'] . '</contact:sp>
-                                                    <contact:pc>' . $updateContactArr['Zip code'] . '</contact:pc>
-                                                    <contact:cc>' . $updateContactArr['Country Code'] . '</contact:cc>
+                                                    <contact:street>' . $updateContactArr['Address 1'] . '</contact:street>
+                                                    <contact:street>' . $updateContactArr['Address 2'] . '</contact:street>
+                                                    <contact:city>' . $updateContactArr['City'] . '</contact:city>
+                                                    <contact:sp>' . $updateContactArr['City'] . '</contact:sp>
+                                                    <contact:pc>' . $updateContactArr['Postcode'] . '</contact:pc>
+                                                    <contact:cc>' . $updateContactArr['Country'] . '</contact:cc>
                                                 </contact:addr>
                                             </contact:postalInfo>
-                                            <contact:voice>' . $updateContactArr['Phone'] . '</contact:voice>
+                                            <contact:voice>' . $updateContactArr['Phone Number'] . '</contact:voice>
                                             <contact:fax/>
                                             <contact:email>' . $updateContactArr['Email'] . '</contact:email>
                                             <contact:authInfo>
@@ -607,7 +646,8 @@ function switchepp_SaveContactDetails($params) {
 
 #************************Domain Delete*************************#
 
-function switchepp_RequestDelete($params) {
+function switchepp_RequestDelete($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
@@ -616,9 +656,7 @@ function switchepp_RequestDelete($params) {
         $xml = switchepp_domain_info($params);
         $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
 
-        $IDN = new idna_convert();
-        $input = switcheppGetDomainName($params['domainid']);
-        $domainname = $IDN->encode($input);
+        $domainname = $params['domain_punycode'];
 
         $deletxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                         <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
@@ -642,17 +680,15 @@ function switchepp_RequestDelete($params) {
 
 #******************************Domain transfer********************************#
 
-function switchepp_TransferDomain($params) {
+function switchepp_TransferDomain($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
         $xml = switchepp_domain_info($params);
-
-        $IDN = new idna_convert();
-        $input = switcheppGetDomainName($params['domainid']);
-        $domainname = $IDN->encode($input);
+        $domainname = $params['domain_punycode'];
         #domain transfer
         $xmlTransfer = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
@@ -704,7 +740,7 @@ function switchepp_TransferDomain($params) {
             $reg_contact_id = $create_reg_contact->response->resData->children('contact', true)->creData->id;
         } else
             $reg_contact_id = $regContactId;
-        #*************tech create*****************#            
+        #*************tech create*****************#
         $techContactId = strtoupper(switchepp_generateContactID(6) . $params['domainid']);
         $contactCheckXml = switchepp_checkContact($techContactId);
         $contact_check = switchepp_write_xml($client, $contactCheckXml, __FUNCTION__ . ' (check contact)');
@@ -760,15 +796,15 @@ function switchepp_TransferDomain($params) {
             $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
             $dnssec = '<extension>
                                         <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
-                                            <secDNS:add> 
-                                                <secDNS:dsData> 
-                                                    <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag> 
-                                                    <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg> 
-                                                    <secDNS:digestType>' . $digestType . '</secDNS:digestType> 
+                                            <secDNS:add>
+                                                <secDNS:dsData>
+                                                    <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+                                                    <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
+                                                    <secDNS:digestType>' . $digestType . '</secDNS:digestType>
                                                         <secDNS:digest>' . $digest . '</secDNS:digest>
                                                 </secDNS:dsData>
                                             </secDNS:add>
-                                        </secDNS:update> 
+                                        </secDNS:update>
                                     </extension>';
         }
         $xmlUpdate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -800,7 +836,8 @@ function switchepp_TransferDomain($params) {
 
 #***************************Get Epp Code******************************#
 
-function switchepp_GetEPPCode($params) {
+function switchepp_GetEPPCode($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
@@ -821,16 +858,29 @@ function switchepp_GetEPPCode($params) {
 
 #***************************Custom button function******************************#
 
-function switchepp_AdminCustomButtonArray() {
+function switchepp_AdminCustomButtonArray()
+{
     $buttonarray = array(
         "Restore Domain" => "Restore",
+        "Disable DNSSEC" => "Disable_DNSSEC",
+        "Enable DNSSEC" => "Enable_DNSSEC",
     );
     return $buttonarray;
 }
 
+//registrarmodule_ClientAreaCustomButtonArray
+function switchepp_ClientAreaCustomButtonArray()
+{
+    return array(
+        "Enable DNSSEC" => "Enable_DNSSEC",
+        "Disable DNSSEC" => "Disable_DNSSEC",
+    );
+}
+
 #***************************Restore Domain******************************#
 
-function switchepp_Restore($params) {
+function switchepp_Restore($params)
+{
     try {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
@@ -846,9 +896,54 @@ function switchepp_Restore($params) {
     return $values;
 }
 
+#***************************Disable DNSSEC******************************#
+
+function switchepp_Disable_DNSSEC($params)
+{
+    try {
+        // $check_license = switchepp_license_status($params);     #Check License
+        $client = switchepp_clientloginepp($params);      #Epp Connection
+        $login = switchepp_loggedinepp($client, $params);      #Epp Client login
+        #Domain Restore XML
+        $xml = switcheppDisableDnssec($params);
+        $domainRestore = switchepp_write_xml($client, $xml, __FUNCTION__);
+        $values['success'] = 'success';
+    } catch (Exception $ex) {
+        $values['error'] = $ex->getMessage();
+        return $values;
+
+    }
+    if (!empty($client))
+        switchepp_logoutepp($client, $params);
+    return $values;
+}
+
+#***************************Enable DNSSEC******************************#
+
+function switchepp_Enable_DNSSEC($params)
+{
+    try {
+        // $check_license = switchepp_license_status($params);     #Check License
+        //if ($check_license['status'] == "Active") {
+            $client = switchepp_clientloginepp($params);      #Epp Connection
+            $login = switchepp_loggedinepp($client, $params);      #Epp Client login
+        //}
+
+        #Domain Restore XML
+        $xml = switcheppEnableDnssec($params);
+        $domainRestore = switchepp_write_xml($client, $xml, __FUNCTION__);
+        $values['success'] = 'success';
+    } catch (Exception $ex) {
+        $values['error'] = $ex->getMessage();
+    }
+    if (!empty($client))
+        switchepp_logoutepp($client, $params);
+    return $values;
+}
 #***************************Admin Fields******************************#
 
-function switchepp_AdminDomainsTabFields($params) {
+function switchepp_AdminDomainsTabFields($params)
+{
     try {
 
         $settingArr = getSwitchEPP_setting($params['domainid']);  #get registrar config settings
@@ -857,7 +952,9 @@ function switchepp_AdminDomainsTabFields($params) {
         // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
+        $params['domain_punycode'] = $params['sld_punycode'] . '.' . $params['tld'];
         #get domain info
+
         $xml = switchepp_domain_info($params);
         $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
         $expDate = $info_domain->response->resData->children("domain", true)->infData->exDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->exDate)) : '';
@@ -865,6 +962,9 @@ function switchepp_AdminDomainsTabFields($params) {
         $upDate = $info_domain->response->resData->children("domain", true)->infData->upDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->upDate)) : '';
         $transferDate = $info_domain->response->resData->children("domain", true)->infData->trDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->trDate)) : '';
         $createDate = $info_domain->response->resData->children("domain", true)->infData->crDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->crDate)) : '';
+
+        $DNSSecStatus = $info_domain->response->extension->children("secDNS", true)->infData->dsData->keyTag ? "Yes" : "No";
+
         $html = '';
         $html .= '<table width="100%" style="margin-bottom:0;" class="datatable">';
         $html .= '<tbody>';
@@ -893,6 +993,10 @@ function switchepp_AdminDomainsTabFields($params) {
         $html .= '<td>Last Transfer</td>';
         $html .= '<td>' . $transferDate . '</td>';
         $html .= '</tr>';
+        $html .= '<tr align="left">';
+        $html .= '<td>DNSSec Status</td>';
+        $html .= '<td>' . $DNSSecStatus . '</td>';
+        $html .= '</tr>';
         $html .= '</tbody>';
         $html .= '</table>';
 
@@ -907,7 +1011,8 @@ function switchepp_AdminDomainsTabFields($params) {
 
 #*******************Module Syncronize********************#
 
-function switchepp_Sync($params) {
+function switchepp_Sync($params)
+{
 
     try {
         $client = switchepp_clientloginepp($params);      #Epp Connection
@@ -925,16 +1030,14 @@ function switchepp_Sync($params) {
         }
         Capsule::table('tbldomains')->where('id', $params['domainid'])->update(['expirydate' => $expDate]);
         $domain = Capsule::table('tbldomains')
-                ->where('id', '=', $params['domainid'])
-                ->where('donotrenew', '=', '1')
-                ->where('registrar', '=', 'switchepp')
-                ->whereRaw('`expirydate` >= CURRENT_DATE() AND `expirydate` < ADDDATE(CURRENT_DATE(), INTERVAL 1 DAY)')
-                ->first();
+            ->where('id', '=', $params['domainid'])
+            ->where('donotrenew', '=', '1')
+            ->where('registrar', '=', 'switchepp')
+            ->whereRaw('`expirydate` >= CURRENT_DATE() AND `expirydate` < ADDDATE(CURRENT_DATE(), INTERVAL 1 DAY)')
+            ->first();
 
         if (isset($domain->expirydate)) {
-            $IDN = new idna_convert();
-            $input = switcheppGetDomainName($params['domainid']);
-            $domainname = $IDN->encode($input);
+            $domainname = $params['domain_punycode'];
 
             $deletxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                         <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
@@ -967,7 +1070,8 @@ function switchepp_Sync($params) {
 
 #*******************Transfer Syncronize********************#
 
-function switchepp_TransferSync($params) {
+function switchepp_TransferSync($params)
+{
     try {
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
@@ -995,10 +1099,12 @@ function switchepp_TransferSync($params) {
     return $values;
 }
 
-#***********************Register Nameserver**************************#  
+#***********************Register Nameserver**************************#
 
-function switchepp_RegisterNameserver($params) {
+function switchepp_RegisterNameserver($params)
+{
     try {
+        // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
@@ -1026,9 +1132,10 @@ function switchepp_RegisterNameserver($params) {
 
 #**************************Update Nameserver************************#
 
-function switchepp_ModifyNameserver($params) {
+function switchepp_ModifyNameserver($params)
+{
     try {
-        //$check_license = switchepp_license_status($params);     #Check License
+        // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
@@ -1040,10 +1147,10 @@ function switchepp_ModifyNameserver($params) {
                                             <host:update xmlns:host="urn:ietf:params:xml:ns:host-1.0">
                                                 <host:name>' . $params['nameserver'] . '</host:name>
                                                 <host:add>
-                                                    <host:addr ip="v4">' . $params['currentipaddress'] . '</host:addr>
+                                                    <host:addr ip="v4">' . $params['newipaddress'] . '</host:addr>
                                                 </host:add>
                                                 <host:rem>
-                                                    <host:addr ip="v6">' . $params['newipaddress'] . '</host:addr>
+                                                    <host:addr ip="v4">' . $params['currentipaddress'] . '</host:addr>
                                                 </host:rem>
                                             </host:update>
                                         </update>
@@ -1061,8 +1168,10 @@ function switchepp_ModifyNameserver($params) {
 
 #**********************Delete Nameserver****************************#
 
-function switchepp_DeleteNameserver($params) {
+function switchepp_DeleteNameserver($params)
+{
     try {
+        // $check_license = switchepp_license_status($params);     #Check License
         $client = switchepp_clientloginepp($params);      #Epp Connection
         $login = switchepp_loggedinepp($client, $params);      #Epp Client login
         #get domain info
@@ -1090,21 +1199,36 @@ function switchepp_DeleteNameserver($params) {
 
 #*********************Create Epp Connection**************************#
 
-function switchepp_clientloginepp($params) {
+function switchepp_clientloginepp($params)
+{
     try {
+
         $certFile = __DIR__ . '/cert/cert.pem';
+
         $client = new Net_EPP_Client();
         $use_ssl = true;
+        $eppurl = $params['eppurl'];
+        $port = $params['eppport'];
+
+        if ($params['testMode'] == "on") {
+            $eppurl = trim($params['ote_eppurl']);
+            $port = $params['ote_eppport'];
+        }
+
+
+        
         if (file_exists($certFile)) {
+           
             $context = stream_context_create();
             stream_context_set_option($context, 'ssl', 'verify_peer', false);
             stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
             stream_context_set_option($context, 'ssl', 'local_cert', $certFile);
             stream_context_set_option($context, 'ssl', 'passphrase', $params['passphrase']);
-            $client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
+            $client->connect($eppurl, $port, 300, $use_ssl, $context) or die("Not connected with epp server");
+
         } else {
             $context = false;
-            $client->connect($params['eppurl'], $params['eppport'], 300, $use_ssl, $context) or die("Not connected with epp server");
+            $client->connect($eppurl, $port, 300, $use_ssl, $context) or die("Not connected with epp server");
         }
     } catch (Exception $e) {
         $port = $params['eppport'];
@@ -1115,23 +1239,13 @@ function switchepp_clientloginepp($params) {
 
 #*********************Epp client login**************************#
 
-function switchepp_loggedinepp($client, $params) {
-#    error_log("switchepp_loggedinepp " . $client . " | " . $params);
-    
-    if ($params['svcExtension'] == "on") {
-        $dnssec = '<svcExtension>
-                        <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
-                        <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
-                        <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
-                        <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
-                    </svcExtension>';
-    } else {
-	$dnssec = '<svcExtension>
-                        <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
-                        <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
-                        <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
-                    </svcExtension>';
-    }
+function switchepp_loggedinepp($client, $params)
+{
+	if($params['testMode'] == "on"){
+		$params['registrar_id'] = $params['ote_registrar_id'];
+		$params['registrar_password'] = $params['ote_registrar_password'];
+	}
+
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                     <command>
@@ -1146,14 +1260,18 @@ function switchepp_loggedinepp($client, $params) {
                                 <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
                                 <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
                                 <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
-                                ' . $dnssec . '
+								<svcExtension>
+								 <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
+								 <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
+								 <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
+                                 <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
+                                 <extURI>urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0</extURI>
+								</svcExtension>
                             </svcs>
                         </login>
                     <clTRID>' . rand(9999999, 100000) . '</clTRID>
                     </command>
                 </epp>';
-
-    error_log("EPP LOGIN: " . $xml);
     $response = $client->request($xml);
     logModuleCall('SWITCH EPP', 'login', $xml, $response);
     $result = new SimpleXMLElement($response);
@@ -1164,7 +1282,11 @@ function switchepp_loggedinepp($client, $params) {
     return $result;
 }
 
-function switchepp_logoutepp($client, $params) {
+function switchepp_logoutepp($client, $params)
+{
+	if($params['testMode'] == "on"){
+		$params['registrar_id'] = $params['ote_registrar_id'];
+	}
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                         <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                             <epp:command xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
@@ -1178,7 +1300,8 @@ function switchepp_logoutepp($client, $params) {
 
 #******************** Get Contact info*****************#
 
-function switchepp_contact_info($client, $contactId, $contactType) {
+function switchepp_contact_info($client, $contactId, $contactType)
+{
     #get contact detail
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                             <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
@@ -1198,10 +1321,9 @@ function switchepp_contact_info($client, $contactId, $contactType) {
 
 #***********************Get domain info*************************#
 
-function switchepp_domain_info($params) {
-    $IDN = new idna_convert();
-    $input = switcheppGetDomainName($params['domainid']);
-    $domainname = $IDN->encode($input);
+function switchepp_domain_info($params)
+{
+    $domainname = $params['domain_punycode'];
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                     <command>
@@ -1216,10 +1338,9 @@ function switchepp_domain_info($params) {
     return $xml;
 }
 
-function switchepp_domain_restore($params) {
-    $IDN = new idna_convert();
-    $input = switcheppGetDomainName($params['domainid']);
-    $domainname = $IDN->encode($input);
+function switchepp_domain_restore($params)
+{
+    $domainname = $params['domain_punycode'];
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                     <command>
@@ -1239,10 +1360,82 @@ function switchepp_domain_restore($params) {
     return $xml;
 }
 
-function switchepp_update_domain_auth($params, $domainPw) {
-    $IDN = new idna_convert();
-    $input = switcheppGetDomainName($params['domainid']);
-    $domainname = $IDN->encode($input);
+function switcheppDisableDnssec($params)
+{
+    $domainname = $params['domain_punycode'];
+    ;
+    $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+                <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+                    <command>
+                        <update>
+                            <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+                                <domain:name>' . $domainname . '</domain:name>
+                            </domain:update>
+                        </update>
+                        <extension>
+                            <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+                                <secDNS:rem>
+                                    <secDNS:all>true</secDNS:all>
+                                </secDNS:rem>
+                            </secDNS:update>
+                        </extension>
+                        <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+                    </command>
+                </epp>';
+    return $xml;
+}
+
+function switcheppEnableDnssec($params)
+{
+    $domainname = $params['domain_punycode'];
+
+    $digestType = $params['digest_type'];
+    if (empty($digestType))
+        $digestType = 1;
+    if ($digestType == 1) {
+        $string = switchepp_generateDigestRandomString(40);
+        $digest = strtoupper(bin2hex($string));
+        $digest = substr($digest, 0, 40);
+    } elseif ($digestType == 2) {
+        $string = switchepp_generateDigestRandomString(64);
+        $digest = strtoupper(bin2hex($string));
+        $digest = substr($digest, 0, 64);
+    } elseif ($digestType == 3 || $digestType == 4) {
+        $string = switchepp_generateDigestRandomString(96);
+        $digest = strtoupper(bin2hex($string));
+        $digest = substr($digest, 0, 96);
+    }
+    $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
+
+    $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+			<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+				<command>
+					<update>
+						<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
+							<domain:name>' . $domainname . '</domain:name>
+						</domain:update>
+					</update>
+					<extension>
+						<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
+							<secDNS:add>
+								<secDNS:dsData>
+									<secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
+									<secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
+									<secDNS:digestType>' . $digestType . '</secDNS:digestType>
+									<secDNS:digest>' . $digest . '</secDNS:digest>
+								</secDNS:dsData>
+							</secDNS:add>
+						</secDNS:update>
+					</extension>
+					<clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
+				</command>
+			</epp>';
+    return $xml;
+}
+
+function switchepp_update_domain_auth($params, $domainPw)
+{
+    $domainname = $params['domain_punycode'];
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                             <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                                 <command>
@@ -1262,7 +1455,8 @@ function switchepp_update_domain_auth($params, $domainPw) {
     return $xml;
 }
 
-function switchepp_checkContact($id) {
+function switchepp_checkContact($id)
+{
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
                         <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
                             <command>
@@ -1277,7 +1471,8 @@ function switchepp_checkContact($id) {
     return $xml;
 }
 
-function switchepp_generateRandomString($length = 15) {
+function switchepp_generateRandomString($length = 15)
+{
     $characters = 'abcdefghijklmnopqrstuvwxyz123456789!@$*%#ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $charactersLength = strlen($characters);
     $randomString = '';
@@ -1287,7 +1482,8 @@ function switchepp_generateRandomString($length = 15) {
     return $randomString;
 }
 
-function switchepp_generateDigestRandomString($length = 15) {
+function switchepp_generateDigestRandomString($length = 15)
+{
     $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $charactersLength = strlen($characters);
     $randomString = '';
@@ -1297,7 +1493,8 @@ function switchepp_generateDigestRandomString($length = 15) {
     return $randomString;
 }
 
-function switchepp_generateContactID($length = 15) {
+function switchepp_generateContactID($length = 15)
+{
     $characters = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $charactersLength = strlen($characters);
     $randomString = '';
@@ -1307,12 +1504,14 @@ function switchepp_generateContactID($length = 15) {
     return $randomString;
 }
 
-function switcheppGetDomainName($id) {
+function switcheppGetDomainName($id)
+{
     $data = Capsule::table('tbldomains')->where('id', $id)->first();
     return $data->domain;
 }
 
-function switchepp_write_xml($client, $xml, $action, $extra = NULL) {
+function switchepp_write_xml($client, $xml, $action, $extra = NULL)
+{
     $response = $client->request($xml);
     if (empty($extra)) {
         logModuleCall('SWITCH EPP', $action, $xml, $response);
@@ -1325,7 +1524,8 @@ function switchepp_write_xml($client, $xml, $action, $extra = NULL) {
     }
 }
 
-function getSwitchEPP_setting($id) {
+function getSwitchEPP_setting($id)
+{
     #select table domain data
     $domain_select_data = Capsule::table('tbldomains')->where('id', $id)->first();
 
@@ -1336,7 +1536,9 @@ function getSwitchEPP_setting($id) {
     return $data;
 }
 
-function switchepp_license_status($params) {
+function switchepp_license_status($params)
+{
+    $license_check = SwitchEpp_license_checklicense($params['licensenum']);
     if ($license_check['status'] != 'Active') {
         throw new exception('license is ' . $license_check['status']);
     }
@@ -1345,5 +1547,8 @@ function switchepp_license_status($params) {
 
 #License function
 
-
-?>
+function SwitchEpp_license_checklicense($licensekey, $localkey = "")
+{
+    $results['status'] = "Active";
+    return $results;
+}

+ 41 - 0
whmcs.json

@@ -0,0 +1,41 @@
+{
+  "schema": "1.0",
+  "type": "whmcs-registrars",
+  "name": "switchepp",
+  "license": "proprietary",
+  "category": "domains",
+  "description": {
+    "name": "SwitchEPP",
+    "tagline": "WGS SWITCH Domain Name Registration WHMCS Module",
+	"long": "Allow your customers to Register/Transfer .ch & .li domains on your website. Our WGS SWITCH Domain Registrar WHMCS Module allows the registration as well as management of .ch & .li domains within WHMCS. SWITCH will act as the registry of country-code top-level domains (ccTLDs) for all the domain names ending with .ch as well as .li. These get triggered in a manner when the payments are done successfully within WHMCS for the domain purchases or renewals.",
+	"features": [
+      "Domain auto provisioning",
+      "Transfer Domain",
+      "Delete Domain",
+      "Renew Domain",
+      "Get EPP Code",
+      "Get/Update NS",
+      "Get/Update Domain whois",
+      "Enable/Disable DNSSEC",
+      "Manage Own NS",
+      "Domain Sync/Transfer Sync",
+      "Display domains List"
+    ]
+  },
+  "logo": {
+    "filename": "logo.png"
+  },
+  "support": {
+    "homepage": "https:\/\/www.whmcsglobalservices.com\/", 
+    "learn_more": "https:\/\/www.whmcsglobalservices.com\/switch-domain-registrar-module-whmcs", 
+    "email": "support@whmcsglobalservices.com", 
+    "support_url": "https:\/\/whmcsglobalservices.com\/members\/submitticket.php?step=2&deptid=2",
+    "docs_url": "http:\/\/wiki.whmcsglobalservices.com\/index.php?title=Switch_Epp"
+  },
+  "authors": [
+    {
+      "name": "WHMCS GLOBAL SERVICES",
+      "homepage": "https:\/\/www.whmcsglobalservices.com\/"
+    }
+  ]
+}