www.gusucode.com > weenCompany闻名企业网站系统 4.0.0 繁体中英文 UTF8源码程序 > install/model.php

    <?php
// +---------------------------------------------+
// |     Copyright  2007 - 2009 weenCompany      |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+

define('INSTALL_PATH', dirname(__FILE__));

function tryToConnect($server, $user, $pwd, $db)
{
	if (!$link = @mysql_connect($server, $user, $pwd))
		return 1;
	if (!@mysql_select_db($db, $link))
		return 2;
	return 0;
}
	
function checkDB ($srv, $login, $password, $name)
{
	switch(tryToConnect($srv, $login, $password, $name))
	{
		case 0:
			return 0;
		break;
		
		case 1:
			return 25;
		break;
		
		case 2:
			return 24;
		break;
	}
}

function isValidName($Name)
{
	return eregi('^[^<>;=#{}]*$', $Name);
}


// XML Header
header('Content-Type: text/xml');
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate");


// Switching method
if(isset($_GET['method']))
{
	switch ($_GET['method'])
	{
		
		case 'checkConfig' :
			include_once('step/checkConfig.php');
		break;
	
		case 'checkDB' :
			include_once('step/checkDB.php');
		break;
		
		case 'createDB' :
			include_once('step/createDB.php');
		break;
	
		case 'checkMail' :
			include_once('step/checkMail.php');
		break;
	
		case 'checkAdminInfos' :
			include_once('step/checkAdminInfos.php');
		break;
		
	}
}
?>