· 7 years ago · Jun 26, 2018, 11:20 AM
1<?php
2
3$_SERVER['HTTP_HOST'] = 'yandex.ru';
4$SYSTEM_KEY = '0fb5-6c08-2e45-b8c5';
5//$SYSTEM_KEY = 'sf';
6
7class Key
8 {
9 function __construct ( $key )
10 {
11 $this->key = intval ( $key );
12 }
13 public function generate ()
14 {
15 $md5 = explode( '.', $_SERVER['HTTP_HOST'] );
16 $count = count( $md5 ) - 1;
17
18 foreach ( $md5 as $array )
19 {
20 $end .= md5( sha1 (md5 ( $array[$count] . $this->key ) . $this->key ) . $this->key);
21 }
22
23 $end = substr( $end, 0, 16 );
24 $GLOBALS['SYSTEM_KEY'] = str_replace( '-', '', $GLOBALS['SYSTEM_KEY'] );
25
26 if( $GLOBALS['SYSTEM_KEY'] == $end )
27 {
28 return true;
29 }
30
31 }
32 }
33
34$Key = new Key(1934);
35
36if( !$Key->generate () )
37 die ( 'License Error!' );