php 网站在线安装源码
<?php
/*
+-------------------------------------------
|
| Technology of WeSpace Software
| ========================================
| Powered by WeSpace
| (c) 2006 wane.net
| F_Space Ver3.x
| ========================================
| Site: http://www.wesofts.com
|
+-------------------------------------------
| Autohr : wsfuyibing
| Email : websearch@163.com
| MSN : websearch@163.com
+-------------------------------------------
*/
error_reporting(E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);
define('IN_www.phprm.com',true);
define('IN_LICENSED',true);
define('WANE_ROOT','../');
$timestamp = time();
$configfile = '../config.inc.php';
/*
+-------------------------------------------
+ Check PHP version
+-------------------------------------------
*/
if (@phpversion() < '4.1.0')
{
$_COOKIE = &$HTTP_COOKIE_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_FILES = &$HTTP_POST_FILES;
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
}
/*
+-------------------------------------------
+ Language
+-------------------------------------------
*/
$lang = in_array($_GET['lang'],array('gbk','big5','utf-8-gbk','utf-8-big5')) ? $_GET['lang'] : 'utf-8-gbk';
$charset = substr($lang ,0,5);
if (!file_exists('./'.$lang.'/language.php'))
{
exit('Can not load language file . ');
}
else
{
require_once './'.$lang.'/language.php';
}
/*
+-------------------------------------------
+ Step
+-------------------------------------------
*/
$step = file_exists('../upload/install.lock') ? '0' : ($_GET['step'] ? $_GET['step'] : '1');
$steps = 16;
$step = $step > $steps ? $steps : $step;
/*
+-------------------------------------------
+ Template
+-------------------------------------------
*/
$tpl_header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."n";
$tpl_header .= '<html xmlns="http://www.w3.org/1999/xhtml">'."n";
$tpl_header .= '<head>'."n";
$tpl_header .= '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />'."n";
$tpl_header .= '<title>'.$tplang['title'].'</title>'."n";
$tpl_header .= '<link href="style.css" rel="stylesheet" type="text/css" />'."n";
$tpl_header .= '</head>'."n";
$tpl_header .= '<body>'."n";
$tpl_header .= '<table border="0" cellpadding="0" cellspacing="0" >'."nt".'<tr>'."ntt".'<td>'.$tplang['title'].'</td>'."ntt".'<td>'.($step > 1 ? $tplang['lang_'.$lang].' <br />' : '').$tplang['step_name'].': '.$tplang['step'.$step].'('.$tplang['step_cur'].$step.$tplang['step_unit'].'/'.$tplang['step_total'].$steps.$tplang['step_unit'].')</td>'."nt".'</tr>'."n".'</table>'."n";
$tpl_footer = '<table border="0" cellpadding="0" cellspacing="0" >'."nt".'<tr>'."ntt".'<td>'.$tplang['footer'].'</td>'."nt".'</tr>'."n".'</table>'."n".'</body>'."n";
$tpl_footer .= '</html>';
/*
+-------------------------------------------
+ Start Install
+-------------------------------------------
*/
if (file_exists('../upload/install.lock'))
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step0_1']?>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
elseif ($step == '1')
{
echo $tpl_header;
?>
<div>
<ol>
<li>
<a href="install.php?lang=gbk&step=2"><?=$tplang['lang_gbk']?></a>
</li>
<li>
<a href="install.php?lang=big5&step=2"><?=$tplang['lang_big5']?></a>
</li>
<li>
<a href="install.php?lang=utf-8-gbk&step=2"><?=$tplang['lang_utf-8-gbk']?></a>
</li>
<li>
<a href="install.php?lang=utf-8-big5&step=2"><?=$tplang['lang_utf-8-big5']?></a>
</li>
</ol>
</div>
<?
echo $tpl_footer;
}
elseif ($step == '2')
{
echo $tpl_header;
?>
<div>
<?=nl2br($tplang['license'])?>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="install.php?lang=<?=$lang?>&step=<?=$step-1?>"><?=$tplang['step_last']?></a>
<a href="install.php?lang=<?=$lang?>&step=<?=$step+1?>"><?=$tplang['step_next']?></a>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
elseif ($step == '3')
{
function filewrite()
{
return (file_exists('../config.inc.php') && is_writable('../config.inc.php')) ? '<span>'.$GLOBALS['tplang']['yes'].'</span>' : '<span>'.$GLOBALS['tplang']['no'].'</span>';
}
function dirwrite($folder)
{
$filename = '../'.$folder.'/index.htm';
$fp = @fopen($filename,'w+');
if (!$fp)
{
return '<span>'.$GLOBALS['tplang']['no'].'</span>';
}
else
{
@fwrite($fp,' ');
fclose($fp);
return '<span>'.$GLOBALS['tplang']['yes'].'</span>';
}
}
echo $tpl_header;
?>
<div>
<ol>
<li>
<?=$tplang['step3_8']?> <?=filewrite()?>
</li>
</ol>
</div>
<div>
<ol>
<li style="list-style:none;padding-left:0px;color:#ff0000; "><?=$tplang['step3_0']?></li>
<li>
<?=$tplang['step3_1']?> <?=dirwrite('upload')?>
</li>
<li>
<?=$tplang['step3_2']?> <?=dirwrite('upload/cards')?>
</li>
<li>
<?=$tplang['step3_3']?> <?=dirwrite('upload/gifts')?>
</li>
<li>
<?=$tplang['step3_4']?> <?=dirwrite('upload/group')?>
</li>
<li>
<?=$tplang['step3_5']?> <?=dirwrite('wespacedata')?>
</li>
<li>
<?=$tplang['step3_6']?> <?=dirwrite('wespacedata/cache')?>
</li>
<li>
<?=$tplang['step3_7']?> <?=dirwrite('wespacedata/template')?>
</li>
</ol>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="install.php?lang=<?=$lang?>&step=<?=$step-1?>"><?=$tplang['step_last']?></a>
<a href="install.php?lang=<?=$lang?>&step=<?=$step+1?>"><?=$tplang['step_next']?></a>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
elseif ($step == '4')
{
function filewrite()
{
return (file_exists('../config.inc.php') && is_writable('../config.inc.php')) ? '<span>'.$GLOBALS['tplang']['yes'].'</span>' : '<span>'.$GLOBALS['tplang']['no'].'</span>';
}
if (!file_exists($configfile))
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step4_0']?>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
else
{
require_once $configfile;
echo $tpl_header;
?>
<div>
<ol>
<li>
<?=$tplang['step3_8']?> <?=filewrite()?>
</li>
</ol>
</div>
<form action="install.php?lang=<?=$lang?>&step=5&submit=1" method="post" name="wane_post">
<table border="0" cellspacing="0" cellpadding="0">
<? foreach ($conf as $key=>$val){?>
<tr>
<td><?=$tplang['step4_'.$key]?></td>
<td><input type="text" name="conf[<?=$key?>]" value="<?=$val?>" /></td>
</tr>
<? }?>
<? foreach ($urlconf as $key=>$val){?>
<tr>
<td><?=$tplang['step4_'.$key]?></td>
<td><input type="text" name="urlconf[<?=$key?>]" value="<?=$val?>" /></td>
</tr>
<? }?>
<tr>
<td colspan="2">
<input type="hidden" name="configsubmit" value="1" />
<input type="button" name="LastStep" value="<?=$tplang['step_last']?>" onclick="location='install.php?lang=<?=$lang?>&step=<?=$step-1?>'" />
<input type="submit" name="Submit" value="<?=$tplang['step_confsave']?>" />
<input type="button" name="Skipit" value="<?=$tplang['step_skip']?>" onclick="location='install.php?lang=<?=$lang?>&step=<?=$step+2?>'" />
</td>
</tr>
</table>
</form>
<?
echo $tpl_footer;
}
}
elseif ($step == '5')
{
require_once WANE_ROOT.'install/query/5.php';
header("location:install.php?lang={$lang}&step=6");
}
elseif ($step == '6')
{
if (!file_exists($configfile))
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step4_0']?>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
else
{
require_once $configfile;
$conn = @mysql_connect($conf['dbserver'],$conf['dbuser'],$conf['dbpass']);
echo $tpl_header;
if (!$conn)
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step6_1_0']?>
</td>
</tr>
</table>
<?
}
else
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step6_1_1']?>
</td>
</tr>
</table>
<?
$sels = @mysql_select_db($conf['dbname'],$conn);
if (!$sels)
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step6_2_0']?>
</td>
</tr>
</table>
<?
}
else
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step6_2_1']?>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="install.php?lang=<?=$lang?>&step=<?=$step-2?>"><?=$tplang['step_last']?></a>
<a href="install.php?lang=<?=$lang?>&step=<?=$step+1?>"><?=$tplang['step_next']?></a>
</td>
</tr>
</table>
<?
}
}
echo $tpl_footer;
}
}
elseif ($step == '7')
{
if (!file_exists($configfile))
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step4_0']?>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
else
{
echo $tpl_header;
$sqlfile = './sql/struct.php';
if (!file_exists($sqlfile))
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step7_0_0']?> (<?=$sqlfile?>)
</td>
</tr>
</table>
<?
}
else
{
$fp = @fopen($sqlfile,'r');
if (!$fp)
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step7_0_1']?> (<?=$sqlfile?>)
</td>
</tr>
</table>
<?
}
else
{
require_once WANE_ROOT.'install/query/7.php';
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step7_1']?>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="install.php?lang=<?=$lang?>&step=<?=$step-1?>"><?=$tplang['step_last']?></a>
<a href="install.php?lang=<?=$lang?>&step=<?=$step+1?>"><?=$tplang['step_next']?></a>
</td>
</tr>
</table>
<?
}
}
echo $tpl_footer;
}
}
elseif ($step >= '8' && $step <= '14')
{
if (!file_exists($configfile))
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step4_0']?>
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
else
{
echo $tpl_header;
$sqlfile = './'.$lang.'/data'.$step.'.php';
if (!file_exists($sqlfile))
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step7_0_0']?> (<?=$sqlfile?>)
</td>
</tr>
</table>
<?
}
else
{
$fp = @fopen($sqlfile,'r');
if (!$fp)
{
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step7_0_1']?> (<?=$sqlfile?>)
</td>
</tr>
</table>
<?
}
else
{
require_once WANE_ROOT.'install/query/8-14.php';
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?=$tplang['step14_1']?>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="install.php?lang=<?=$lang?>&step=<?=$step-1?>"><?=$tplang['step_last']?></a>
<a href="install.php?lang=<?=$lang?>&step=<?=$step+1?>"><?=$tplang['step_next']?></a>
</td>
</tr>
</table>
<?
}
}
echo $tpl_footer;
}
}
elseif ($step == '15')
{
echo $tpl_header;
?>
<form action="install.php?lang=<?=$lang?>&step=<?=$step+1?>&submit=1" method="post" name="wane_post">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?=$tplang['step15_u']?></td>
<td><input type="text" name="username" value="<?=$val?>" /></td>
</tr>
<tr>
<td><?=$tplang['step15_p']?></td>
<td><input type="text" name="password" value="<?=$val?>" /></td>
</tr>
<tr>
<td><?=$tplang['step15_s']?></td>
<td>
<input name="sex" type="radio" value="1" checked /> <?=$tplang['step15_s1']?>
<input name="sex" type="radio" value="2" /> <?=$tplang['step15_s2']?>
</td>
</tr>
<tr>
<td><?=$tplang['step15_e']?></td>
<td><input type="text" name="email" value="<?=$val?>" /></td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="configsubmit" value="1" />
<input type="submit" name="Submit" value="<?=$tplang['step_confsave']?>" />
</td>
</tr>
</table>
</form>
<?
echo $tpl_footer;
}
else
{
$configsubmit = trim($_POST['configsubmit']);
if ($step == '16' && $configsubmit)
{
$magic = @get_magic_quotes_gpc();
function cutempty($varchar)
{
global $magic,$_POST;
$varchar = $magic ? stripslashes($_POST[$varchar]) : $_POST[$varchar];
return addslashes(htmlspecialchars(str_replace(array(" ","n","t","r"),array("","","",""),$varchar)));
}
$username = substr(cutempty('username'),0,15);
$password = cutempty('password');
$email = cutempty('email');
$sex = cutempty('sex');
if (!$username || !$password || !$email || !$sex)
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<br />
<?=$tplang['step15_1_0']?><br /><br />
<a href="install.php?lang=<?=$lang?>&step=<?=$step-1?>"><?=$tplang['step_last']?></a>
<br /> <br />
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
else
{
require_once WANE_ROOT.'install/query/16.php';
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<br />
<?=$tplang['step16_1']?><br /><br />
<a href="../"><?=$tplang['step16_2']?></a>
<br /> <br />
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<br />
<?=$tplang['step15_u']?>:<?=$username?> <br />
<?=$tplang['step15_p']?>:<?=$password?> <br />
<?=$tplang['step15_s']?>:<?=$sex=='1' ? $tplang['step15_s1'] : $tplang['step15_s2']?> <br />
<?=$tplang['step15_e']?>:<?=$email?> <br /><br />
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
}
else
{
echo $tpl_header;
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<br />
<?=$tplang['step16_1']?><br /><br />
<a href="../"><?=$tplang['step16_2']?></a>
<br /> <br />
</td>
</tr>
</table>
<?
echo $tpl_footer;
}
}
?>永久链接:http://www.phprm.com/code/5996ee3bf3a1a45496492e598f1b2d7b.html
转载随意!带上文章地址吧。