⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.php

📁 flashget43的源代码 一个比较常用的下载程序
💻 PHP
字号:
<?php
include_once('../inc/smartyinit.php');

session_start();

$smarty->template_dir  = INC_DIR . '../templates/admin';

if(substr_count($GLOBALS['fc_config']['botsdata_path'], '.') < 3) 
	$GLOBALS['fc_config']['botsdata_path'] = '.' . $GLOBALS['fc_config']['botsdata_path'];

//------------------------------------------------------------------------------------------------------------------------------//
function sort_table($by, &$a)
{
	$n = count($a);
	for ($i=0; $i < $n-1 ; $i++) {
		 for ($j=0; $j<$n-1-$i; $j++)
			 if (strnatcmp($a[$j+1][$by],$a[$j][$by]) < 0 ) {
				$tmp = $a[$j];
				$a[$j] = $a[$j+1];
				$a[$j+1] = $tmp;
		}
	}
}

function getTables()
{
	$standart_tables = array(
		$GLOBALS['fc_config']['db']['pref'].'bans',
		$GLOBALS['fc_config']['db']['pref'].'bot',
		$GLOBALS['fc_config']['db']['pref'].'bots',
		$GLOBALS['fc_config']['db']['pref'].'connections',
		$GLOBALS['fc_config']['db']['pref'].'conversationlog',
		$GLOBALS['fc_config']['db']['pref'].'dstore',
		$GLOBALS['fc_config']['db']['pref'].'gmcache',
		$GLOBALS['fc_config']['db']['pref'].'gossip',
		$GLOBALS['fc_config']['db']['pref'].'ignors',
		$GLOBALS['fc_config']['db']['pref'].'messages',
		$GLOBALS['fc_config']['db']['pref'].'patterns',
		$GLOBALS['fc_config']['db']['pref'].'rooms',
		$GLOBALS['fc_config']['db']['pref'].'templates',
		$GLOBALS['fc_config']['db']['pref'].'thatindex',
		$GLOBALS['fc_config']['db']['pref'].'thatstack',
		//WARNING $GLOBALS['fc_config']['db']['pref'].'users' !!! NOT need remowe users table
	);
	
	$link = mysql_connect($GLOBALS['fc_config']['db']['host'], $GLOBALS['fc_config']['db']['user'], $GLOBALS['fc_config']['db']['pass']);
	mysql_select_db($GLOBALS['fc_config']['db']['base'], $link);

	$query = "SHOW TABLES FROM `{$GLOBALS['fc_config']['db']['base']}` LIKE '{$GLOBALS['fc_config']['db']['pref']}%'";	
    $showcode = mysql_query($query, $link);
   	
	$tables = array();
	if ($showcode && mysql_numrows($showcode) !== false)
	{
    	while ($rec = mysql_fetch_array($showcode, MYSQL_NUM)) $tables[] = $rec[0];    
    }
	
	$tables = array_intersect($tables, $standart_tables); 

	return $tables;
}

function isInstalled()
{
	$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}connections LIMIT 1");
	$res  = $stmt->process();
	if($res == null)
	{
		return false;
	} 
	
	return true;
	//return (sizeof(getTables()) > 0);
}

function inSession()
{
	return (isset($_SESSION['userid']) && ChatServer::userInRole($_SESSION['userid'], ROLE_ADMIN) && isInstalled());
}
//------------------------------------------------------------------------------------------------------------------------------//	
	 
error_reporting(E_ALL ^ E_NOTICE);

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -