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

📄 cfg.php

📁 支持完全在线维护。可以在线完成新建/删除相册、更新图片、删除图片、更改名称等所有操作。上传之后完全可以不依赖FTP软件来维护相册。
💻 PHP
字号:
<?php
////////////////////////////////////////////////////////////
//
//                                   LDV个人相册系统
//
//                                      阿维设计编写
//
//           本程序采用文本储存数据,不需要mysql数据库支持
//
//            本程序属于免费程序,可以任意使用、拷贝、传播,
//
//                                   版权归阿维所有
//
//                   如果需要修改程序,请事先征得作者同意。
//
//            请务必保留相册页面中的作者主页的链接!谢谢!!
//
//
//////////////////以下内容请用户作相应修改////////////////////
$admin="David Loo";                               //相册管理员的名字
$pass="David Loo";                                  //管理员密码
$title="阿维的相册";                                 //相册的标题,建议改成相应名字
$wlcmmsg="欢迎光临我的个人相册";        //欢迎信息
$url="http://free2.e-168.cn/ldv007/album/";             //相册网址,最后要加‘/’,不要写到具体文件
$size="500";                                             //允许上传照片的最大体积,单位:KB
$permitformat=".jpg,.jpeg,.bmp,.gif,.png";  //允许上传的文件格式,只能减少!!

//////////////////以上内容请用户作相应修改///////////////////
///////////////////////////////////////////////////////////
/////////////////  以 下 内 容 不 要 修 改  /////////////////////

$version="1.3"; 
$cachefile="data/cache.dat";
$albumdir="album/";                           
$thumbdir="thumb/";
$namefile="data/name.dat";       
$maxsize=$size*1000;

function getformat($file)
{
	$ext=strrchr($file,".");
	$format=strtolower($ext);
	return $format;
}
function createalbum($album,$cover)
{
	$rec="data/".$album.".dat";
	global $albumdir;
	if(file_exists($rec))
		die("此相册已经存在,请换一个名字");
	if($album&&$cover)
	{
		mkdir($albumdir.$album,0766);
		$fp=fopen($rec,"w");
		chmod($rec,0777);
		fwrite($fp,$album);fwrite($fp,"\n");
		fwrite($fp,"0");fwrite($fp,"\n");
		fwrite($fp,date("Y.m.d"));fwrite($fp,"\n");
		fwrite($fp,$cover);
		fclose($fp);
		global $namefile;
		$fp=fopen($namefile,"a+");
		$newname=$album."\n";
		fwrite($fp,$newname);
		fclose($fp);
		return 1;
	}
	else
		return 0;
}
$vurl="LDV个人相册系统v".$version;
function getinfo($album)
{
	$rec="data/".$album.".dat";
	if(file_exists($rec))
		$info=file($rec);
	return $info;
}
function updatealbuminfo($albumname,$picnum,$cover)
{
	$rec="data/".$albumname.".dat"; 
	$cache=file($rec);
	if($albumname)
		$cache[0]=$albumname."\n";
	if($picnum)
		$cache[1]=$cache[1]+$picnum."\n";
	if($cover)
		$cache[3]=$cover."\n";
	$cache[2]=date("Y.m.d")."\n";
	$fp=fopen($rec,"w");
	chmod($rec,0777);
	for($i=0;$i<count($cache);$i++)
		fwrite($fp,$cache[$i]);
	fclose($fp);
	return 1;
}
function PHP_pages()
{
	global $version,$vurl;
	echo<<<ldv
	<br>
	<hr size=1 color="#AAAAAA"><br> <a href="http://free2.e-168.cn/ldv007" title="点此获得最新版本">$vurl</a><br>Designed & programed by <a href="http://free2.e-168.cn/ldv007/" title="获得技术支持,请访问作者个人主页">David Loo</a><br>All rights reserved
 </center>
</body>
</html>
ldv;
}
function getcache()
{
	global $cachefile;
	if(file_exists($cachefile))
		$cache=file($cachefile);
	return $cache;
}
function updatecache($albumnum,$picnum,$albumpage)
{
	global $cachefile;
	$cache=file($cachefile);
	if($albumnum)
		$cache[0]=$cache[0]+$albumnum."\n";
	if($picnum)
		$cache[1]=$cache[1]+$picnum."\n";
	if($albumpage)
		$cache[2]=$cache[2]+$albumpage."\n";
	$fp=fopen("data/cache.dat","w");
	for($i=0;$i<count($cache);$i++)
		fwrite($fp,$cache[$i]);
	fclose($fp);
}
function manage()
{
	global $info,$createdate,$msg;
	echo<<<ldv
<table width="605">
<tr>
	<td height="40" colspan="2" bgcolor="#F1F1F1">当 前 相 册 管 理 操 作<br>(带 * 的需要加扩展名)</td>
</tr>
<tr>
	<td height="150" bgcolor="#FFFFFF"><br>
	<form method=get action="">
	<table width="93%">
	<tr>
		<td height="25">当前相册信息</td>
	</tr>
	<tr>
		<td height="150">
	<table border="5" bordercolor="#FFFFFF" width="100%" height="100%">
	<tr height="100%">
	<td width="50%">
	<table width="100" height="90"><tr><td>
	<img src="$info[3]" width="100" height="90" title="当前相册封面">
	</td></tr>
	</table>
	</td>
    <td width="50%">
	<table height="40" width="90%" bgcolor="#FFFFFF"><tr><td> 名称:$info[0]</td></tr></table>
	<table height="5"><tr><td></td></tr></table>
	<table height="40" width="90%"><tr><td>创建:$createdate</td></tr></table>
	<table height="5"><tr><td></td></tr></table>
	<table height="40" width="90%"><tr><td>图片总数:$info[1]</td></tr></table>
	</td>
    </tr>
	</table>
	</td>
	</tr>
	</table>
	</form>
	</td><form method=get action="">
	<td width="40%" bgcolor="#FFFFFF"><br>
	更改相册封面图片<br>
	*图片地址:<input type="text" name="cover" size="12">
	<p>
	删除图片<br><input type="hidden" name="name" size="12" value=$info[0]>
	*图片名称:<input type="text" name="delname" size="12"><br>
	<p>
	图片改名<br>
	*图片原名:<input type="text" name="oldname" size="12"><br>
	*图片新名:<input type="text" name="newname" size="12"><p>
	<input type="submit" value="立刻操作"></form>
	</td>
</tr>
<tr>
	<td height="25" colspan="2"><font color="red">$msg</font></td>
</tr>
</table>
ldv;
}
function createthumb($src,$otype,$album)
{
	if($otype!=".bmp")
	{
	$picname=basename($src);
	$type=strtolower($otype);
	$im_des="thumb/".$album."_".$picname.".jpg";
	if($type==".jpg"||$type==".jpeg")
		$im=@imagecreatefromjpeg($src);
	if($type==".gif")
		$im=@imagecreatefromgif($src);
	if($type==".png")
		$im=@imagecreatefrompng($src);
	$width=@imagesx($im);
	$height=@imagesy($im);
	@$ratio=$height/$width;
	if($ratio<0.9)
	{
		$newwidth=100;
		@$newheight=$height*(100/$width);
	}
	else
	{
		$newheight="90";
		$newwidth=$width*(90/$height);
	}
	$im_s=@imagecreatetruecolor($newwidth,$newheight);
	@imagecopyresized($im_s,$im,0,0,0,0,$newwidth,$newheight,$width,$height);
	@imagejpeg($im_s,$im_des,70);
	chmod($im_des,0777);
	@imagedestroy($im);
	}
}
function PHP_html()
{
	global $info,$title,$version,$wlcmmsg;
echo<<<ldv
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>★☆$info[0] - $title - LDV个人相册系统v$version </title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<style>
<!--
body,table,td{font-size:12px;color:#21439E;font-family:Tahoma}
table{border-collapse:collapse;background:#F8F8F8;text-align:center}
td{border: 1px solid #D2D2D2;}
td.inner{border: 0px ;background:#FFFFFF}
a{text-decoration:none;color:#2047E6}
a:hover{text-decoration:underline;color:#F2831E}
//-->
</style>
</head>

<body>
 <center>
<table width="605" height="25">
<tr>
	<td><font style="font-size:13px;color:#2047E6;font-weight:bold">$wlcmmsg</font></td>
</tr>
</table>
<p>
<table width="605">
<tr>
	<td align="left" width="495" height="25" bgcolor="#F2F4F2">当前相册:$info[0],共 $info[1]张相片,最后更新日期:$info[2]</td>
	<td align="right"><a href="index.php">返回首页</a> <a href="album.php?name=$info[0]">刷新相册</a> </td>
</tr>
<tr>
	<td bgcolor="#FFFFFF" colspan="2">
	<table width="100%" height="100%" border="0">
ldv;
}
function getimageinfo($src,$type)
{
	$src=rawurldecode($src);
	if($type==".jpg"||$type==".jpeg")
		$im=imagecreatefromjpeg($src);
	if($type==".gif")
		$im=imagecreatefromgif($src);
	if($type==".png")
		$im=imagecreatefrompng($src);
	$iminfo[0]=imagesx($im);
	$iminfo[1]=imagesy($im);
	imagedestroy($im);
	return $iminfo;
	if($type==".bmp")
		return;
}
function phpcode()
{
	global $cache,$info,$wlcmmsg,$menu,$title,$version;
echo<<<ldv
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>★☆$title - LDV个人相册v$version</title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<style>
<!--
body,table,td{font-size:12px;color:#21439E;font-family:Tahoma}
table{border-collapse:collapse;background:#F8F8F8;text-align:center}
td{border: 1px solid #D2D2D2;}
td.inner{border: 0px ;background:#FFFFFF}
a{text-decoration:none;color:#2047E6}
a:hover{text-decoration:underline;color:#F2831E}
//-->
</style>
</head>

<body>
 <center>
<table width="605" height="25">
<tr>
	<td><font style="font-size:13px;color:#2047E6;font-weight:bold">$wlcmmsg</font></td>
</tr>
</table>
	<br>
<table width="605">
<tr>
	<td align="left" height="25" width="50%" bgcolor="#F2F4F2">当前共有$cache[0]个相册,$cache[1]张图片。</td>
	$menu
</tr>
<tr>
	<td bgcolor="#FFFFFF" colspan="2">
	<table width="100%" height="100%" border="0">
ldv;
}
function getguestnum()
{
	$n=$_SERVER['REMOTE_ADDR'];
	return $n;
}
if(empty($_COOKIE['LDValbum']))
{
	$log=0;
	$menu="<form method=post action=\"admin.php\"><td bgcolor=\"#F2F4F2\">\n<input type=\"text\" name=\"un\" size=\"10\"> <input type=\"password\" name=\"pw\" size=\"10\"> <input type=\"submit\" value=\"管理员登陆\">\n</td></form>";
}
elseif(($_COOKIE['LDValbum'])=="f89qh3RGRE8pFE7af78r3iEW2b638")
{
	$log=1;
	$menu="<td bgcolor=\"#F2F4F2\"><a href=\"admin.php\">相册维护</a> <a href=\"index.php?l=logout\">退出管理</a></td>";
}
else
{
	$log=0;
	$menu="<form method=post action=\"admin.php\"><td bgcolor=\"#F2F4F2\">\n<input type=\"text\" name=\"un\" size=\"10\"> <input type=\"password\" name=\"pw\" size=\"10\"> <input type=\"submit\" value=\"管理\">\n</td></form>";
}
function phpbackcode()
{
	global $title,$version;
echo<<<ldv
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>★☆$title - 后台管理 - LDV个人相册系统v$version </title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<style>
<!--
body,table,td{font-size:12px;color:#21439E;font-family:Tahoma}
table{border-collapse:collapse;background:#F8F8F8;text-align:center}
td{border: 1px solid #D2D2D2;}
td.inner{border: 0px ;background:#FFFFFF}
a{text-decoration:none;color:#2047E6}
a:hover{text-decoration:underline;color:#F2831E}
//-->
</style>
</head>

<body>
 <center>
	<p><a href="index.php">返回首页</a></p>
<table width="605">
<tr>
	<td height="25" bgcolor="#E2E2E2" colspan="3"><font size="2" color="#1818C9">后 台 管 理 界 面</font></td>
</tr>
<tr>
	<td height="325" width="33%" valign="top"><br>
	<table width="120" height="30" border=3 bordercolor="#FFFFFF"><tr><td bgcolor="#E3E3E3">
	创 建 相 册</td></tr></table><p>
	<form method="post" action="">
	相册名称:<input type="text" name="can" size="12"><p>
	封面图片:<input type="text" name="cac" size="12"><p>
	<input type="submit" value="创建">  <input type="reset" value="重写">
	</form>
	<table width="120" height="30" border=3 bordercolor="#FFFFFF"><tr><td bgcolor="#E3E3E3">
	删 除 相 册</td></tr></table><p>
	<form method="post" action="">
	相册名称:<input type="text" name="dan" size="12"><p>
	<input type="submit" value="删除">  <input type="reset" value="重写">
	</form>
	</td>
	<td height="325" width="33%" valign="top"><br>
	<table width="120" height="30" border=3 bordercolor="#FFFFFF"><tr><td bgcolor="#E3E3E3">
	上 传 本 地 图 片</td></tr></table><p>
	<form method="post" enctype="multipart/form-data" action="">
	<input type="hidden" name="MAX_FILE_SIZE" value="$maxsize">
	来源:<input type="file" name="uppic" size="10"><p>
	传至相册:<select name="upto">
ldv;
}
?>

⌨️ 快捷键说明

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