user_login;
$firstname = $current_user->user_firstname;
$lastname = $current_user->user_lastname;
$email = strtolower($current_user->user_email);
$customerpw = “”;

try{
// Search for the Customer ID
define(“CUSTOMER_SEARCH_URL”, “https://secure.prepar3d.com/solo/webservices/XmlCustomerService.asmx/CustomerSearchS”);
$requestCustomer = new HTTP_Request();
$requestCustomer->setUrl(CUSTOMER_SEARCH_URL);
$requestCustomer->setMethod(HTTP_REQUEST_METHOD_POST);
$requestCustomer->addPostData(‘xml’, ‘2451871webserviced4vnCRuL71PAPfR‘.$email.’‘);

$requestCustomer->sendRequest();
$xmlCustomerParsed = simplexml_load_string($requestCustomer->getResponseBody());

// Take the most recent customerID (should be the largest number)
foreach ($xmlCustomerParsed->children() as $individualCustomerRecord) {
if ($individualCustomerRecord->CustomerID > $customerID)
$customerID = $individualCustomerRecord->CustomerID;
$customerpw = $individualCustomerRecord->Password;
}
echo “

Customer ID: $customerID

“;
echo “

Associated Email Account: $email

“;
}
catch (Exception $e){
echo “There is an error retrieving your customer ID. Please contact support@prepar3d.com.”;
}

try{
// Get all licenses using the Customer ID
define(“CUSTOMER_DATA_URL”, “https://secure.prepar3d.com/solo/webservices/XmlCustomerService.asmx/GetCustomerDataByAuthorS”);
$customerRequestData = new HTTP_Request();
$customerRequestData->setUrl(CUSTOMER_DATA_URL);
$customerRequestData->setMethod(HTTP_REQUEST_METHOD_POST);
$customerRequestData->addPostData(‘xml’, ‘2451871webserviced4vnCRuL71PAPfR‘.$customerID.’‘);
$customerRequestData->sendRequest();
$customerXmlDataParsed = simplexml_load_string($customerRequestData->getResponseBody());

echo “

The following licenses are associated with your account. If the Expiration Date is listed as None it is a license that will never expire. If the license’s Expiration Date is listed as Recurring it is a subscription based license and will be billed monthly based off the Creation Date. All subscription license types can be managed by clicking on their active link under the License Type column. If the Status of the license is listed as anything other than OK your license for that specific License ID is invalid.

“;
echo “

“;
echo “

“;
foreach ($customerXmlDataParsed->{“License”} as $individualLicense) {

// Get license info
define(“LICENSE_INFO_URL”, “https://secure.prepar3d.com/solo/webservices/XmlLicenseService.asmx/InfoCheckS”);
$licenseInfoRequestData = new HTTP_Request();
$licenseInfoRequestData->setUrl(LICENSE_INFO_URL);
$licenseInfoRequestData->setMethod(HTTP_REQUEST_METHOD_POST);
$licenseInfoRequestData->addPostData(‘xml’, ‘‘.$individualLicense->LicenseID.’‘);
$licenseInfoRequestData->sendRequest();
$licenseInfoXmlDataParsed = simplexml_load_string($licenseInfoRequestData->getResponseBody());

$createdDate = substr($individualLicense->EnteredDate,0,10);
$expDate = substr($individualLicense->ExpirationDate,0,10);
$expYear = substr($expDate,0,4);

if ( (!strcmp($createdDate, $expDate)) || (substr($individualLicense->ExpirationDate,0,4) < 2010) ) { $expDate = "None"; } if (strlen(strstr($individualLicense->OptionName,”Subscription”))>0)
{
$licenseIsASubscription = true;
}

if ($licenseIsASubscription)
{
$expDate = “Recurring”;
$individualLicense->OptionName = “PaymentPlanInstanceID&LicenseID=$individualLicense->LicenseID&Password=$customerpw&A=2451871\”>$individualLicense->OptionName“;
}

echo “

“;

$licenseIsASubscription = false;

}
echo “

Product Name License Type License ID Creation Date Expiration Date Activations Left Status
$individualLicense->ProductName $individualLicense->OptionName $individualLicense->LicenseID $createdDate $expDate $licenseInfoXmlDataParsed->RemainingActivations $individualLicense->Status

“;

}
catch (Exception $e){
echo “There is an error retrieving your license data. Please contact support@prepar3d.com.”;
}

echo “

Please contact licensing@prepar3d.com if software you have purchased is not listed here.

“;

}
else{
echo “You must first login before accessing your license information.”;
}

?>