免费主页管理程序2.3(一)
哈哈,原来我在163上有一个备份,为了避免再次丢失,还是把他发布出来保险
有一些在1.0版本上已经有了,下面的只是一些升级程序、
/*list.php3*/
<?
session_start();
require("func.php3");
connect();
if (strstr($tpath,".."))
{echo "不要试图破坏我的站点";exit;}
if ($user=='')
{header("location: login.php3");}
echo "<head><title>====================================主页空间管理系统2.3====================================</title></head>
<center><a href=sm.html target=_blank>主页空间管理系统2.3帮助</a>
————<a href="javascript:showwin('xgxxxx.php3')">修改用户个人资料</a>————<a href=logout.php3>退出登陆</a></div></center><br>";
echo "你好{$user}。";
if ($bf<>"")
{
$date=date(y).date(m).date(d);
$backupcommand="e:hubomysqlbinmysqldump --opt -u $user -p{$pass} {$user} >e:homepage\{$user}\{$user}数据库备份.日期{$date}";
//echo $backupcommand;
exec($backupcommand) ;
echo "<font color=red>数据库导出成功!</font><br>导出文件为:你的主页根目录下:{$user}数据库导出.日期{$date}";
}
$dbs = mysql_list_dbs();
$dbcount=mysql_numrows($dbs);
$flag=0;
for ($i=0;$i<$dbcount;$i++)
{
if ($user==mysql_dbname($dbs, $i))
{$flag=1;break;}
}
if ($flag==0)
{
$dbuser=$user;
$dbpassword=$pass;
session_register("dbuser");
session_register("dbpassword");
echo "您还没有创建自己的数据库。请点击创建数据库按钮,请不要关掉弹出窗口<input type=button value=创建自己的mysql数据库 onclick=window.open("createdb.php3","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=50,height=50,top=40,left=30"); class=no>";
}
else
{echo "<center><form method=post action=list.php3 >您的数据库已经可以使用,数据库名为{$user},密码为登陆密码,数据库主机为202.106.104.41";
echo "<input type=hidden name=bf value=true><br><input type=submit value=数据库导出 class=no>
<input type=button value=数据库导入 class=no onclick=window.open("import.php3","newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=270,height=50");>
</form></center>";
}
?>
<script language="javascript">
function showwin(htmlurl){
var newwin=window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=350,height=500");
}
function showwin2(htmlurl){
var newwin=window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=250,height=50");
}
</script>
<style>
td{font-size:9pt}
body{font-size:9pt}
input { background-color: #ffffff; border: 1px #000000 dashed}
.no { background-color: #d4d0c8}
.no1 { background-color: #e6f3f7; border-style: none}
.no2 { background-color: #eeeeee; border-style: none}
</style>
<script id=clienteventhandlersjs language=javascript>
<!--
function button1_onclick()
{
form1.remark .value ="shangchuan";
form1.submit() ;
}
function button2_onclick()
{
form1.remark .value ="chuangjian";
form1.submit() ;
}
function del_onclick()
{
if (confirm("你确认要删除这些目录或者文件吗?"))
{
form2.submit();
}
}
//-->
</script>
<?
$df = diskfreespace("/");
$freespace=ceil($df/1024/1024);
echo "<br>磁盘剩余空间:{$freespace}m<br>";
if ($tpath=="")
{ $path=$basepath; }
else if ($tpath=="/")
{
if ($basepath<>"/homepage/{$user}")
{
$splitpath=explode("/",$basepath);
for ($i=1;$i<count($splitpath)-1;$i++)
{$path=$path."/{$splitpath[$i]}";}
}
else
{$path="/homepage/$user";}
}
else
{ $path=$basepath.$tpath; }
if ($stoppath<>"")
{$path=$stoppath;}
if ($directpath<>"")
{$path=$directpath;}
//echo "path={$path}"."<br>";
//echo "basepath:$basepath<br>";
$basepath=$path;
if (!strstr($basepath,"/homepage/$user"))
{echo "你上别人的目录干什么?";exit;}
session_register("basepath");
$splitpath=explode("/",$path);
$newpath="<a href="http://202.106.104.41/zy/{$user}" target=_blank>你的主页</a>";
for ($i=1;$i<count($splitpath);$i++)
{
$temppath=$temppath."/{$splitpath[$i]}";
if ($i==1)
{$newpath=$newpath;}
else if ($i==2)
{$newpath=$newpath."/<a href=list.php3?directpath=/homepage/$user>根目录</a>";}
else
{$newpath=$newpath."/<a href=list.php3?directpath={$temppath}>{$splitpath[$i]}</a>";}
}
echo $newpath."<br>";
if (!file_exists($path))
{mkdir($path,0000) or die("目录创建错误,可能是你的用户名里有非法的字符<br>请于<a href=mailto:qdlover@sina.com>站长</a>联系");}
chdir($path);
$handle = opendir(".");
//上传文件
if ($remark=="shangchuan")
{
if($file1 != "none")
{
$filesize=ceil(filesize($file1)/1024);
if ($filesize==0)
{
$dx=filesize($file1)."byte";
}
else
{$dx=$filesize."k";}
copy($file1,"{$path}/{$file1_name}");
if ($unzip=="true")
{
$commandstring="echo a e:/homepage/pkunzip -d e:{$path}/{$file1_name} e:{$path}/";
$commandstring=strtr($commandstring,"/","\");
system($commandstring) ;
$unzipok="解压成功!";
$delcommand=strtr("del e:{$path}/{$file1_name}","/","");
system($delcommand);
}
unlink($file1);
$sqls="update upfile_user set dx=dx+{$filesize} where username='$user'";
@mysql_query($sqls);
echo "<font color=red>文件:".$file1_name."({$dx})";
if ($unzipok<>"")
{echo $unzipok;}
else
{ echo "上传成功,可以继续上传</font>";}
}
}
//创建目录
if ($remark=="chuangjian")
{
if (!$dir)
{echo "<font color=red>创建目录不能为空!</font>";}
else
{
if (!file_exists($dir))
{
mkdir($dir,0000);
echo "<font color=red>目录{$dir}创建成功</font>";
}
else
{
echo "<font color=red>目录{$dir}已经存在</font>";
}
}
}
//删除文件和目录
if ($remark=="del")
{
for ($i=1;$i<=$count;$i++)
{
$check="checkbox".$i;
if ($$check=="on")
{
$del="del".$i;
if (is_dir($$del))
{rmdir("{$$del}");}
if (is_file($$del))
{unlink($$del);}
echo "<font color=red>{$$del}被删除</font><br>";
}
}
}
while ($file = readdir($handle))
{
if (is_dir($file)){$dirlist[]=$file;}
if (is_file($file)){$filelist[]=$file;}
}
closedir($handle);
?>
<body bgcolor="#d0d2e3">
<form action=list.php3 method=post enctype="multipart/form-data" name=form1>
<input type=hidden name=remark value="">
<table width="0%" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#0066ff">
<td bgcolor="#3366ff">
<div align="center"><font color="#ffffff"><b>文件上传</b></font></div>
</td>
<td bgcolor="#d0d2e3">        </td>
<td bgcolor="#3366ff">
<div align="center"><font color="#ffffff"><b>创建目录</b></font></div>
</td>
</tr>
<tr>
<td>
<input type=file name=file1>
<input type=button value=上传 name="button1" id="button1" onclick="return button1_onclick()" class=no>
</td>
<td bgcolor="#d0d2e3" rowspan="2">        </td>
<td rowspan="2" valign="top">
<input type="text" name="dir">
<input type="button" name="button2" id="button2" value="创建" onclick="return button2_onclick()" class=no>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="unzip" value="true" style="background-color:#d0d2e3;border-style: none">
自动解压zip文件(包括路径) </td>
</tr>
</table>
<input type=hidden name=stoppath value=<?echo $path;?>>
</form>
<form method="post" action="list.php3" name=form2>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div align="left">
<input type=hidden name="remark" value="del">
<input type=hidden name=stoppath value=<?echo $path;?>>
<input type="button" name="del" value="删除" onclick="return del_onclick()" class=no>
</div>
</td>
<td> </td>
</tr>
</table>
<table width="100%" border="1" cellspacing="1" cellpadding="3" bordercolor="#666666">
<tr bgcolor="#cccccc">
<td width="1%" nowrap>
<div align="center">选定</div>
</td>
<td width="25%" nowrap>
<div align="center">文件名</div>
</td>
<td nowrap>
<div align="center">改名</div>
</td>
<td width="21%" nowrap>
<div align="center">文件类型</div>
</td>
<td width="21%" nowrap>
<div align="center">文件尺寸</div>
</td>
<td width="32%" nowrap>
<div align="center">最后修改日期</div>
</td>
</tr>
<?
$count=0;
if ($dirlist)
{
asort($dirlist);
for ($i=0;$i<count($dirlist);$i++)
{
$count++;
$filename=$dirlist[$i];
if ($filename=="abcdefghijk")
{
$sqls="update upfile_user set ph=ph+1,ptime=now() where username='$user'";
@mysql_query($sqls);
echo "<center><font color=red>不要试图破坏我的硬盘。你的登陆已经无效了,你的行为也许是无意的,可是你的行为已经被记录在案。
<br>注意,不要到你的目录以上,如果破坏次数超过了10次你的账号将被取消。</font></center>";
$user="";
session_register("user");
exit;}
if ($filename<>".")
{
if ($filename=="..")
{
if ($path=="/homepage/{$user}")
{$tfilename="根目录";$rename=" ";}
else
{$filename="上一级目录";$tfilename="<a href=list.php3?tpath=/>{$filename}</a>";$rename=" ";}
}
else
{$tfilename="<a href=list.php3?tpath=/$filename>{$filename}</a>";$rename="<a href=javascript:showwin2("rename.php3?name={$filename}&lx=dir")>改名</a>";}
$filetype="目录";
$filesize="无";
$lasttime=date("y年m月d日h:i:s",filectime($dirlist[$i]));
echo "<tr bgcolor="#e6f3f7">
<td width=1%>
<div align=center>
<input type=checkbox name=checkbox{$count} class=no1>
<input type=hidden name=del{$count} value={$filename}>
</div>
</td>
<td width=25%>
<div align=center>{$tfilename}</div>
</td>
<td nowrap>
<div align=center>$rename</div>
</td>
<td width=21%>
<div align=center>{$filetype}</div>
</td>
<td width=21%>
<div align=center>{$filesize}</div>
</td>
<td width=32%>
<div align=center>{$lasttime}</div>
</td>
</tr>
";
}
}
}
if ($filelist)
{
$splitpath=explode("/",$path);
for ($i=3;$i<count($splitpath);$i++)
{
$temp=$temp."/{$splitpath[$i]}";
}
asort($filelist);
for ($i=0;$i<count($filelist);$i++)
{
$count++;
$filename=$filelist[$i];
$tfilename="<a href="http://202.106.104.41/zy/$user$temp/{$filename}" target=_blank>{$filename}</a>";
$filetype=strtolower(substr(($filelist[$i]),-4));
if ($filetype==".txt")
{$filetype="文本文件";
$editname="——<a href=javascript:showwin("edit.php3?path=$temp&file={$filename}")>手工编辑</a>";
}
else if ($filetype=="html" $filetype==".htm")
{$filetype="超文本文件";
$editname="——<a href=javascript:showwin("edit.php3?path=$temp&file={$filename}")>手工编辑</a>";
}
else if ($filetype==".jpg" $filetype==".gif")
{$filetype="图像文件";
$editname="";}
else if ($filetype==".zip" $filetype==".rar")
{$filetype="压缩文件";$editname="";}
else if ($filetype==".swf" $filetype==".fla")
{$filetype="flash文件";$editname="";}
else if ($filetype==".php" $filetype==".php3")
{$filetype="php文件";
$tfilename=$tfilename."——<a href=javascript:showwin("edit.php3?path=$temp&file=$filename")>手工编辑</a>";
}
else if ($filetype==".css")
{$filetype="样式表文件";
$editname="——<a href=javascript:showwin("edit.php3?path=$temp&file=$filename")>手工编辑</a>";
}
else if ($filetype==".exe" $filetype==".com")
{$filetype="可执行文件";$editname="";}
else
{$filetype="未知类型";$editname="";}
$filesize=filesize($filelist[$i]);
$lasttime=date("y年m月d日h:i:s",filectime($filelist[$i]));
echo "<tr bgcolor="#eeeeee">
<td width=1%>
<div align=center>
<input type=checkbox name=checkbox{$count} class=no2>
<input type=hidden name=del{$count} value={$filename}>
</div>
</td>
<td width=25%>
<div align=center>{$tfilename}{$editname}</div>
</td>
<td nowrap>
<div align=center><a href=javascript:showwin2("rename.php3?name={$filename}&lx=file")>改名</a></div>
</td>
<td width=21%>
<div align=center>{$filetype}</div>
</td>
<td width=21%>
<div align=center>{$filesize}b</div>
</td>
<td width=32%>
<div align=center>{$lasttime}</div>
</td>
</tr>
";
}
}
?>
<input type=hidden name=count value=<?echo $count;?>>
<tr bgcolor="#cccccc">
<td width="1%" nowrap>
<div align="center">选定</div>
</td>
<td width="25%" nowrap>
<div align="center">文件名</div>
</td>
<td nowrap>
<div align="center">改名</div>
</td>
<td width="21%" nowrap>
<div align="center">文件类型</div>
</td>
<td width="21%" nowrap bgcolor="#cccccc">
<div align="center">文件尺寸</div>
</td>
<td width="32%" nowrap>
<div align="center">最后修改日期</div>
</td>
</tr>
</table>
</form>
<?
if ($gg=="")
{
$gg="ok";
session_register("gg");
require("gg.html");
}
?>
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器