⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 install.php

📁 LOVESTUdio多校园交易系统 VER 4.0基于3.0开发
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
error_reporting(7);
set_magic_quotes_runtime(0);
define('LOVESTU', TRUE);

if(!get_magic_quotes_gpc()) {
    $_GET=array_map("addslashes",$_GET);
    $_POST=array_map("addslashes",$_POST);
}

$action = ($_POST['action']) ? $_POST['action'] : $_GET['action'];
$PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];

if(function_exists('set_time_limit') == 1 && @ini_get('safe_mode') == 0) {
   @set_time_limit(1000);
}

require_once './libs/config.inc';

header('Content-Type: text/html; charset=gbk');
$version = '1.2 <b style=\'color: #FF9900\'>lovestu</b>';
function selected($str1,$str2){
   if($str1==$str2)echo ' selected';
}
function creat_table($filename,$dbversion) {
   global $db,$tablepre,$language,$rootpath;
   $installinfo='';
   $sql=file($filename);
   $query='';
   $installtime=time();
   foreach($sql as $key => $value){
      $value=trim($value);
      if(!$value || $value[0]=='#') continue;
      if(eregi("\;$",$value)){
         $query.=$value;
         $query=str_replace('stu_',$tablepre,$query);
         if(eregi("^CREATE",$query)){
            $name=substr($query,13,strpos($query,'(')-13);
            $installinfo.='<span class="r">建立数据表 </span><span class="t">'.$name.'</span> ... <span class="r">完成</span><br>';

            $extra = substr(strrchr($query,')'),1);
            $query = str_replace($extra,'',$query);
            if($dbversion > '4.1'){
               $extra = $language ? "ENGINE=MyISAM DEFAULT CHARSET=$language;" : "ENGINE=MyISAM;";
            } else {
            $extra = "TYPE=MyISAM;";
            }
            $query .= $extra;
         } elseif(eregi("^INSERT",$query)){
            $query=str_replace('/stu',$rootpath,$query);
            $query=str_replace('installtime',$installtime,$query);
         }
         $db->sql_query($query);
         $query='';
      } else {
        $query.=$value;
      }
   }
   return $installinfo;
}
function readover($filename,$method="rb"){
   if($handle=@fopen($filename,$method)){
      flock($handle,LOCK_SH);
      $filedata=@fread($handle,filesize($filename));
      fclose($handle);
   }
   return $filedata;
}
function file_write($file,$content){
   if(@file_exists($file) && !is_writable($file)){
       chmod($file, 0777) or die("Cannot change the mode of file ".$file);
   }
   $fp = @fopen($file, "w") or die("Cannot open file ".$file);
   fwrite($fp,$content) or die("Cannot write to file ".$file);
   fclose($fp) or die("Cannot close file ".$file);
}
?>
<html>
<head>
<title>lovestu Installation</title>
<style type="text/css">
A { TEXT-DECORATION: none;}
a:hover{ text-decoration: underline;}
.t {font-family: Verdana, Arial, Sans-serif;font-size  : 12px;padding-left: 10px;font-weight: normal;color : #333366;}
.r {font-family: Arial, Sans-serif;font-size  : 12px;font-weight: normal;line-height: 200%;color : #0000EE;}
.c {font-family: Arial, Sans-serif;font-size  : 12px;font-weight: normal;line-height: 200%;color : #EE0000;}
.h {font-family: Arial, Sans-serif;padding-top: 5px;padding-left: 10px;font-size  : 20px;font-weight: bold;color : #000000;}
.i {font-family: Arial, Sans-serif;padding-top: 5px;padding-left: 10px;font-size  : 14px;font-weight: bold;color : #000000;}
table {vertical-align: top;background-color: #f0f0f0;}
</style>
<body vlink='#000000' link='#000000' bgcolor='#6A71A3' leftmargin=0 topmargin=5 marginwidth="0" marginheight="0">
<table cellpadding="2" cellspacing="1" width="80%" align="center">
  <tr>
    <td>
      <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td height="30" valign="bottom" class="h">
           <span style="COLOR: #cc0000">&gt;&gt;</span> lovestu Installation
          </td>
        </tr>
        <tr>
          <td>
            <hr align="center" width="99%" size="1" color=#9999cc>
          </td>
        </tr>
        <tr>
          <td class="t">
           欢迎来到 lovestu 安装向导,安装前请仔细阅读 licence 档的每个细节,在您确定可以完全满足 lovestu 的授权协议之后才能开始安装。readme 档提供了有关软件安装的说明,请您同样仔细阅读,以保证安装进程的顺利进行。
          </td>
        </tr>
        <tr>
          <td>
            <hr align="center" width="99%" size="1" color=#9999cc>
          </td>
        </tr>
        <tr>
         <td class='t' valign='top' colspan='2'>
          <b>注意:</b><br>
          <span class='r'>此种状况表示状态正确.</span><br>
          <span class='c'>此种状况表示状态发生错误.</span>
         </td>
        </tr>
        <tr>
          <td>
            <hr align="center" width="99%" size="1" color=#9999cc>
          </td>
        </tr>
<?php

if(!$action){
    $lovestu_licence = readover('licence.txt');
    $lovestu_licence = str_replace('  ', '&nbsp; ', nl2br($lovestu_licence));

?>
        <tr>
         <td class='t' align=center><font color="#0000EE"><b>lovestu 用户许可协议</b></font></td>
        </tr>
        <tr>
         <td class='t'><b><font color="#99ccff">&gt;</font><font color="#000000"> 请您务必仔细阅读下面的许可协议</font></b></td>
        </tr>
        <tr>
          <td class='t'><br>lovestu 软件使用协议<br>
          <?php echo $lovestu_licence?>
          </td>
        </tr>
        <tr>
          <td align="center">
            <br>
            <form method="post" action="<?php echo $PHP_SELF?>">
              <input type="hidden" name="action" value="config">
              <input type="submit" name="submit" value="我同意" style="height: 25">&nbsp;
              <input type="button" name="exit" value="不同意" style="height: 25" onClick="javascript: window.close();">
            </form>
          </td>
        </tr>
<?php

} elseif($action == 'config'){

        $exist_error = FALSE;
        $write_error = FALSE;
        $correct='......<span class="r">OK</span>';
        $incorrect=' <span class="c">777属性检测不通过</span>';
        $uncorrect= ' <span class="c">文件不存在请上传此文件</span>';
        $w_check=array('data/stu.sql','js/demo.php','js/showtag.php','libs/config.inc','pagetag/','upload/shoplogo','upload/goodsimg','upload/');
        $count=count($w_check);
        for($i=0; $i<$count; $i++) {
            if(!file_exists('./'.$w_check[$i])){
                $w_check[$i].= $uncorrect;
                $exist_error=TRUE;
            } elseif(is_writable('./'.$w_check[$i])){
              $w_check[$i].= $correct;
            } else {
              $w_check[$i].=$incorrect;
              $exist_error=TRUE;
            }
        }
?>
        <tr>
         <td class='i' colspan='2' align='left'>
          <span style='color:#CC0000'>&gt;</span> 检查必要目录和文件是否可写,如果发生错误,请更改文件/目录属性 777
         </td>
        </tr>
        <tr>
          <td colspan=2 align=left class='t'>
           <?php foreach($w_check as $tmp)echo $tmp."<br>\n";?>
          </td>
        </tr>
        <tr>
          <td>
            <hr align="center" width="99%" size="1" color=#9999cc>
          </td>
        </tr>
        <tr>
         <td class='i' colspan='2'>
          <span style='color:#CC0000'>&gt;</span> 设置数据库资料与系统根目录
         </td>
        </tr>
<?php
  if(!$exist_error && !$write_error){
      if(dirname($PHP_SELF)!="\\")$path=dirname($PHP_SELF);
      else $path='';
      $getrootpath = "http://".$_SERVER['HTTP_HOST'].$path;
      @include './libs/config.inc';
?>
        <tr>
        <form method="post" action="<?php echo $PHP_SELF?>">
         <td align=center><br>
         <table width="70%" cellspacing=0 cellpadding=1 align=center>
          <tr><td bgcolor='#6A71A3'>
           <table width="100%" cellspacing=1 cellpadding=3 align=center>
            <tr><td class='t' colspan=2 bgcolor='#6A71A3'><font color="#FFFFFF">服务器配置</font></td></tr>
            <tr>
             <td class='t' width='40%'>&nbsp;&nbsp;数据库服务器地址</td>
             <td class='t'><input type='text' name='dbhost' value='<?php echo $dbhost;?>'></td>
            </tr>
            <tr>
             <td class='t'>&nbsp;&nbsp;数据库服务器类型</td>
             <td class='t'>
              <select name='database'>
               <option value='mysql'<?php selected('mysql',$database)?>>mysql</option>
              </select>
             </td>
            </tr>
            <tr>
             <td class='t'>&nbsp;&nbsp;数据库用户名</td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -