|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
PHP和HTML混合编程应该不成问题,在这期间,你完全可以让PHP给你算算 一加一等于几,然后在浏览器输出,不要觉得幼稚,这的确是跟阿波罗登月一样,你打的是一小段代码,但是对于你的编程之路,可是迈出了一大步啊!兴奋吧?但是不得不再给你泼点冷水,您还是菜鸟一个。法式 <LI class=content id=pre_1152967462><?php
/*
+---------------------------------------------------+
| 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("<center>\n");
print("<BR>");
print("[ <A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=".($this->page - 1)."\" title=\"上一页\">上一页</A> ] ");
print("<A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=1\" title=\"首页\"><< </A>\n");
for ($i = $this->pageStart; $i < $this->page; $i++)
print("<A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=".$i."\" title=\"第 ".$i." 页\">[".$i."]</A> ");
printf("[<FONT COLOR=\"red\"><B>%s</B></FONT>]", $this->page);
for ($i = $this->pageMiddle; $i < $this->pageEnd; $i++)
print("<A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=".$i."\" title=\"第 ".$i." 页\">[".$i."]</A> ");
print("...<A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=".$this->pageTotal."\" title=\"第 " . $this->pageTotal . " 页\">[" . $this->pageTotal . "]</A>\n");
print(" <A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=".$this->pageTotal."\" title=\"尾页\">>></A>\n");
print("[ <A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=".$this->style."&page=".($this->page + 1)."\" title=\"下一页\">下一页</A> ] 共 <B><FONT COLOR=\"red\">".$this->pageTotal."</FONT></B> 页 以后地点第 <B><FONT COLOR=\"red\">".$this->page."</FONT></B> 页");
print("<BR><BR>");
print("</center>\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('
<script>
/******************************************************************************
NEATPIC Show Title
Modified by: walkerlee
Date: 2003-12-30
Based upon: Crossday Studio and http://www.cnzzz.com
*******************************************************************************/
tPopWait=20;
showPopStep=10;
popOpacity=85;
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;
document.write("<style type=\'text/CSS\'id=\'defaultPopStyle\'>");
document.write(".cPopText { font-family: Verdana, Tahoma; background-color: #F7F7F7; border: 1px #000000 solid; font-size: 11px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id=\'popLayer\' style=\'position:absolute;z-index:1000;\' class=\'cPopText\'></div>");
function showPopupText(){
var o=event.srcElement;
MouseX=event.x;
MouseY=event.y;
if(o.alt!=null && o.alt!="") { o.pop=o.alt;o.alt="" }
if(o.title!=null && o.title!=""){ o.pop=o.title;o.title="" }
if(o.pop) { o.pop=o.pop.replace("\n","<br>"); o.pop=o.pop.replace("\n","<br>"); }
if(o.pop!=sPop) {
sPop=o.pop;
clearTimeout(curShow);
clearTimeout(tFadeOut);
clearTimeout(tFadeIn);
clearTimeout(tFadeWaiting);
if(sPop==null || sPop=="") {
popLayer.innerHTML="";
popLayer.style.filter="Alpha()";
popLayer.filters.Alpha.opacity=0;
} else {
if(o.dyclass!=null) popStyle=o.dyclass
else popStyle="cPopText";
curShow=setTimeout("showIt()",tPopWait);
}
}
}
function showIt() {
popLayer.className=popStyle;
popLayer.innerHTML=\'<BR> \'+sPop+\' <BR><BR>\';
popWidth=popLayer.clientWidth;
popHeight=popLayer.clientHeight;
if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
else popLeftAdjust=0;
if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
else popTopAdjust=0;
popLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
popLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
popLayer.style.filter="Alpha(Opacity=0)";
fadeOut();
}
function fadeOut(){
if(popLayer.filters.Alpha.opacity<popOpacity) {
popLayer.filters.Alpha.opacity+=showPopStep;
tFadeOut=setTimeout("fadeOut()",1);
}
}
document.onmou搜索引擎优化ver=showPopupText;
</script>
');
}
/*
+----------------------------------+
| Show css
+----------------------------------+
| C / M : 2003-12-28 / --
+----------------------------------+
*/
function showCSS()
{
print("
<style type='text/css'>
a:link, a:visited, a:active { text-decoration: none; color: #000 }
a:hover { color: orangered; text-decoration:none }
BODY { scrollbar-face-color: #DEE3E7; scrollbar-highlight-color: #FFFFFF; scrollbar-shadow-color: #DEE3E7; scrollbar-3dlight-color: #D1D7DC; scrollbar-arrow-color: #006699; scrollbar-track-color: #EFEFEF; scrollbar-darkshadow-color: #98AAB1; font: 12px Verdana; color:#333333; font-family: Tahoma,Verdana, Tahoma, Arial,Helvetica, sans-serif; font-size: 12px; color: #000; margin:0px 12px 0px 12px;background-color:#FFF }
TD {font: 12px Verdana; color:#333333; font-family: Tahoma,Verdana, Tahoma, Arial,Helvetica, sans-serif; font-size: 12px; color: #000; };
input, textarea {
font-family: Verdana;
font-size: 8pt;
border: 1px solid #C0C0C0;
color:#333333; background-color:#FFFFFF
}
</style>
");
}
/*
+----------------------------------+
| Show title
+----------------------------------+
| C / M : 2003-12-28 / --
+----------------------------------+
*/
function showTitle()
{
print("<meta HTTP-EQUIV=Content-Type content=\"text/html; charset=gb2312\">\n");
print("<title>".$this->configTilte."</title>\n");
print("<BODY>\n");
print("<A NAME=\"TOP\">\n");
print("<BR>\n");
print("<center>\n");
print($this->configTilte);
print("</center>\n");
print("<BR><BR>\n");
}
/*
+----------------------------------+
| Show state
+----------------------------------+
| C / M : 2003-12-28 / 2004-4-9
+----------------------------------+
*/
function showState()
{
print("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER>以后目次 : <B><FONT COLOR=\"red\">".$this->nowDirName."</FONT></B> [ 子目次数 : <B><FONT COLOR=\"red\">". ($this->dirNum - 1) ."</FONT></B> 图片数量 : <B><FONT COLOR=\"red\">".$this->picNum."</FONT></B> 每页显示 : <B><FONT COLOR=\"red\">".$this->configEachPageMax."</FONT></B> 个 ] 检查形式: [ <A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=real&page=".$this->page."\"><FONT COLOR=\"blue\" title=\"依照真实比例检查图片\">真实</FONT></A> ] [ <A HREF=\"".$_SERVER['PHP_SELF']."?path=".rawurlencode($this->path)."&style=small&page=".$this->page."\"><FONT COLOR=\"blue\" title=\"以减少比例检查图片\">缩略</FONT></A> ] </CENTER>");
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\n");
}
/*
+----------------------------------+
| Make option direct list
+----------------------------------+
| C / M : 2004-3-24 / -- --
+----------------------------------+
*/
function makeOptionList()
{
$this->dirOptionList = "<select onchange=\"location='" . $_SERVER['PHP_SELF'] . "?path='+this.options[this.selectedIndex].NAME\">\n";
$this->dirOptionList .= "<option ID=\"\">-- 选择目次 --</option>\n";
for($i = 0; $i < $this->dirNum; $i++)
$this->dirOptionList .= "<option NAME=\"" . rawurlencode($this->dirArray[$i]) . "\">" . $this->dirNameArray[$i] . "</option>\n";
$this->dirOptionList .= "</select>\n";
}
/*
+----------------------------------+
| Show direct list
+----------------------------------+
| C / M : 2003-12-28 / 2004-3-24
+----------------------------------+
*/
function showDirList()
{
print("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\" width=\"100\">\n");
print("<CENTER>目次列表</CENTER>");
print("</td>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print(" " . $this->dirOptionList . " <input type=button value=\" 下级目次 \" OnClick=\"self.location='" . $_SERVER['PHP_SELF'] . "?path=" . rawurlencode($this->dirArray[0]) . "'\" alt=\"前往 下级目次\">");
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\n");
}
/*
+----------------------------------+
| Cute the long file name
+----------------------------------+
| C / M : 2003-12-29 / --
+----------------------------------+
*/
function sortName($filename)
{
$filename = substr($filename, 0, strrpos($filename, '.'));
$strlen = strlen($filename);
if ($strlen > $this->strLenMax) $filename = substr($filename, 0, ($this->strLenMax)) . chr(0) . "...";
return $filename;
}
/*
+----------------------------------+
| Show picture list
+----------------------------------+
| C / M : 2003-12-28 / 2003-12-29
+----------------------------------+
*/
function showPicList()
{
print("<FORM name=\"dfile\" action=\"". $_SERVER['PHP_SELF'] ."?action=del&style=" . $_GET['style'] . "&page=" . $_GET['page'] . "\" METHOD=\"POST\">\n");
print("<INPUT TYPE=hidden NAME=\"path\" VALUE=\"" . rawurlencode($this->path) . "\">");
/*
+----------------------------------+
| Real size style
+----------------------------------+
*/
$session = & $_SESSION;
if ($this->style == "real")
{
print("<center>\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("<BR><INPUT TYPE=\"checkbox\" NAME=\"delfile[]\" VALUE=\"" . $this->picFileArray[$i] . "\" title=\"删除图片 <FONT COLOR=blue>" . $this->picFileArray[$i] . "</FONT>\"> ");
printf("<A href=\"#TOP\">前往顶部</A> #%s %s %s × %s %s KB<BR><BR>\n",($i + 1), $this->picFileArray[$i], $this->picRealSizeWidth, $this->picRealSizeHeight, $picFileSize);
printf("<A href=\"%s\" target=\"_blank\"><IMG SRC=\"%s\" BORDER=\"0\"></A><BR><BR>\n", $this->picEncodeArray[$i], $this->picEncodeArray[$i]);
}
print("</center>\n");
}
/*
+----------------------------------+
| Small size style
+----------------------------------+
*/
else
{
print("<center>\n");
printf("<TABLE border=0><TBODY><TR>\n");
for($i = $this->start; $i < $this->offSet; $i++)
{
$I++;
$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("<TD style=\"border: 1px solid #CCCCCC\">\n");
print("<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" STYLE=\"BORDER-COLLAPSE: COLLAPSE\">\n");
print("<TBODY>\n");
print("<TR>\n");
print("<TD bgcolor=\"#F7F7F7\" height=\"20\" colspan=\"3\"><CENTER>" . $this->sortName($this->picFileArray[$i]) . "</CENTER></TD>\n");
print("</TR>\n");
print("<TR>\n");
print("<TD width=\"" . $this->configTDWidth . "\" height=\"" . $this->configTDHeight . "\" style=\"border: 0px solid #CCCCCC\" colspan=\"3\"><CENTER><A href=\"" . $this->picEncodeArray[$i] . "\" target=\"_blank\"><IMG SRC=\"" . $this->picEncodeArray[$i] . "\" BORDER=\"0\" width=\"" . $this->temp['Width'] . "\" height=\"" . $this->temp['Height'] . "\" ALT=\"文件 : <FONT COLOR='red'>" . $this->picFileArray[$i] . "</FONT> <BR> 尺寸 : <FONT COLOR='blue'>" . $this->picRealSizeWidth . " × " . $this->picRealSizeHeight . "</FONT> 像素 <BR> 格局 : <FONT COLOR='green'>" . $this->getFileExt($this->picFileArray[$i]) . "</FONT> <BR> 巨细 : <FONT COLOR='green'>" . $picFileSize . "</FONT> KB \"></A></CENTER></TD>\n");
print("<TR>\n");
print("<TD bgcolor=\"#F7F7F7\" width=30><CENTER>");
if ($session['neatpicLogined'])
print("<INPUT TYPE=\"checkbox\" NAME=\"delfile[]\" VALUE=\"" . $this->picFileArray[$i] . "\" title=\"删除图片 <FONT COLOR=blue>" . $this->picFileArray[$i] . "</FONT>\">");
print("</CENTER></TD><TD bgcolor=\"#F7F7F7\" height=\"30\"><CENTER> " . $this->picRealSizeWidth . " × " . $this->picRealSizeHeight . " </CENTER></TD><TD bgcolor=\"#F7F7F7\" height=\"20\"><CENTER>" . $picFileSize . " KB</CENTER></TD></TR></TBODY></TABLE></TD>\n");
if ($this->configEachLineMax == $I)
{
$I = 0;
print("</TR><TR>\n");
}
}
print("</TR>\n</TBODY></TABLE>\n");
print("<BR><A href=\"#TOP\">前往顶部</A><BR>\n");
print("</center>\n");
}
print("</FORM>\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("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
printf("<CENTER>以后设置: 紧缩页面 : <FONT COLOR=\"red\"><B>%s</B></FONT> 显示图片巨细 : <FONT COLOR=\"red\"><B>%s</B></FONT> 登录认证 : <FONT COLOR=\"red\"><B>%s</B></FONT> [ <A HREF=\"".$_SERVER['PHP_SELF']."?action=showhelp\" ><FONT COLOR=\"blue\" TITLE=\"检查NEATPIC图片法式的匡助文件\">NEATPIC 匡助</FONT></A> ]\n", $openGzip, $showPicSize, $showWantedPass);
print("</td>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">");
printf("<CENTER><A HREF=\"%s?action=login&path=%s\"><FONT COLOR=\"red\">办理上岸</FONT></A></CENTER>", $_SERVER['PHP_SELF'], rawurlencode($this->path));
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("<BR>\n");
printf($this->decode("UG93ZXJlZCBieSA8QSBIUkVGPSJodHRwOi8vd3d3Lm5lYXRzdHVkaW8uY29tIiBUQVJHRVQ9Il9ibGFuayI%2BTkVBVFBJQyhQSFAgxL%2FCvNaxtsGw5ik8L0E%2BIFZlcnNpb24mbmJzcDs6Jm5ic3A7JXMgJm5ic3A7UHJvY2Vzc2VkIGluICVzIHNlYzxCUj4NCkNvcHlyaWdodCBOZWF0U3R1ZGlvIDIwMDItMjAwNCA8QlI%2BDQo%3D"), $this->configVer, $this->usedTime);
print("<BR><BR>\n");
print("</center>\n");
}
/*
+----------------------------------+
| Show login window
+----------------------------------+
| C / M : 2003-12-29 / 2004-3-26
+----------------------------------+
*/
function showLogin()
{
print("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER>上岸验证</CENTER>");
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("
<CENTER><FORM METHOD=POST ACTION=\"".$_SERVER['PHP_SELF']."?action=loginout\"><BR>\n
登录暗码 : <INPUT TYPE=\"password\" NAME=\"password\"> <INPUT TYPE=\"submit\" VALUE=\"登录\">\n
<INPUT TYPE=\"hidden\" NAME=\"login\" VALUE=\"" . $_GET['action'] . "\">
<INPUT TYPE=\"hidden\" NAME=\"path\" VALUE=\"" . $_GET['path'] . "\">
</FORM></CENTER>\n
");
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\n");
}
/*
+----------------------------------+
| Show Admincp
+----------------------------------+
| C / M : 2003-12-29 / 2004-4-2
+----------------------------------+
*/
function showAdmincp()
{
$session = & $_SESSION;
if ($session['neatpicLogined'] == true)
{
print("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\" width=\"100\">\n");
print("<CENTER>办理选项</CENTER>");
print("</td>\n");
print("<FORM action=\"" . $_SERVER['PHP_SELF'] . "?action=upload\" method=\"POST\" enctype=\"multipart/form-data\">\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\" width=\"380\"> \n");
if (is_writeable($this->path))
print("<INPUT TYPE=hidden NAME=\"path\" VALUE=\"" . rawurlencode($this->path) . "\"><INPUT style=\"height:20\" TYPE=FILE NAME=\"image\" title=\"上传文件到 <font color=blue>" . $this->nowDirName . "</font> 目次\"> <INPUT TYPE=submit VALUE=\"上传图片\"> <input type=button value=\"批量上传\" OnClick=\"self.location='" . $_SERVER['PHP_SELF'] . "?path=" . rawurlencode($this->path) . "&action=uploadmore'\" alt=\"批量上传图片\">");
else
printf("<FONT COLOR=\"red\"><B>没法上传图片 目次 <FONT COLOR=\"blue\">%s</FONT> 不成写</B></FONT>", $this->nowDirName);
print("</td>\n");
print("</FORM>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER><A HREF=\"javascript:document.dfile.submit()\"><FONT COLOR=\"blue\" title=\"删除已选定了的图片\">删除图片</FONT></A> | <A HREF=\"".$_SERVER['PHP_SELF']."?action=cfgdirpass&path=" . rawurlencode($this->path) . "\"><FONT COLOR=\"blue\" title=\"添加/编纂 目次会见暗码\">目次暗码</FONT></A> | <A HREF=\"".$_SERVER['PHP_SELF']."?action=loginout&path=" . rawurlencode($this->path) . "\"><B><FONT COLOR=\"red\" title=\"加入登录\">加入相册</FONT></B></A></CENTER>");
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\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("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"50\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER><FONT COLOR=\"red\"><B>文件上传胜利</B></FONT></CENTER>");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td bgcolor=\"#FFFFFF\" height=\"50\" style=\"border: 1px solid #CCCCCC\">\n");
printf("<CENTER><BR><FONT COLOR=\"blue\">文件名</FONT> : <FONT COLOR=\"green\">%s</FONT> <FONT COLOR=\"blue\">文件巨细</FONT> : <FONT COLOR=\"green\">%s KB</FONT> <FONT COLOR=\"blue\">文件类型</FONT> : <FONT COLOR=\"green\">%s</FONT><BR><BR><IMG SRC=\"%s%s\" border=1><BR><BR></CENTER>", $uploadFile, sprintf("%0.2f", $_FILES['image']['size'] / 1024), $imgType, $decodePath, rawurlencode($uploadFile));
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"50\" style=\"border: 1px solid #CCCCCC\">\n");
printf("<CENTER>[ <A HREF=\"%s%s\" target=\"_blank\">检查上传图片</A> | <A HREF=\"%s?path=%s\">前往以后目次</A> ]</CENTER>", $decodePath, rawurlencode($uploadFile), $_SERVER['PHP_SELF'], $_POST['path']);
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\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("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"50\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER><FONT COLOR=\"red\"><B>文件批量上传胜利</B></FONT></CENTER>");
print("</td>\n");
print("</tr>\n");
for($i = 0; $i < count($uploadFileArray); $i++)
{
print("<tr>\n");
print("<td bgcolor=\"#FFFFFF\" height=\"50\" style=\"border: 1px solid #CCCCCC\">\n");
printf("<CENTER><BR><FONT COLOR=\"blue\">#" . ($i + 1) . " 文件名</FONT> : <FONT COLOR=\"green\">%s</FONT> <FONT COLOR=\"blue\">文件巨细</FONT> : <FONT COLOR=\"green\">%s KB</FONT> <FONT COLOR=\"blue\">文件类型</FONT> : <FONT COLOR=\"green\">%s</FONT><BR><BR><IMG SRC=\"%s%s\" border=1><BR><BR></CENTER>", $uploadFileArray[$i], $imgSizeArray[$i], $imgTypeArray[$i], $decodePath, rawurlencode($uploadFileArray[$i]));
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"50\" style=\"border: 1px solid #CCCCCC\">\n");
printf("<CENTER>[ <A HREF=\"%s%s\" target=\"_blank\">检查上传图片</A> | <A HREF=\"%s?path=%s\">前往以后目次</A> ]</CENTER>", $decodePath, rawurlencode($uploadFileArray[$i]), $_SERVER['PHP_SELF'], rawurlencode($_GET['path']));
print("</td>\n");
print("</tr>\n");
}
print("</tbody>\n");
print("</table>\n");
print("</center>\n");
}
else
{
($_POST['uploadnum']) ? $num = & $_POST['uploadnum'] : $num = 5;
print("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER><FONT COLOR=\"red\">批量上传图片</FONT></CENTER>");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<FORM action=\"" . $_SERVER['PHP_SELF'] . "?path=" . rawurlencode($_GET['path']). "&action=uploadmore&do=yes\" METHOD=\"POST\" enctype=\"multipart/form-data\">\n");
print("<td bgcolor=\"#FFFFFF\" height=\"50\" style=\"border: 1px solid #CCCCCC\" align=center><BR>\n");
for ($i = 1; $i <= $num; $i++)
print("#" . $i . " <INPUT TYPE=\"file\" NAME=\"images[]\" SIZE=\"40\"><BR>\n");
print("<BR></td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER><INPUT TYPE=\"submit\" VALUE=\"上传图片\"> <INPUT TYPE=\"button\" onclick=\"javascript:history.go(-1)\" VALUE=\"前往上页\"></CENTER>");
print("</td>\n");
print("</FORM>\n");
print("</tr>\n");
print("<tr>\n");
print("<FORM action=\"" . $_SERVER['PHP_SELF'] . "?path=" . rawurlencode($_GET['path']). "&action=uploadmore\" METHOD=\"POST\">\n");
print("<td bgcolor=\"#FFFFFF\" height=\"50\" style=\"border: 1px solid #CCCCCC\" align=center>\n");
print("从头设定要批量上传的图片数目: 我要一次性上传 <INPUT TYPE=\"text\" NAME=\"uploadnum\" size=\"3\"> 张图片 <INPUT TYPE=\"submit\" VALUE=\" 设置 \">\n");
print("</td>\n");
print("</FORM>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\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, "<?php die()?>|" . md5($_POST['newpassword']));
fclose($fp);
}
header("location:".$_SERVER['PHP_SELF']."?path=" . $_POST['path']);
}
else
{
$this->timer();
$this->showCSS();
$this->showTitle();
$this->ShowJS();
print("<center>\n");
print("<table width=\"80%\">\n");
print("<tbody>\n");
print("<tr>\n");
print("<td bgcolor=\"#F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("<CENTER>目次会见暗码设置</CENTER>");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td bgcolor=\"F7F7F7\" height=\"30\" style=\"border: 1px solid #CCCCCC\">\n");
print("
<CENTER><FORM METHOD=POST ACTION=\"".$_SERVER['PHP_SELF']."?action=cfgdirpass&do=yes\"><BR>\n
旧的暗码 : <INPUT TYPE=\"password\" NAME=\"oldpassword\" title=\" 假如目次本来有暗码,请输出旧的暗码 \"><BR><BR>
新的暗码 : <INPUT TYPE=\"password\" NAME=\"newpassword\" title=\" 输出新的目次暗码 \"><BR><BR>
确认暗码 : <INPUT TYPE=\"password\" NAME=\"checkpassword\" title=\" 确认新的目次暗码 \"><BR><BR>
<INPUT TYPE=\"submit\" VALUE=\" 添加/更新 暗码 \">\n
<INPUT TYPE=\"hidden\" NAME=\"path\" VALUE=\"" . $_GET['path'] . "\">
</FORM></CENTER>\n
");
print("</td>\n");
print("</tr>\n");
print("</tbody>\n");
print("</table>\n");
print("</center>\n");
$this->usedTime();
$this->showConfigState();
exit;
}
}
}
/*
+----------------------------------+
| Dir password checking
+----------------------------------+
| C / M : 2004-3-27 / -- --
+----------------------------------+
*/
function checkingDirPass()
{
if ($_GET['action'] == 'checkdirpass')
{
$session = & $_SESSION;
$password = file(rawurldecode($_POST['path']) . "/" . $this->configDirPasswordFile);
list(, $password) = explode('|', chop($password[0]));
if ($password == md5($_POST['password']))
$session[$_POST['path']] = md5($password);
<P> header("location:".$_SERVER['PHP_SELF']."?path=" . $_POST['path']); |
|