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

📄 cfg.php

📁 HTML模版 LDV个人相册系统 v1.6 简体中文版
💻 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.6"; 
$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,$upp)
{
	$rec="data/".$album.".dat";
	global $albumdir;
	if(file_exists($rec))
		die("此相册已经存在,请换一个名字");
	if($album&&$cover)
	{
		mkdir("$albumdir$album",0777);
		$fp=fopen($rec,"w");
		chmod($rec,0777);
		flock($fp,LOCK_EX);
		fwrite($fp,$album);fwrite($fp,"\n");
		fwrite($fp,"0");fwrite($fp,"\n");
		fwrite($fp,date("Y.m.d"));fwrite($fp,"\n");
		fwrite($fp,$cover);fwrite($fp,"\n");
		fwrite($fp,$upp);
		fclose($fp);
		global $namefile;
		$fp=fopen($namefile,"a+");
		$newname=$album."\n";
		flock($fp,LOCK_EX);
		fwrite($fp,$newname);
		fclose($fp);
		return 1;
	}
	else
		return 0;
}
$vurl="LPAS 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);
	flock($fp,LOCK_EX);
	for($i=0;$i<count($cache);$i++)
		fwrite($fp,$cache[$i]);
	fclose($fp);
	return 1;
}
function PHP_pages()
{
	global $version,$vurl,$url;
	echo<<<ldv
	<br>
	<hr size=1 color="#AAAAAA"><br><span style="font-size:10px;color:999999">Powered by <a href="http://free2.e-168.cn/ldv007" title="LDV Personal Album System">$vurl</a><br>Designed & programed by <a href="http://free2.e-168.cn/ldv007/" title="LDV个人相册系统">David Loo</a><br><a href="$url">contract us</a></span>
 </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");
	flock($fp,LOCK_EX);
	for($i=0;$i<count($cache);$i++)
		fwrite($fp,$cache[$i]);
	fclose($fp);
}
function manage($var)
{
	global $info,$createdate,$msg;
	if($var==1)
		$u1='checked';
	elseif($var==0)
		$u0='checked';
	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=post action="">
	<td width="40%" bgcolor="#FFFFFF"><br>
	更改相册封面图片<br>
	*图片地址:<input type="text" name="cover" size="12">
	<p>
	图片改名<br>
	*图片原名:<input type="text" name="oldname" size="12"><br>
	*图片新名:<input type="text" name="newname" size="12">
	<p>
	游客上传:<input type="radio" name="upp" class="0" value="1" $u1>开启 <input type="radio" name="upp" class="0" value="0" $u0>关闭
	<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)
{
	global $thumbdir;
	if($otype!=".bmp")
	{
	$picname=basename($src);
	$type=strtolower($otype);
	$im_des=$thumbdir.$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);
	if($width>128||$height>128)
	{
	@$ratio=$height/$width;
	if($ratio<1)
	{
		$newwidth=128;
		@$newheight=$height*(128/$width);
	}
	else
	{
		$newheight=128;
		$newwidth=$width*(128/$height);
	}
	$im_s=@imagecreatetruecolor($newwidth,$newheight);
	@imagecopyresized($im_s,$im,0,0,0,0,$newwidth,$newheight,$width,$height);
	@imagejpeg($im_s,$im_des,80);
	@chmod($im_des,0777);
	@imagedestroy($im);
	}
	else
		copy($src,$thumbdir.$album."_".$picname.".jpg");
	}
}
function PHP_html()
{
	global $info,$title,$version,$wlcmmsg;
echo<<<ldv
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<title>★☆$info[0] - $title - LDV个人相册系统v$version </title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<link rel="stylesheet" href="css.css">
</head>

<body>
 <center>
<table width="650" height="25">
<tr>
	<td><font style="font-size:13px;color:#2047E6;font-weight:bold">$wlcmmsg</font></td>
</tr>
</table>
<p>
<table width="650">
<tr>
	<td align="left" width="520" 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> &nbsp; </td>
</tr>
<tr>
	<td bgcolor="#FFFFFF" colspan="2">
	<table width="100%" height="100%" border="0">
ldv;
}
function getimageinfo($src)
{
	$src=rawurldecode($src);
	$im=getimagesize($src);
	preg_match("/width=\"(.*)\" height=\"(.*)\"/", $im[3], $tempsize);
	$iminfo[0]=$tempsize[1];
	$iminfo[1]=$tempsize[2];
	return $iminfo;
}
function phpcode()
{
	global $cache,$info,$wlcmmsg,$menu;
echo<<<ldv
<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="80%" 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()
{ 
	if (getenv("HTTP_CLIENT_IP")) 
		return getenv("HTTP_CLIENT_IP"); 
	elseif (getenv("HTTP_X_FORWARDED_FOR"))
		return getenv("HTTP_X_FORWARDED_FOR"); 
	else
		return getenv("REMOTE_ADDR");
}

if(!isset($_COOKIE['LDValbum']))
{
	$log=0;
	$menu="<td><a href=\"index.php?adminlog=1\">管理员登陆</a></td>";
}
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>
<meta http-equiv="Content-Language" content="zh-cn">
<title>★☆$title - 后台管理 - LDV个人相册系统v$version </title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<link rel="stylesheet" href="css.css">
</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"><br>
	封面图片:<input type="text" name="cac" size="12"><br>
	游客上传:<input type="radio" name="upp" class="0" value="1">打开&nbsp; <input type="radio" name="upp" class="0" value="0" checked>关闭<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">
	来源1:<input type="file" name="uppic1" size="10"><br>
	来源2:<input type="file" name="uppic2" size="10"><br>
	来源3:<input type="file" name="uppic3" size="10"><br>
	来源4:<input type="file" name="uppic4" size="10"><br>
	来源5:<input type="file" name="uppic5" size="10"><p>
	传至相册:<select name="upto" style="width:130px">
ldv;
}
function gul($pmt)
{
if($pmt==1)
	$gmsg="游客上传图片功能已经打开";
if($pmt=='1')
echo<<<ldv
<table width="650"><form method="post" enctype="multipart/form-data" action="">
	<tr>
	<td height="25">
	<font color="red">$gmsg</font>
	</td>
	</tr>
	<tr>
	<td height="65" bgcolor="#FFFFFF">
	图片来源:<input type="file" name="gpicsrc" size="50"><br>
	</td>
	</tr>
	<tr>
	<td height="25">
	<input type="submit" value=" 上 传 "> &nbsp; <input type="reset" value=" 重 写 ">
	</td>
	</tr></form>
</table><br>
ldv;
}
function PHP_main()
{
global $title,$info,$version,$n,$currentalbumname,$syg,$xyg,$picpath,$picname;
echo<<<ldv
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<title>★☆$title - $info[0] - LDV个人相册系统v$version </title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<link rel="stylesheet" href="css.css">
</head>
<body>
 <center>
<table width="98%" height="25">
<tr>
	<td><font style="font-size:14px;color:#2047E6;font-weight:bold">当前相册:<font color="green">$info[0]</font>,共 <font color="green">$info[1]</font>张图片,当前浏览的是第<font color="green"> $n </font>张图片:<font color="green">$picname</font></td>
</tr>
</table>
<p>
<table width="700">
<tr>
	<td align="left" width="460" height="25" bgcolor="#F2F4F2">&nbsp;&nbsp;<b>最后更新日期:$info[2]</b></td>
	<td align="right"><a href="showpic.php?name=$currentalbumname&pic=$syg">上一张</a> <a href="showpic.php?name=$currentalbumname&pic=$xyg">下一张</a> <a href="album.php?name=$info[0]">返回相册</a> </td>
</tr>
<tr>
	<td bgcolor="#FFFFFF" colspan="2">
	<table width="100%" height="100%" border="0">
<tr>
<td align="center" bgcolor="#FFFFFF">
<br>
&nbsp;&nbsp;<img src="$picpath" border=1>&nbsp;&nbsp;
<br>
</td>
</tr>
<tr>
<td height="30" align="center">
$picname
</td>
</tr>
</table>
</td>
</tr>
</table>
ldv;
}
function head()
{
global $title,$version;
echo<<<ldv
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<title>★☆$title - LDV个人相册v$version</title>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
<meta name="Keywords" content="阿维的个人主页,php,网上相册,相册,网络,免费,个人主页">
<link rel="stylesheet" href="css.css">
</head>
ldv;
}
?>

⌨️ 快捷键说明

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