Location: PHPKode > projects > Openology PHP Application Integration > openology/install/nodatabase.php
<?php
/***************************************************************************
 *   copyright            : (C) 2006 The openology Group
 *   email                : hide@address.com
 *
 *   $Id
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

header('content-type:text/html;charset=UTF-8');
   $script_path = (!empty($HTTP_POST_VARS['script_path'])) ? $HTTP_POST_VARS['script_path'] : str_replace('/install', '', dirname($HTTP_SERVER_VARS['PHP_SELF']));
   $hidd_path = $script_path;
	$dbhost = (!empty($HTTP_POST_VARS['dbhost'])) ? $HTTP_POST_VARS['dbhost'] : 'localhost'; 
function ShowMsg($msg,$gotoPage)
{
	$msg = str_replace("'","`",trim($msg));
	$gotoPage = str_replace("'","`",trim($gotoPage));
	echo "<script language='javascript'>\n";
	echo "alert('$msg');";
	if($gotoPage=="back")
	{
		echo "history.go(-1);\r\n";
	}
	else if(ereg("^-",$gotoPage))
	{
		echo "history.go($gotoPage);\r\n";
	}
	else if($gotoPage!="")
	{
		echo "location.href='$gotoPage';\r\n";
	}
	echo "</script>";
}
$s_isreg = @get_cfg_var("register_globals");
if($s_isreg!=1)
{
	if (!empty($_GET)) foreach($_GET AS $key => $value){$$key = $value;}
	if (!empty($_POST)) foreach($_POST AS $key => $value){$$key = $value;}
}
function GetConfigFile()
{
	$fp = fopen("config_base_nodata.php","r") or die("配置文件无法读取或无法访问,请把当前目录权限设为可读写!");
	$configfile = fread($fp,filesize("config_base_nodata.php"));
	fclose($fp);
	return $configfile;
}

function SaveConfigFile($str)
{
	$fp = fopen("config_base_nodata.php","w") or die("配置文件无法写入,请把当前目录权限设为可读写!");;
	fwrite($fp,$str);
	fclose($fp);
}
if(isset($adminname))
{
	    $configstr = GetConfigFile();
	    $configstr = str_replace("~name~",$adminname,$configstr);
	    $configstr = str_replace("~pass~",md5($adminpwd),$configstr);

    SaveConfigFile($configstr);
	copy("config_base_nodata.php","../backend/config_base.php");
	copy("login_nodata.php","../backend/login.php");
 	ShowMsg("网站安装成功!","../backend/login.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en-EU" lang="en-EU">
<head><title>install</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
</head>
<body>
<form action="nodatabase.php" method="post">
<h4>没有数据库的基本设定</h4><p />
<div align="center">
管理员名称:<input name="adminname" type="text" id="adminname" value="admin" />

管理员密码:<input name="adminpwd" type="text" id="adminpwd" value="admin" />
</div><p />
<div align="center"><input name="step" type="submit" value="完成" /></div>

</form>
</body>
</html>
Return current item: Openology PHP Application Integration