📄 install.php
字号:
<td colspan="2">这一项需要你键入你的数据库信息。如果有疑问,在请求支持前先与你的主机提供商联系。</td> </tr> <tr bgcolor="#E4EAF2"> <td width="45%"><b>数据库服务器:</b><br>一般为localhost</td> <td><input type="text" name="dbhost" value="<?=$dbhost?>" size="70" disable></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据库用户名:</td> <td><input type="text" name="dbuser" value="<?=$dbuser?>" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据库密码:</td> <td><input type="text" name="dbpw" value="<?=$dbpw?>" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据库名称:</td> <td><input type="text" name="dbname" value="<?=$dbname?>" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>系统 Email:</b><br>数据库错误将发送到这个邮箱</td> <td><input type="text" name="adminemail" value="<?=$adminemail?>" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据表前缀:</b><br>在同一个数据库中安装多个 VITCIE 时请修改</td> <td><input type="text" name="tablepre" value="<?=$tablepre?>" size="70"></td> </tr> </table> </td></tr></table><br> <? } else { @include './config.php';?> <tr class=category> <td colspan=2>文件 ./config.php 没有写入权限,请确认以下参数是否正确,可以在本地修改后再上传!</td> </tr> <tr bgcolor="#E4EAF2"> <td width="45%"><b>数据库服务器:</b><br>一般为localhost</td> <td><?=$dbhost?></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据库用户名:</td> <td><?=$dbuser?></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据库密码:</td> <td><?=$dbpw?></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据库名称:</td> <td><?=$dbname?></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>系统 Email:</b><br>数据库错误将发送到这个邮箱</td> <td><?=$adminemail?></td> </tr> <tr bgcolor="#E4EAF2"> <td><b>数据表前缀:</b><br>在同一个数据库中安装多个 VITCIE 时请修改</td> <td><?=$tablepre?></td> </tr> </table> </td> </tr></table><? }}?><br><table id="singleframe" cellspacing="0" cellpadding="0" border="0" width="80%" align=center><tr bgcolor="#ffffff"><td> <table border="0" cellspacing="1" cellpadding="7" width="100%"> <tr class="header"> <td colspan=2>您的管理帐户</td> </tr> <tr class=category> <td colspan=2>此信息用来创建你的第一个管理帐户。请谨记你输入的信息!</td> </tr> <tr bgcolor="#E4EAF2"> <td width="45%"><b>用户名称:</td> <td><input type="input" name="username" value="yourname" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td width="45%"><b>用户密码:</td> <td><input type="password" name="password1" value="" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td width="45%"><b>确认密码:</td> <td><input type="password" name="password2" value="" size="70"></td> </tr> <tr bgcolor="#E4EAF2"> <td width="45%"><b>EMAIL 地址:</td> <td><input type="input" name="email" value="yourname@domain.com" size="70"></td> </tr> </table> </td></tr></table> <br> <center> <input type="hidden" name="action" value="updatesql"> <input type="hidden" name="saveconfig" value="<?=$saveconfig?>"> <input type="submit" name="submit" value="继续 下一步" style="height: 25"> <input type="button" name="exit" value="退出安装向导" style="height: 25" onclick="javascript: window.close();"> </form> </center><?} elseif($action == 'updatesql') { $username = $HTTP_POST_VARS['username']; $email = $HTTP_POST_VARS['email']; $password1 = $HTTP_POST_VARS['password1']; $password2 = $HTTP_POST_VARS['password2']; if($username && $email && $password1 && $password2) { if($password1 != $password2) { showmessage("两次输入密码不一致."); } elseif(strlen($username) > 15) { showmessage("用户名超过 15 个字符限制."); } elseif(preg_match("/^$|^c:\\con\\con$| |[,\"\s\t\<\>]|^游客|^Guest/is", $username)) { showmessage("用户名空或包含非法字符."); } elseif(!strstr($email, '@') || $email != stripslashes($email) || $email != htmlspecialchars($email)) { showmessage("Email 地址无效"); } } else { showmessage('您的信息没有填写完整.'); } if($HTTP_POST_VARS['saveconfig'] && is_writeable('./config.php')) { $dbhost = $HTTP_POST_VARS['dbhost']; $dbuser = $HTTP_POST_VARS['dbuser']; $dbpw = $HTTP_POST_VARS['dbpw']; $dbname = $HTTP_POST_VARS['dbname']; $adminemail = $HTTP_POST_VARS['adminemail']; $tablepre = $HTTP_POST_VARS['tablepre']; $fp = fopen('./config.php', 'r'); $configfile = fread($fp, filesize('./config.php')); fclose($fp); $configfile = preg_replace("/[$]dbhost\s*\=\s*[\"'].*?[\"']/is", "\$dbhost = '$dbhost'", $configfile); $configfile = preg_replace("/[$]dbuser\s*\=\s*[\"'].*?[\"']/is", "\$dbuser = '$dbuser'", $configfile); $configfile = preg_replace("/[$]dbpw\s*\=\s*[\"'].*?[\"']/is", "\$dbpw = '$dbpw'", $configfile); $configfile = preg_replace("/[$]dbname\s*\=\s*[\"'].*?[\"']/is", "\$dbname = '$dbname'", $configfile); $configfile = preg_replace("/[$]adminemail\s*\=\s*[\"'].*?[\"']/is", "\$adminemail = '$adminemail'", $configfile); $configfile = preg_replace("/[$]tablepre\s*\=\s*[\"'].*?[\"']/is", "\$tablepre = '$tablepre'", $configfile); $fp = fopen('./config.php', 'w'); fwrite($fp, trim($configfile)); fclose($fp); } include './config.php'; include './include/db_'.$database.'.php'; $db = new dbstuff; $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect); $quit = FALSE; $curr_os = PHP_OS; $query = $db->query("SELECT VERSION()"); $curr_mysql_version = $db->result($query, 0); $curr_disk_space = intval(diskfreespace('.') / (1024 * 1024)).'M'; $db->select_db($dbname); if($db->error()) { $db->query("CREATE DATABASE $dbname"); if($db->error()) { showmessage("指定的数据库 $dbname 不存在, 系统也无法自动建立, 无法安装 VITCIE."); $quit = TRUE; } else { $db->select_db($dbname); $cre_database_msg = "<li><font color=red>指定的数据库 $dbname 不存在, 但系统已成功建立, 可以继续安装.</font></li>"; } } $query - $db->query("SELECT COUNT(*) FROM $tablepre"."settings", 1); if(!$db->error()) { $cre_database_msg = "<li><font color=red>数据库中已经安装过 VITCIE, 安装向导会清空原有数据.</font></li>"; } if($quit) { showmessage("由于您目录属性或服务器配置原因, 无法继续安装 VITCIE, 请仔细阅读安装说明."); } $fp = fopen('./install/sql/cn_all_1.2.sql', 'r'); $sql = fread($fp, filesize('./install/sql/cn_all_1.2.sql')); fclose($fp); ?><br><table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center"> <tr> <td> <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td><br><b>Mysql 服务器信息:</b> <br> <br> <li>Mysql 版本为 <?=$curr_mysql_version?></li> <li>Mysql 可用空间为 <?=$curr_disk_space?></li> <?=$cre_database_msg?> <br> <br> <b>正在安装数据表:</b> <br> <br><?runquery($sql);$password=md5($password1);$timestamp=time();$sqlstr="insert into $tablepre"."members(username,password,status,regdate,email) VALUES('$username','$password', 'Admin', $timestamp,'$email')";$query - $db->query($sqlstr,1);if($db->error()) showmessage("安装管理用户出现错误:".$sqlstr);?> </td> </tr> <tr> <td align="center"> <br> <form method="post" action="<?=$PHP_SELF?>"> <input type="hidden" name="action" value="end"> <input type="hidden" name="username" value="<?=$username?>"> <input type="hidden" name="password" value="<?=$password1?>"> <input type="submit" name="submit" value="完成全部安装" style="height: 25"> </form> </td> </tr> </table> </td> </tr> </table> <?} elseif($action == 'end') { dir_clear('./tempdata/templates');?> <br> <table id=warning cellspacing=0 cellpadding=8 border=0 width=80% align=center> <tr bgcolor=#FFE0E0><td> <font color=red size=2><b>恭喜您,VITCIE 成功完成安装!</b></font><br><br> <b>请记住如下信息:</b><br> 用户名称:<?=$username?> 用户密码:<?=$password?><br><br> <b>为安全起见,请将安装脚本 ./install.php 删除!</b><br> <a href='index.php'>点击进入首页</a> </td></tr></table><?exit;}?><br><table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center"> <tr> <td> <hr noshade align="center" width="100%" size="1"> </td> </tr> <tr> <td align="center"> <b style="font-size: 11px">Powered by <a href="http://www.vitci.com" target="_blank">VITCIE <?=$version?></a> , Copyright © <a href="http://www.vitci.com" target=\"_blank\">Vitci Studio</a>, 2004</b> </td> </tr></table><br></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -