EVOLUTION-NINJA
Edit File: validate_licence.php
<?php include('install/crypto.php'); define('BASEPATH', 'system'); require_once('install/constants.php'); require_once('system/application/helpers/simplexml_load_url_curl_helper.php'); echo BASEPATH; echo LIC_API_URL; $username = $_POST['user_name']; $base_url = $_POST['base_url']; $validity=0; if(file_exists('install/local_licence.xml')) { $xml = simplexml_load_url_curl("install/local_licence.xml"); $local_licence_user = trim((string)$xml->username[0]); $local_licence_key = trim((string)$xml->l_key[0]); $local_licence_status = trim((string)$xml->status[0]); $local_licence_domain = trim((string)$xml->domain[0]); if(trim($username) == trim($local_licence_user)) { if($local_licence_status == 0) { $server_query = LIC_API_URL."?operation=db_query&username=".$username.""; $server_licence = simplexml_load_url_curl($server_query); $server_key = trim((string)$server_licence->entries->entry->licence_key); $server_user = trim((string)$server_licence->entries->entry->username); $server_status = trim((string)$server_licence->entries->entry->status); $server_domain = trim((string)$server_licence->entries->entry->domain); if($local_licence_key == $server_key) { if($server_status=='1') { if($server_domain == $local_licence_domain) { /* overwrite licence file */ $doc = new DOMDocument(); $doc->formatOutput = true; $r = $doc->createElement("licences"); $doc->appendChild($r); // Using this function to create username element in the file $licence_username = $doc->createElement("username"); $r->appendChild($licence_username); $licence_username_text = $doc->createTextNode($username); $licence_username->appendChild($licence_username_text); // Using this function to create key element in the file $licence_key = $doc->createElement("l_key"); $r->appendChild($licence_key); $licence_key_text = $doc->createTextNode($server_key); $licence_key->appendChild($licence_key_text); // Using this function to create status element in the file $licence_status = $doc->createElement("status"); // if o = renew else >0 = active; $r->appendChild($licence_status); $licence_status_text = $doc->createTextNode('1'); $licence_status->appendChild($licence_status_text); // Using this function to create domain element in the file $domain = $doc->createElement("domain"); // if o = renew else >0 = active; $r->appendChild($domain); $domain_text = $doc->createTextNode($base_url); $domain->appendChild($domain_text); $xml_file = $doc->saveXML(); $new_file_handle = fopen('install/local_licence.xml',"w"); if(fwrite($new_file_handle,$xml_file) != FALSE) { echo 'file writed'; $validity++; } else { echo 'file not replaced due to an error'; } /* end */ } } else { echo ' invalid licence on server '; } } else { echo ' problem, your licence does not match with our server records ; '; } } else { $validity++; } } } else { echo 'no local licence configured'; } ?> <?php if($validity>0) { ?> <form action="<?php echo $_POST['surl']; ?>" method="post"> <input type="hidden" name="user_name" value="<?php echo $_POST['user_name']; ?>" /> <input type="hidden" name="user_pass" value="<?php echo encrypt($_POST['user_pass'],'1001'); ?>" /> <input type="submit" value="Continue" /> </form> <?php } else { echo ' cannot continue '; } ?>