フォトアルバムプログラム

WBOY
リリース: 2016-06-21 09:05:52
オリジナル
1610 人が閲覧しました

程序

  • /*
    +---------------------------------------------------+
    | Name : NEATPIC (无数据版本)
    +---------------------------------------------------+
    | Created / Modify : 2003-12-27 / 2004-4-13
    +---------------------------------------------------+
    | Version : 1.2.3
    +---------------------------------------------------+
    | Author : walkerlee, gouki
    +---------------------------------------------------+
    | Powered by NEATSTUDIO 2002 - 2004
    +---------------------------------------------------+
    | QQ : 808075
    | Email : walkerlee@163.net
    | Homepge : http://www.neatstudio.com
    | BBS : http://www.neatstudio.com/bbs/
    +---------------------------------------------------+
    | Note :
    |
    | 1.本软件对于非商业用户完全免费,如果要使用在商业用途
    | 方面,必须取得作者的授权.
    |
    | 2.你可以任意传播以及修改本程序,但不能以任何形式删除
    | 本程序的版权.请记住,保留作者版权是对作者工作的尊敬.
    |
    | 3.如果有问题,可以通过上面提供的方式进行解答,但作者
    | 学业繁重,如果不能及时或者不解答,请谅解.
    |
    | 4.作者对使用该程序导致的问题,不予以负责.
    |
    | 5.本程序版权归 NeatStudio 所有.禁止任何侵权行为!
    |
    +---------------------------------------------------+
    */

    /*
    +----------------------------------+
    | Config
    +----------------------------------+
    | C / M : 2003-12-28 / 2004-4-13
    +----------------------------------+
    */

    $configAdminPass = "neatpic"; //管理员密码 注:安全起见,默认密码不能登陆管理
    $configWantedPass = false; //查看相册是否需要密码 需要:true 不需要:false
    $configOpenGzip = true; //是否压缩页面 压缩:true 不压缩:false
    $configShowPicSize = false; //是否显示图片的大小 (单位:KB) 显示:true 不显示:false (注:不显示,程序运行速度将提高)
    $configExt = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); //图片类型
    $strLenMax = 25; //文件名字限制长度 (防止撑破表格)
    $configEachPageMax = 16; //每页显示的图片数目
    $configEachLineMax = 4; //每行显示的图片数目
    $configTDWidth = 185; //表格宽度
    $configTDHeight = 138; //表格高度
    $configPageMax = 5; //分页前后预览数
    $configDirPasswordFile = "neatpicPassword.php"; //密码文件
    $configTilte = "欢迎光临“开花的草”相册。设有精美小图、动态图片、人物图片、图文并茂、网页横幅、站长相关。"; //标题
    $configVer = "1.2.3"; //程序版本号

    /*
    +----------------------------------+
    | Class
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    Class neatpic
    {
    var $configWantedPass;
    var $configAdminPass;
    var $configOpenGzip;
    var $configShowPicSize;
    var $configExt = array();
    var $strLenMax;
    var $configEachPageMax;
    var $configEachLineMax;
    var $configTDHeight;
    var $configTDWidth;
    var $configPageMax;
    var $configTilte;
    var $configVer;

    var $dirOptionList;
    var $timer;
    var $usedTime;
    var $pathLevelNum;
    var $nowDirNmae;
    var $dirNum;
    var $picNum;
    var $pageTotal;
    var $start;
    var $offSet;
    var $pageStart;
    var $pageMiddle;
    var $pageEnd;
    var $temp;
    var $picID;
    var $picRealSizeWidth;
    var $picRealSizeHeight;

    var $picArray = array();
    var $picFileArray = array();
    var $dirArray = array();
    var $dirNameArray = array();
    var $pathArray = array();
    var $pathError = false;

    var $page;
    var $path;
    var $style;
    var $c;

    /*
    +----------------------------------+
    | Constructor
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function neatpic($configWantedPass, $configAdminPass, $configDirPasswordFile, $configOpenGzip, $configShowPicSize, $configExt, $strLenMax, $configEachPageMax, $configEachLineMax, $configTDHeight, $configTDWidth, $configPageMax, $configTilte, $configVer)
    {
    $this->configWantedPass = & $configWantedPass;
    $this->configAdminPass = & $configAdminPass;
    $this->configDirPasswordFile = & $configDirPasswordFile;
    $this->configOpenGzip = & $configOpenGzip;
    $this->configShowPicSize = & $configShowPicSize;
    $this->configExt = & $configExt;
    $this->strLenMax = & $strLenMax;
    $this->configEachPageMax = & $configEachPageMax;
    $this->configEachLineMax = & $configEachLineMax;
    $this->configTDHeight = & $configTDHeight ;
    $this->configTDWidth = & $configTDWidth;
    $this->configPageMax = & $configPageMax;
    $this->configTilte = & $configTilte;
    $this->configVer = & $configVer;
    }

    /*
    +----------------------------------+
    | Open gzip
    +----------------------------------+
    | C / M : 2003-12-29 / --
    +----------------------------------+
    */

    function gzip()
    {
    if ($this->configOpenGzip == true)
    ob_start("ob_gzhandler");
    }

    /*
    +----------------------------------+
    | Get the querystring
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function getVars()
    {
    $this->page = rawurldecode($_GET['page']);
    $this->path = rawurldecode($_GET['path']);
    $this->style = $_GET['style'];

    if (!$this->style) $this->style = "small";
    if (!$this->path) $this->path = ".";
    }

    /*
    +----------------------------------+
    | Check error
    +----------------------------------+
    | C / M : 2003-12-28 / 2004-1-1
    +----------------------------------+
    */

    function checkError()
    {
    if (preg_match("/\.\./", $this->path)) $pathError = true;
    if (!is_dir($this->path)) $pathError = true;

    if ($pathError == true)
    {
    header("location:".$_SERVER['PHP_SELF']);
    exit;
    }
    }

    /*
    +----------------------------------+
    | Path array initialize
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function pathArrayInitialize()
    {
    if (!$this->path) $this->path = ".";

    $this->pathArray = explode("/", $this->path);
    $this->pathLevelNum = count($this->pathArray);
    $this->nowDirName = $this->pathArray[$this->pathLevelNum - 1];
    if ($this->nowDirName == ".") $this->nowDirName = "根目录";
    }

    /*
    +----------------------------------+
    | Timer
    +----------------------------------+
    | C / M : 2003-12-29 / --
    +----------------------------------+
    */

    function timer()
    {
    $time = explode( " ", microtime());
    $usec = (double)$time[0];
    $sec = (double)$time[1];
    $this->timer = $usec + $sec;
    }

    /*
    +----------------------------------+
    | Show used time
    +----------------------------------+
    | C / M : 2003-12-29 / --
    +----------------------------------+
    */

    function usedTime()
    {
    $startTime = $this->timer;
    $this->timer();
    $endTime = $this->timer;
    $usedTime = $endTime - $startTime;
    $this->usedTime = sprintf("%0.4f", $usedTime);
    }

    /*
    +----------------------------------+
    | Make over direct
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function makeOverdirect()
    {
    $overPath = ".";

    for($i = 1; $i < $this->pathLevelNum - 1; $i++)
    {
    $overPath = $overPath."/".$this->pathArray[$i];
    }

    $this->dirArray[] = $overPath;
    $this->dirNameArray[] = "上级目录";

    for($i = 1; $i < $this->pathLevelNum; $i++)
    {
    $this->encodePath .= rawurlencode($this->pathArray[$i])."/";
    }
    }

    /*
    +----------------------------------+
    | GetFileExt
    +----------------------------------+
    | C / M : 2003-12-28 / --
    +----------------------------------+
    */

    function getFileExt($fileName)
    {
    $pos = strrpos($fileName, '.');
    return strtolower(substr($fileName, $pos+1, (strlen($fileName)-$pos-1)));
    }

    /*
    +----------------------------------+
    | Make direct list
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function makeDirList()
    {
    $dir = dir($this->path);

    while($file = $dir->read())
    {
    if ($file <> "." and $file <> "..")
    {
    $fileName = $file;
    $file = $this->path."/".$file;

    if (is_dir($file))
    {
    $this->dirArray[] = $file;
    $this->dirNameArray[] = $fileName;
    }

    if (in_array($this->getFileExt($file), $this->configExt))
    {
    $this->picEncodeArray[] = "./" . $this->encodePath . rawurlencode($fileName);
    $this->picArray[] = $file;
    $this->picFileArray[] = $fileName;
    }
    }
    }

    }

    /*
    +----------------------------------+
    | Get each array number
    +----------------------------------+
    | C / M : 2003-12-28 / --
    +----------------------------------+
    */

    function getEachArrayNum()
    {
    $this->dirNum = count($this->dirArray);
    $this->picNum = count($this->picArray);
    }

    /*
    +----------------------------------+
    | Make page bar
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function makePageBar()
    {

    $this->pageTotal = ceil($this->picNum / $this->configEachPageMax);

    if (!$this->page or $this->page < 0) $this->page = 1;
    if ($this->page > $this->pageTotal) $this->page = $this->pageTotal;

    $this->offSet = $this->configEachPageMax * $this->page;
    $this->start = $this->offSet - $this->configEachPageMax;

    if ($this->start < 0) $this->start = 0;
    if ($this->offSet > $this->picNum) $this->offSet = $this->picNum;

    $this->pageStart = $this->page - $this->configPageMax;
    if ($this->pageStart <= 0) $this->pageStart = 1;

    $this->pageMiddle = $this->page + 1;
    $this->pageEnd = $this->pageMiddle + $this->configPageMax;

    if ($this->page <= $this->configPageMax) $this->pageEnd = $this->configPageMax * 2 + 1;
    if ($this->pageEnd > $this->pageTotal) $this->pageEnd = $this->pageTotal + 1;
    }

    /*
    +----------------------------------+
    | Show page bar
    +----------------------------------+
    | C / M : 2003-12-28 / 2003-12-29
    +----------------------------------+
    */

    function showPageBar()
    {
    print("

    \n");
    print("
    ");
    print("[ path)."&style=".$this->style."&page=".($this->page - 1)."\" title=\"上一页\">上一页] ");

    print(" path)."&style=".$this->style."&page=1\" title=\"首页\"><<\n");

    for ($i = $this->pageStart; $i < $this->page; $i++)
    print("path)."&style=".$this->style."&page=".$i."\" title=\"第 ".$i." 页\">[".$i."]");

    printf("[%s]", $this->page);

    for ($i = $this->pageMiddle; $i < $this->pageEnd; $i++)
    print("path)."&style=".$this->style."&page=".$i."\" title=\"第 ".$i." 页\">[".$i."]");

    print("...path)."&style=".$this->style."&page=".$this->pageTotal."\" title=\"第 " . $this->pageTotal . " 页\">[" . $this->pageTotal . "]\n");

    print("path)."&style=".$this->style."&page=".$this->pageTotal."\" title=\"尾页\">>>\n");

    print("[path)."&style=".$this->style."&page=".($this->page + 1)."\" title=\"下一页\">下一页] 共".$this->pageTotal."页 当前所在第".$this->page."页");
    print("

    ");
    print("

    \n");
    }

    /*
    +----------------------------------+
    | Set picture ID
    +----------------------------------+
    | C / M : 2003-12-28 / --
    +----------------------------------+
    */

    function setPicID($id)
    {
    $this->picID = $id;
    }

    /*
    +----------------------------------+
    | Get picture dimension
    +----------------------------------+
    | C / M : 2003-12-28 / --
    +----------------------------------+
    */

    function getPicDim()
    {

    $picSize = GetImageSize($this->picArray[$this->picID]);
    preg_match("!width=\"(.*)\" height=\"(.*)\"!", $picSize['3'], $tempSize);

    $this->picRealSizeWidth = $tempSize['1'];
    $this->picRealSizeHeight = $tempSize['2'];

    /*
    $tempSize['1'] < $this->configTDWidth ? $this->temp['Width'] = $tempSize['1'] : $this->temp['Width'] = $this->configTDWidth;
    $tempSize['2'] < $this->configTDHeight ? $this->temp['Height'] = $tempSize['2'] : $this->temp['Height'] = $this->configTDHeight;
    */

    $tWidth = $this->picRealSizeWidth / $this->configTDWidth;
    $tHeight = $this->picRealSizeHeight / $this->configTDHeight;

    if ($this->picRealSizeWidth > $this->configTDWidth OR $this->picRealSizeHeight > $this->configTDHeight)
    {
    if ($tWidth > $tHeight)
    {
    $this->temp['Width'] = $this->configTDWidth;
    $this->temp['Height'] = number_format($this->picRealSizeHeight / $tWidth);
    }
    elseif ($tWidth < $tHeight)
    {
    $this->temp['Height'] = $this->configTDHeight;
    $this->temp['Width'] = number_format($this->picRealSizeWidth / $tHeight);
    }
    else
    {
    $this->temp['Width'] = $this->configTDWidth;
    $this->temp['Height'] = $this->configTDHeight;
    }
    }
    else
    {
    $this->temp['Width'] = $this->picRealSizeWidth;
    $this->temp['Height'] = $this->picRealSizeHeight;
    }
    }
    /*
    +----------------------------------+
    | Show the title javascript
    +----------------------------------+
    | C / M : 2003-12-29 / 2003-12-30
    +----------------------------------+
    */

    function ShowJS()
    {
    print('

    ');
    }

    /*
    +----------------------------------+
    | Show css
    +----------------------------------+
    | C / M : 2003-12-28 / --
    +----------------------------------+
    */

    function showCSS()
    {
    print("

    ");
    }

    /*
    +----------------------------------+
    | Show title
    +----------------------------------+
    | C / M : 2003-12-28 / --
    +----------------------------------+
    */

    function showTitle()
    {
    print(" \n");
    print("".$this->configTilte."\n");
    print("\n");
    print("\n");
    print("
    \n");
    print("

    \n");
    print($this->configTilte);
    print("
    \n");
    print("

    \n");
    }

    /*
    +----------------------------------+
    | Show state
    +----------------------------------+
    | C / M : 2003-12-28 / 2004-4-9
    +----------------------------------+
    */

    function showState()
    {
    print("

    \n");
    print("





    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("
    \n");
    print("
    当前目录 : ".$this->nowDirName."[ 子目录数 : ". ($this->dirNum - 1) ."图片数目 : ".$this->picNum."每页显示 : ".$this->configEachPageMax."个 ] 查看模式: [ path)."&style=real&page=".$this->page."\">真实] [ path)."&style=small&page=".$this->page."\">缩略]
    ");
    print("
    \n");
    print("
    \n");
    }

    /*
    +----------------------------------+
    | Make option direct list
    +----------------------------------+
    | C / M : 2004-3-24 / -- --
    +----------------------------------+
    */

    function makeOptionList()
    {
    $this->dirOptionList = "path) . "\">");

    /*
    +----------------------------------+
    | Real size style
    +----------------------------------+
    */

    $session = & $_SESSION;

    if ($this->style == "real")
    {

    print("

    \n");

    for($i = $this->start; $i < $this->offSet; $i++)
    {
    $this->setPicID($i);
    $this->getPicDim();

    /*
    +----------------------------------+
    | Read and format this picture's size
    +----------------------------------+
    */

    $this->configShowPicSize == true ? $picFileSize = sprintf("%0.2f", filesize($this->picArray[$i]) / 1024) : $picFileSize = " -- ";

    if ($session['neatpicLogined'])
    print("
    picFileArray[$i] . "\" title=\"删除图片" . $this->picFileArray[$i] . "\"> ");

    printf("返回顶部#%s %s %s × %s %s KB

    \n",($i + 1), $this->picFileArray[$i], $this->picRealSizeWidth, $this->picRealSizeHeight, $picFileSize);
    printf("

    \n", $this->picEncodeArray[$i], $this->picEncodeArray[$i]);
    }

    print("

    \n");

    }
    /*
    +----------------------------------+
    | Small size style
    +----------------------------------+
    */
    else
    {
    print("
    \n");
    printf("


    $this->setPicID($i);
    $this->getPicDim();

    /*
    +----------------------------------+
    | Read and format this picture's size
    +----------------------------------+
    */

    $this->configShowPicSize == false ? $picFileSize = " -- " : $picFileSize = sprintf("%0.2f", filesize($this->picArray[$i]) / 1024);

    print("









    \n");for($i = $this->start; $i < $this->offSet; $i++){$I++; \n");if ($this->configEachLineMax == $I){$I = 0;print(" \n");}}print(" \n
    \n");
    print("







    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("
    " . $this->sortName($this->picFileArray[$i]) . "
    configTDWidth . "\" height=\"" . $this->configTDHeight . "\" style=\"border: 0px solid #CCCCCC\" colspan=\"3\">
    picEncodeArray[$i] . "\" target=\"_blank\">picEncodeArray[$i] . "\" BORDER=\"0\" width=\"" . $this->temp['Width'] . "\" height=\"" . $this->temp['Height'] . "\" ALT=\"文件 :" . $this->picFileArray[$i] . "
    尺寸 :" . $this->picRealSizeWidth . " × " . $this->picRealSizeHeight . "像素
    格式 :" . $this->getFileExt($this->picFileArray[$i]) . "
    大小 :" . $picFileSize . "KB \">
    ");

    if ($session['neatpicLogined'])
    print("picFileArray[$i] . "\" title=\"删除图片" . $this->picFileArray[$i] . "\">");

    print("

    " . $this->picRealSizeWidth . " × " . $this->picRealSizeHeight . "
    " . $picFileSize . " KB
    \n");
    print("
    返回顶部
    \n");
    print("
    \n");
    }

    print("\n");
    }

    /*
    +----------------------------------+
    | Show config state
    +----------------------------------+
    | C / M : 2003-12-29 / --
    +----------------------------------+
    */

    function showConfigState()
    {
    $this->configOpenGzip == true ? $openGzip = "开启" : $openGzip = "关闭";
    $this->configShowPicSize == true ? $showPicSize = "开启" : $showPicSize = "关闭";
    $this->configWantedPass == true ? $showWantedPass = "开启" : $showWantedPass = "关闭";

    print("

    \n");
    print("






    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("
    \n");
    printf("
    当前设置: 压缩页面 : %s显示图片大小 : %s登录认证 : %s[ NEATPIC 帮助]\n", $openGzip, $showPicSize, $showWantedPass);
    print("
    ");
    printf("
    管理登陆
    ", $_SERVER['PHP_SELF'], rawurlencode($this->path));
    print("
    \n");
    print("
    \n");
    printf($this->decode("UG93ZXJlZCBieSA8QSBIUkVGPSJodHRwOi8vd3d3Lm5lYXRzdHVkaW8uY29tIiBUQVJHRVQ9Il9ibGFuayI%2BTkVBVFBJQyhQSFAgxL%2FCvNaxtsGw5ik8L0E%2BIFZlcnNpb24mbmJzcDs6Jm5ic3A7JXMgJm5ic3A7UHJvY2Vzc2VkIGluICVzIHNlYzxCUj4NCkNvcHlyaWdodCBOZWF0U3R1ZGlvIDIwMDItMjAwNCA8QlI%2BDQo%3D"), $this->configVer, $this->usedTime);
    print("

    \n");
    print("
    \n");

    }

    /*
    +----------------------------------+
    | Show login window
    +----------------------------------+
    | C / M : 2003-12-29 / 2004-3-26
    +----------------------------------+
    */

    function showLogin()
    {
    print("

    \n");

    print("







    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("
    \n");
    print("
    登陆验证
    ");
    print("
    \n");

    print("







    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("
    \n");
    print("

    \n
    登录密码 : \n


    \n
    ");
    print("
    \n");
    print("
    \n");
    }

    /*
    +----------------------------------+
    | Show Admincp
    +----------------------------------+
    | C / M : 2003-12-29 / 2004-4-2
    +----------------------------------+
    */

    function showAdmincp()
    {
    $session = & $_SESSION;
    if ($session['neatpicLogined'] == true)
    {
    print("

    \n");
    print("





    print("




    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("\n"); \n");print(" \n");print(" \n");print("
    \n");
    print("
    管理选项
    ");
    print("
    \n");
    if (is_writeable($this->path))
    print("path) . "\">" . $this->nowDirName . "目录\">");
    else
    printf("无法上传图片 目录%s不可写", $this->nowDirName);
    print("
    \n");
    print("
    删除图片| path) . "\">目录密码| path) . "\">退出相册
    ");
    print("
    \n");
    print("
    \n");
    }
    }


    /*
    +----------------------------------+
    | del selected file
    +----------------------------------+
    | C / M : 2004-4-2 / --
    +----------------------------------+
    */

    function delFile()
    {
    if ($_GET['action'] == 'del')
    {
    $session = & $_SESSION;

    if ($session['neatpicLogined'])
    {
    $path = rawurldecode($_POST['path']);
    $delFile = & $_POST['delfile'];

    foreach($delFile as $file)
    {
    unlink($path . "/" . $file);
    }

    header("location:" . $_SERVER['PHP_SELF'] . "?path=" . $_POST['path'] . "&style=" . $_GET['style'] . "&page=" . $_GET['page']);
    }
    }
    }

    /*
    +----------------------------------+
    | show upload
    +----------------------------------+
    | C / M : 2004-3-26 / --
    +----------------------------------+
    */

    function showUpload()
    {
    if ($_GET['action'] == 'upload')
    {
    $this->timer();
    $this->showCSS();
    $this->showTitle();
    $this->upload();
    $this->usedTime();
    $this->showConfigState();

    exit;
    }
    }

    /*
    +----------------------------------+
    | upload image
    +----------------------------------+
    | C / M : 2004-3-26 / --
    +----------------------------------+
    */

    function upload()
    {

    $session = & $_SESSION;

    if ($session['neatpicLogined'])
    {
    $path = rawurldecode($_POST['path']);
    $tmpPath = explode('/', $path);
    $tmpPathLevel = count($tmpPath);

    for ($i = 1; $i < $tmpPathLevel; $i++)
    $decodePath .= rawurlencode($tmpPath[$i]) . "/";

    $uploadFile = $_FILES['image']['name'];

    if (file_exists($path . "/" . $uploadFile))
    $uploadFile = date('is') . $_FILES['image']['name'];

    $imgType = $this->getFileExt($_FILES['image']['name']);

    if (!in_array($imgType, $this->configExt)) $this->error('文件类型非法!');

    if (!copy($_FILES['image']['tmp_name'], $path . "/" . $uploadFile)) $this->error('文件上传发生错误!');

    print("

    \n");
    print("











    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("
    \n");
    print("
    文件上传成功
    ");
    print("
    \n");
    printf("

    文件名%s 文件大小%s KB 文件类型%s



    ", $uploadFile, sprintf("%0.2f", $_FILES['image']['size'] / 1024), $imgType, $decodePath, rawurlencode($uploadFile));
    print("
    \n");
    printf("
    [ 查看上传图片| 返回当前目录]
    ", $decodePath, rawurlencode($uploadFile), $_SERVER['PHP_SELF'], $_POST['path']);
    print("
    \n");
    print("
    \n");
    }
    }

    /*
    +----------------------------------+
    | upload more image
    +----------------------------------+
    | C / M : 2004-4-5 / --
    +----------------------------------+
    */

    function uploadMore()
    {
    if ($_GET['action'] == 'uploadmore')
    {
    $this->timer();
    $this->showCSS();
    $this->showTitle();
    $this->ShowJS();

    if($_GET['do'] == 'yes')
    {
    set_time_limit(0);

    $path = rawurldecode($_GET['path']);
    $tmpPath = explode('/', $path);
    $tmpPathLevel = count($tmpPath);

    for ($i = 1; $i < $tmpPathLevel; $i++)
    $decodePath .= rawurlencode($tmpPath[$i]) . "/";

    $picNum = count($_FILES['images']['tmp_name']);

    for($i = 0; $i < $picNum; $i++)
    {
    if($_FILES['images']['tmp_name'][$i])
    {
    $uploadFile = $_FILES['images']['name'][$i];
    if (file_exists($path . "/" . $uploadFile))
    $uploadFile = date('is') . $_FILES['images']['name'][$i];

    , ; $imgType = $this->getFileExt($_FILES['images']['name'][$i]);

    if (!in_array($imgType, $this->configExt)) $this->error("文件类型非法! 图片编号:[" . ($i + 1) . "]");

    if (!copy($_FILES['images']['tmp_name'][$i], $path . "/" . $uploadFile)) $this->error("文件上传发生错误! 图片编号:[" . ($i + 1) . "]");

    $uploadFileArray[] = $uploadFile;
    $imgTypeArray[] = $imgType;
    $imgSizeArray[] = sprintf("%0.2f", $_FILES['images']['size'][$i] / 1024);

    }
    }
    print("

    \n");
    print("



    for($i = 0; $i < count($uploadFileArray); $i++)
    {
    print("







    print("


    \n");print(" \n");print(" \n");print(" \n");print(" \n"); \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");} \n");print("
    \n");
    print("
    文件批量上传成功
    ");
    print("
    \n");
    printf("

    #" . ($i + 1) . " 文件名%s 文件大小%s KB 文件类型%s



    ", $uploadFileArray[$i], $imgSizeArray[$i], $imgTypeArray[$i], $decodePath, rawurlencode($uploadFileArray[$i]));
    print("
    \n");
    printf("
    [ 查看上传图片| 返回当前目录]
    ", $decodePath, rawurlencode($uploadFileArray[$i]), $_SERVER['PHP_SELF'], rawurlencode($_GET['path']));
    print("
    \n");
    print("
    \n");
    }
    else
    {
    ($_POST['uploadnum']) ? $num = & $_POST['uploadnum'] : $num = 5;

    print("
    \n");
    print("


















    \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print(" \n");print("\n");print(" \n");print(" \n");print(" \n");print(" \n");print("\n");print(" \n");print(" \n");print("
    \n");
    print("
    批量上传图片
    ");
    print("

    \n");

    for ($i = 1; $i <= $num; $i++)
    print("#" . $i . "
    \n");

    print("

    \n");
    print("
    ");
    print("
    \n");
    print("重新设定要批量上传的图片数量: 我要一次性上传张图片\n");
    print("
    \n");
    print("
    \n");
    }

    $this->usedTime();
    $this->showConfigState();

    exit;
    }
    }

    /*
    +----------------------------------+
    | Decode
    +----------------------------------+
    | C / M : 2003-12-30 / --
    +----------------------------------+
    */

    function decode($str)
    {
    $str = rawurldecode($str);
    $str = base64_decode($str);

    $this->c = true;

    return $str;
    }

    function c()
    {
    if(!$this->c)
    header($this->decode("bG9jYXRpb246aHR0cDovL3d3dy5uZWF0c3R1ZGlvLmNvbQ%3D%3D"));
    }

    /*
    +----------------------------------+
    | Show if config wanted password
    +----------------------------------+
    | C / M : 2003-12-29 / --
    +----------------------------------+
    */

    function showWantPass()
    {
    if ($this->configWantedPass == true OR $_GET['action'] == 'login' OR $_GET['action'] == 'loginout' OR $_POST['login'] == 'login')
    {
    $session = & $_SESSION;

    if ($_GET['action'] == 'loginout')
    {
    if (!$session['neatpicLogined'])
    {
    if ($_POST['password'] == $this->configAdminPass AND $this->configAdminPass != "neatpic") $session['neatpicLogined'] = true;
    }
    else
    {
    $session['neatpicLogined'] = "";
    }

    ($_POST['path']) ? $path = $_POST['path'] : $path = $_GET['path'];
    header("location:".$_SERVER['PHP_SELF']."?path=" . rawurlencode($path));
    exit;
    }

    if (!$session['neatpicLogined'])
    {

    $this->timer();
    $this->showCSS();
    $this->showTitle();
    $this->showLogin();
    $this->usedTime();
    $this->showConfigState();

    exit;
    }
    }
    }

    /*
    +----------------------------------+
    | config dir password
    +----------------------------------+
    | C / M : 2004-3-27 / -- --
    +----------------------------------+
    */

    function configDirPass()
    {
    if ($_GET['action'] == 'cfgdirpass')
    {
    $session = & $_SESSION;

    if ($_GET['do'] AND $session['neatpicLogined'])
    {
    if (file_exists(rawurldecode($_POST['path']) . "/" . $this->configDirPasswordFile))
    {
    $password = file(rawurldecode($_POST['path']) . "/" . $this->configDirPasswordFile);
    list(, $password) = explode('|', chop($password[0]));

    if (md5($_POST['oldpassword']) != $password)
    $this->error("旧密码不匹配");
    }

    if ($_POST['newpassword'] != $_POST['checkpassword'])
    $this->error("两次密码输入不匹配");

    if (!$_POST['newpassword'])
    unlink(rawurldecode($_POST['path']) . "/" . $this->configDirPasswordFile);
    else
    {
    if (!is_writeable(rawurldecode($_POST['path']) . "/"))
    $this->error("要设置访问的目录不可写!请先设置其属性为777.");

    $fp = fopen(rawurldecode($_POST['path']) . "/" . $this->configDirPasswordFile, "w+");
    fwrite($fp, " |" . md5($_POST['newpassword']));
    fclose($fp);
    }

    header("location:".$_SERVER['PHP_SELF']."?path=" . $_POST['path']);
    }
    else
    {
    $this->timer();
    $this ->showCSS();
    $this->showTitle();
    $this->ShowJS();

    print("

    n");
    print("








    n");print(" n");print(" n");print(" n");print(" n");print(" n");print(" n");print(" n");print(" n");print("
    n");
    print("
    目录访问密码设置
    ");
    print("
    n");
    print("

    n
    旧版の秘密 :


    新しい暗号 : < ;INPUT TYPE="password" NAME="newpassword" title="输入新的目录密码 ">


    确认密码 :


    n

    n
    ");
    print("
    n");
    print("
    n");

    $this->usedTime();
    $this- >showConfigState();

    exit;
    }
    }
    }

    /*
    +---------------------------- ------+
    | ディレクトリのパスワードの確認
    +---------------------------------+
    | C / M : 2004-3-27 / -- --
    +--------------------------------- -+
    */

    function CheckingDirPass()
    {
    if ($_GET['action'] == 'checkdirpass')
    {
    $session = & $_SESSION;

    $password = file(rawurldecode($_POST) ['パス']) . "/" . $this->configDirPasswordFile);
    list(, $password) =explode('|', Chop($password[0]));

    if ($password = = md5($_POST['パスワード']))
    $sess

  • 関連ラベル:
    ソース:php.cn
    このウェブサイトの声明
    この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
    著者別の最新記事
    人気のおすすめ
      人気のチュートリアル
      詳細>
      最新のダウンロード
      詳細>
      ウェブエフェクト
      公式サイト
      サイト素材
      フロントエンドテンプレート
      私たちについて 免責事項 Sitemap
      PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!