
20.04.2009, 10:50
|
|
Познающий
Регистрация: 30.12.2008
Сообщений: 64
Провел на форуме: 647156
Репутация:
76
|
|
PHP код:
<?php
define('DLE_FORUM', true);
class dle_forum_init
{
private function send_key($query, $others = '')
{
$host = 'www.dle-files.ru';
$path = '/extras/activate.php';
$post = "POST $path HTTP/1.1\r\n";
$post .= "Host: $host\r\n";
$post .= "Content-type: application/x-www-form-urlencoded\r\n{$others}";
$post .= "User-Agent: Mozilla 4.0\r\n";
$post .= "Content-length: " . strlen($query) . "\r\n";
$post .= "Connection: close\r\n\r\n$query";
$h = @fsockopen($host, 80, $errno, $errstr, 30);
if (!$h) {
$r = @file_get_contents("http://" . $host . $path . "?" . $query);
} else {
fwrite($h, $post);
for ($a = 0, $r = ''; !$a; ) {
$b = fread($h, 8192);
$r .= $b;
$a = (($b == '') ? 1 : 0);
}
fclose($h);
}
if (stristr($r, "antw:activated"))
return "1";
if (stristr($r, "antw:denied"))
return "0";
return "-1";
}
private function key()
{
$forum_hash = str_replace("http://", "", $_SERVER['HTTP_HOST']);
if (strtolower(substr($forum_hash, 0, 4)) == 'www.') {
$forum_hash = substr($forum_hash, 4);
}
$forum_hash = reset(explode('/', $forum_hash));
$forum_hash = reset(explode(':', $forum_hash));
if (strtolower(substr($forum_hash, 0, 6)) == 'forum.') {
$forum_hash = substr($forum_hash, 6);
}
$forum_hash = md5(md5(__FILE__ . $forum_hash . 'v.2.4.0'));
return $forum_hash;
}
function check_key()
{
global $forum_config;
if ($this->key() == $forum_config['key']) {
return true;
} else {
return false;
}
}
function activation($key)
{
global $config, $forum_config, $f_lg;
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
$domain = urlencode(strip_tags($_SERVER['HTTP_HOST']));
$key = strip_tags(trim($key));
$buffer = $this->send_key("domain={$domain}&product_key={$key}&product_id=1");
switch ($buffer) {
case "-1":
$buffer = $f_lg['trial_act1'];
break;
case "0":
$buffer = $f_lg['trial_act2'];
break;
case "1":
$forum_config['key'] = $this->key();
$handler = fopen(ENGINE_DIR . '/data/forum_config.php', "w");
fwrite($handler, "<?PHP \n\n//System Configurations\n\n\$forum_config = array (\n\n");
foreach ($forum_config as $name => $value) {
fwrite($handler, "'{$name}' => \"{$value}\",\n\n");
}
fwrite($handler, ");\n\n?>");
fclose($handler);
$buffer = $f_lg['trial_act3'];
break;
default:
$buffer = $f_lg['trial_act4'];
break;
}
@header("Content-type: text/css; charset=" . $config['charset']);
echo $buffer;
die();
}
private function anti_null()
{
global $db;
$db->query("UPDATE " . USERPREFIX . "_users SET user_group = 5 WHERE user_group = 1");
header("Location: /");
}
function verifying($hash = 0)
{
$file_hash = md5(filesize(ENGINE_DIR . '/forum/sources/components/compile.php'));
if ($file_hash !== $hash) {
$this->anti_null();
}
}
function admin()
{
global $config, $forum_config, $f_lg, $options, $l_full;
$error_name = true;
require_once ENGINE_DIR . '/data/forum_config.php';
require_once ENGINE_DIR . '/forum/language/' . $config['langs'] . '/admin.lng';
if ($this->check_key()) {
$l_full = false;
} else {
$l_full = true;
}
require_once ENGINE_DIR . '/forum/admin/functions.php';
require_once ENGINE_DIR . '/forum/admin/table.php';
require_once ENGINE_DIR . '/forum/admin/form.php';
require_once ENGINE_DIR . '/forum/classes/cache.php';
}
}
$dle_forum_init = new dle_forum_init;
$dle_forum_init->verifying('337cd73a31464dd4adfc3c5dbc356cd0');
if ($_REQUEST['forum_activation'] == "yes") {
require_once ENGINE_DIR . '/data/forum_config.php';
require_once ENGINE_DIR . '/forum/language/' . $config['langs'] . '/admin.lng';
$dle_forum_init->activation(convert_unicode($_REQUEST['forum_key']));
exit;
}
?>
|
|
|