install_4.php
来自「全新且完善的强大网上商店系统」· PHP 代码 · 共 343 行
PHP
343 行
<?php
/*
[SOOBIC!] install/templates/pages/install_5.php
Version: 1.5
Author: soolan (soolan@qq.com)
Copyright: soolan (www.soobic.com)
Last Modified: 2005/4/17 14:11
*/
$www_location = 'http://' . getenv('HTTP_HOST') . getenv('SCRIPT_NAME');
$www_location = substr($www_location, 0, strpos($www_location, 'install'));
$script_filename = getenv('PATH_TRANSLATED');
if (empty($script_filename)) {
$script_filename = getenv('SCRIPT_FILENAME');
}
$script_filename = str_replace('\\', '/', $script_filename);
$script_filename = str_replace('//', '/', $script_filename);
$dir_fs_www_root_array = explode('/', dirname($script_filename));
$dir_fs_www_root = array();
for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) {
$dir_fs_www_root[] = $dir_fs_www_root_array[$i];
}
$dir_fs_document_root = implode('/', $dir_fs_www_root) . '/';
if ((substr($dir_fs_document_root, -1) != '/') && (substr($dir_fs_document_root, -1) != '/')) {
$where = strrpos($dir_fs_document_root, '\\');
if (is_string($where) && !$where) {
$dir_fs_document_root .= '/';
} else {
$dir_fs_document_root .= '\\';
}
}
$enable_ssl = (isset($HTTP_POST_VARS['ENABLE_SSL']) && ($HTTP_POST_VARS['ENABLE_SSL'] == 'true') ? 'true' : 'false');
?>
<p>安装Soobic!网上商城---<b>Soobic!网上商城配置configure.php</b></p>
<p></p>
<?php
$db = array();
$db['DB_SERVER'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER']));
$db['DB_SERVER_USERNAME'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_USERNAME']));
$db['DB_SERVER_PASSWORD'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
$db['DB_DATABASE'] = trim(stripslashes($HTTP_POST_VARS['DB_DATABASE']));
$db_error = false;
osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
if ($db_error == false) {
osc_db_test_connection($db['DB_DATABASE']);
}
if ($db_error != false) {
?>
<form name="install" action="install.php?step=1" method="post">
<table width="95%" border="0" cellpadding="2" class="formPage">
<tr>
<td>
<p>资料库连接测试<b>失败</b></p>
<p>错误讯息:</p>
<p class="boxme"><?php echo $db_error; ?></p>
<p>请按下面 <i>返回</i> 按钮,重新检查数据库主机参数设定</p>
<p>如果你不知道资料库主机(Mysql server)的名称、帐号或密码?请询问你的系统管理员或提供网页主机的公司</p>
</td>
</tr>
</table>
<p> </p>
<table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center"><input type="submit" name="submit" value="返 回" style="height: 25"></td>
<td align="center"><input type="submit" name="submit" value="退出安装向导" style="height: 25" onclick="javascript: window.close();"></td>
</tr>
</table>
<?php
reset($HTTP_POST_VARS);
while (list($key, $value) = each($HTTP_POST_VARS)) {
if ($key != 'x' && $key != 'y') {
if (is_array($value)) {
for ($i=0; $i<sizeof($value); $i++) {
echo osc_draw_hidden_field($key . '[]', $value[$i]);
}
} else {
echo osc_draw_hidden_field($key, $value);
}
}
}
?>
</form>
<?php
} elseif ( ( (file_exists('../includes/configure.php')) && (!is_writeable('../includes/configure.php')) ) ) {
?>
<form name="install" action="install.php?step=4" method="post">
<table width="95%" border="0" cellpadding="2" class="formPage">
<tr>
<td>
<p>发生下列错误:</p>
<p><div class="boxMe"><b>设定档(configure.php)不存在,或档案权限未设定。</b></p>
<p>如果您使用的是Unix型主机,请执行下列动作:
<ul><li>cd <?php echo $dir_fs_document_root; ?>includes/</li><li>touch configure.php</li><li>chmod 706 configure.php</li></ul>
<ul>如果 <i>chmod 706</i> 仍然发生错误,请试 <i>chmod 777</i>.</ul>
</p>
<p>如果你是在 Microsoft Windows 的环境下安装,请将已经存在的文件(includes/configure.php)重命名,以便产生新的configure.php文件。或取消该文件的"只读"属性</p>
</td>
</tr>
</table>
<p> </p>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><a href="index.php"><img src="images/button_newinstall.gif" border="0" alt="重新安装"></a></td>
<td align="center"><input type="image" src="images/button_retry.gif" border="0" alt="重试"></td>
</tr>
</table>
<?php
reset($HTTP_POST_VARS);
while (list($key, $value) = each($HTTP_POST_VARS)) {
if ($key != 'x' && $key != 'y') {
if (is_array($value)) {
for ($i=0; $i<sizeof($value); $i++) {
echo osc_draw_hidden_field($key . '[]', $value[$i]);
}
} else {
echo osc_draw_hidden_field($key, $value);
}
}
}
?>
</form>
<?php
} else {
function result($result = 1, $output = 1) {
if($result) {
$text = '... <font color="#0000EE">成功</font><br>';
if(!$output) {
return $text;
}
echo $text;
} else {
$text = '... <font color="#FF0000">失败</font><br>';
if(!$output) {
return $text;
}
echo $text;
}
}
$exist_error = FALSE;
$write_error = FALSE;
if(file_exists('../includes/configure.php')) {
$fileexists = result(1, 0);
} else {
$fileexists = result(0, 0);
$exist_error = TRUE;
}
if(is_writeable('../includes/configure.php')) {
$filewriteable = result(1, 0);
} else {
$filewriteable = result(0, 0);
$write_error = TRUE;
}
if($exist_error) {
$config_info = '您的 includes/configure.php 不存在, 无法继续安装, 请用 FTP 将该文件上传后再试.';
} elseif(!$write_error) {
$config_info = '请在下面填写您的数据库账号信息, 通常情况下请不要修改红色选项内容.';
} elseif($write_error) {
$config_info = '安装向导无法写入配置文件, 请核对现有信息, 如需修改, 请通过 FTP 将改好的 config.php 上传.';
}
$http_url = parse_url($www_location);
$http_server = $http_url['scheme'] . '://' . $http_url['host'];
$http_catalog = $http_url['path'];
if (isset($http_url['port']) && !empty($http_url['port'])) {
$http_server .= ':' . $http_url['port'];
}
if (substr($http_catalog, -1) != '/') {
$http_catalog .= '/';
}
$https_server = '';
$https_catalog = '';
if($enable_ssl=='true'){
$https_www_address = str_replace('http://', 'https://', $www_location);
$https_url = parse_url($https_www_address);
$https_server = $https_url['scheme'] . '://' . $https_url['host'];
$https_catalog = $https_url['path'];
if (isset($https_url['port']) && !empty($https_url['port'])) {
$https_server .= ':' . $https_url['port'];
}
if (substr($https_catalog, -1) != '/') {
$https_catalog .= '/';
}
}
$https_cookie_domain='';
$https_cookie_path ='';
$http_cookie_domain = getenv('HTTP_HOST');
$http_cookie_path = substr(dirname(getenv('SCRIPT_NAME')), 0, -7);
if($enable_ssl=='true'){
$https_cookie_domain =getenv('HTTP_HOST');
$https_cookie_path = $http_cookie_path;
}
$file_contents = '<?php' . "\n" .
'' . "\n" .
'/*' . "\n" .
' -----------------------------------------------------------------' . "\n" .
' [SOOLAN!] configure.php - basically configuration of Soolan!' . "\n" .
' This is changed by Soolan (wqc200@163.com)' . "\n" .
' Changecopyright: Soolan Studio (www.soolan.com)' . "\n" .
' Last Modified: 2005/4/1 3:00' . "\n" .
'*/' . "\n" .
'' . "\n" .
'' . "\n" .
'' . "\n" .
'// Define the webserver and path parameters' . "\n" .
'// * DIR_FS_* = Filesystem directories (local/physical)' . "\n" .
'// * DIR_WS_* = Webserver directories (virtual/URL)' . "\n" .
' define(\'HTTP_SERVER\', \'' . $http_server . '\'); // eg, http://localhost - should not be empty for productive servers' . "\n" .
' define(\'HTTPS_SERVER\', \'' . $https_server . '\'); // eg, https://localhost - should not be empty for productive servers' . "\n" .
' define(\'ENABLE_SSL\', ' . $enable_ssl . '); // secure webserver for checkout procedure?' . "\n" .
' define(\'HTTP_COOKIE_DOMAIN\', \'' . $http_cookie_domain . '\');' . "\n" .
' define(\'HTTPS_COOKIE_DOMAIN\', \'' . $https_cookie_domain . '\');' . "\n" .
' define(\'HTTP_COOKIE_PATH\', \'' . $http_cookie_path . '\');' . "\n" .
' define(\'HTTPS_COOKIE_PATH\', \'' . $https_cookie_path . '\');' . "\n" .
' define(\'DIR_WS_HTTP_CATALOG\', \'' . $http_catalog . '\');' . "\n" .
' define(\'DIR_WS_HTTPS_CATALOG\', \'' . $https_catalog . '\');' . "\n" .
'' . "\n" .
'' . "\n" .
'' . "\n" .
' define(\'DIR_WS_DOWNLOAD_PUBLIC\', \'pub/\');' . "\n" .
' define(\'DIR_FS_CATALOG\', \'' . $dir_fs_document_root . '\');' . "\n" .
' define(\'DIR_FS_DOWNLOAD\', DIR_FS_CATALOG . \'download/\');' . "\n" .
' define(\'DIR_FS_DOWNLOAD_PUBLIC\', DIR_FS_CATALOG . \'pub/\');' . "\n" .
'' . "\n" .
'' . "\n" .
'// ==================== 以下变量需根据您的服务器说明档修改 ====================
// 注意: 如果数据库连接有问题,请不要向我们询问具体参数设置,请与空间商联系,
// 因为我们也无法告诉你这些变量应该设置为何值' . "\n" .
'' . "\n" .
'' . "\n" .
'' . "\n" .
' define(\'DB_SERVER\', \'' . $HTTP_POST_VARS['DB_SERVER'] . '\'); // 数据库服务器 (eg, localhost - should not be empty for productive servers)' . "\n" .
' define(\'DB_SERVER_USERNAME\', \'' . $HTTP_POST_VARS['DB_SERVER_USERNAME'] . '\'); //数据库用户名' . "\n" .
' define(\'DB_SERVER_PASSWORD\', \'' . $HTTP_POST_VARS['DB_SERVER_PASSWORD']. '\'); // 数据库密码' . "\n" .
' define(\'DB_DATABASE\', \'' . $HTTP_POST_VARS['DB_DATABASE']. '\'); // 数据库名' . "\n" .
'' . "\n" .
'' . "\n" .
' define(\'DB_DATABASE_PRE\', \'bsp_\'); // 数据库前缀(注意:不可修改)' . "\n" .
'' . "\n" .
'' . "\n" .
'
// 注意: 请务修改以下变量,仅供程序调试之用' . "\n" .
' define(\'DB_DATABASE_TYPE\', \'mysql\'); // use persistent connections?' . "\n" .
' define(\'USE_PCONNECT\', \'0\'); // use persistent connections?' . "\n" .
'' . "\n" .
'' . "\n" .
'//=== 如果您的服务器不支持session,请修改以下变量=====
//为空则使用文件保存session,如果使用数据库保存session,请填写\'mysql\'
' . "\n" .
' define(\'STORE_SESSIONS\', \'\'); // leave empty \'\' for default handler or set to \'mysql\'' . "\n" .
'' . "\n" .
'' . "\n" .
'//=== 如果您的服务器时间显示不正确,请修改以下变量=====
//8为时差,请修改此数字,使商店显示时间与当地时间一致
' . "\n" .
' define(\'TIME_OFFSET\', \'8\'); // leave empty \'\' for default handler or set to \'mysql\'' . "\n" .
'' . "\n" .
'' . "\n" .
'// ============================================================================' . "\n" .
'?>';
$fp = fopen('../includes/configure.php', 'w');
fputs($fp, $file_contents);
fclose($fp);
?>
<table width="95%" border="0" cellpadding="2" class="formPage">
<tr>
<td>
<hr noshade align="center" width="100%" size="1">
</td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1">
</td>
</tr>
<tr>
<td align="center"><br><br><br><font color="#FF0000"><b>恭喜您,Soobic! 网上商城安装成功!</font><br>
管理员账号:</b>soolan@soobic.com<b> 密码:</b>soobic<br><br></td>
</tr>
</table>
<p> </p>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><a href="<?=$http_server . $http_catalog?>index.php" target="_blank">进入商店首页</a></td>
<td align="center"><a href="<?=$http_server . $http_catalog?>admincp.php" target="_blank">进入商店后台</a></td>
</tr>
</table>
<?php
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?