} $result = false; if ($serial_number != null && $registration_key != null) { //test registration key decoding $result = DecodeRegistrationKey($serial_number, $registration_key); if ($result !== false) { $smarty->assign('serial_number', $result->serialNumber); $smarty->assign('registration_key', $result->registrationKey); if ($result->numberOfLicensesPurchased == 0) { $smarty->assign('license_count', 'site_license'); } else { $smarty->assign('license_count', $result->numberOfLicensesPurchased); } if ($result->numberOfDaysValid == 0) { $smarty->assign('days_valid', 'non-expiring'); } else { $smarty->assign('days_valid', $result->numberOfDaysValid); } $smarty->assign('valid_license', true); $smarty->assign('key_type', get_key_type_name($result->keyVersion)); $smarty->assign('customer_type', get_customer_type_name($result->customerType)); $smarty->assign('product_type', get_product_type_name($result->productType)); $smarty->assign('functionality_type', get_functionality_type_name($result->functionalityType)); } else { $smarty->assign('valid_license', false); } $smarty->assign('submitted', true); } $smarty->display('verify_license.tpl'); mysql_close($db_conn); //close the database connection
$query = "SELECT ID, CompanyName, CustomerName, SerialNumber, RegistrationKey, DaysValid, LicensesPurchased, Product, " . "timeof_creation FROM RegData ORDER BY timeof_creation DESC"; $result = mysql_query($query); //check mysql result set if ($result) { $licenses = array(); while ($row = mysql_fetch_assoc($result)) { $row['Class'] = "tablecol" . (count($licenses) % 2 + 1); if ($row['DaysValid'] == 0) { $row['DaysValid'] = 'non-expiring'; } else { $row['DaysValid'] .= ' days'; } if ($row['LicensesPurchased'] == 0) { $row['LicensesPurchased'] = "unlimited <i>(site)</i>"; } $row['Product'] = get_product_type_name($row['Product']); if ($row['timeof_creation'] == 0) { $row['timeof_creation'] = "<i>n/a</i>"; } else { $row['timeof_creation'] = strftime("%B %d, %Y", $row['timeof_creation']); } $licenses[] = $row; } $smarty->assign('licenses', $licenses); $smarty->assign('show_top_url', count($licenses) > 30); mysql_free_result($result); //release mysql result set } mysql_close($db_conn); //close the database connection $smarty->display('view_licenses.tpl');