<head>
<title>[ Li相册 ] -　Powered by Li</title>


<link href="images/css.css" rel="stylesheet" type="text/css">

</head>

<!--#include file="conn.asp"-->
<%
  set rClass=server.createobject("adodb.recordset")
  sql="select * from class_info order by order_id"
  rClass.open sql,conn,1,1
%>




<table width="100%" border="0" align="center" bgcolor="#F2FAED">
  <tr>
    <td height="28">　<span class="STYLE2"><a href="index.asp">[ALL]</a>　            
	
<% While Not rClass.EOF %>
	<a href="index.asp?classid=<%=rClass("id")%>"><%=rClass("class_info")%></a>　            
<%
rClass.MoveNext()
Wend
%>	
	</span></td>
  </tr>
</table>


<%
	classid=request.querystring("classid")


For idd=1 To 10
	if classid=idd then
		classid=idd
	end if
next

	if classid="" then
		classid="%"
	end if
%>


<%
set rs=server.createobject("adodb.recordset")

if classid ="%" then
sql="select * from pic order by id desc"
else
sql="select * from pic where classid="&classid&" order by id desc"
End If 
rs.open sql,conn,1,1
%>

<%
page =int(Request.QueryString("page"))
rs.PageSize =12
If page < 1 Then   page = 1
If page > rs.PageCount Then   page = rs.PageCount
if not rs.eof then	rs.AbsolutePage =page
for i = 1 To rs.PageSize+rs.PageSize/4-4
    If rs.EOF Then  Exit For%>

<table width="100%"  border="1" align="center" cellspacing="1" bordercolor="#F2FAED">
	<tr>
	 <%for j=1 to 4
	 If rs.EOF Then  Exit For%>

		<td  height="158" align="center"><a href="<%=rs("name")%>" target="_blank"><img src="<%=rs("name")%>" width="150" height="110" border="1" align="absmiddle" /></a><br>
		  <br>
			<%=rs("pic_name")%> 

<%if session("admin")="denglu" then%>            
	<a href="del.asp?id=<%=rs("id")%>&delimg=<%=rs("name")%>&classid=<%=classid%>" onClick="return confirm('是否确定删除？');">[删除]</a>            
<%end if%>	  </td>            

	 <%i=i+1
	 rs.movenext
	 next%>
	</tr>
</table>

<%next%>
<center><br>
共有照片<font color="#FF0000"><%=rs.recordcount%></font>张　　            

第<%for j=1 to rs.pagecount%>
<a href="index.asp?page=<%=j%>&classid=<%=classid%>">            
<%if j=page then
	response.write j
else
	response.write  "["+cstr(j)+"]"
end if%></a> 
<%next            
if rs.recordcount=0 then response.Write("0")%>页　　

<hr size="2" width="780" color="#BBD1E8">

<%if session("admin")="denglu" then%>
<form name="form1" method="post" action="" onSubmit="return CheckForm()" enctype="multipart/form-data">
	<span class="STYLE4">【上传图片】</span>　　　　类别：            
	<select name="classid">
	<option value="" selected>- 请选择 -</option>

	<%
		set rClass1=server.createobject("adodb.recordset")
		sql="select * from class_info"
		rClass1.open sql,conn,1,1
			While Not rClass1.EOF
	%>
		 <option value="<%=rClass1("id")%>"><%=rClass1("class_info")%></option>     
	<%
	rClass1.MoveNext()
	Wend

	rClass1.Close()
	Set rClass1 = Nothing
	rClass.Close()
	Set rClass = Nothing
	%>

	</select>　            
	名称：<input type="text" name="pic_name" size=10>　            
	<input type=file name="file1">
<input type=submit name="submit" value=" 提 交 ">            
</form>
<%End if%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2FAED">
  <tr>
    <td height="24" class="wenzi"><div align="right">

		<%if session("admin")="denglu" then%>
		<a href="m_class.asp">分类管理</a>　<a href="m_admin.asp">帐号管理</a>　<a href="index.asp?cz=exit">退出登录</a>
		<%else%>      
        <a href="logo.htm" target="_blank">Admin</a>        
		<%end if%>     
		<%      
		cz=request.querystring("cz")
		if cz="exit" then
			session("admin")=""
			response.redirect "index.asp"
		end if
		%>
		
	 </div></td>
  </tr>
</table>

<!--#include FILE="images/yancd.cn.inc"--> 
<%
set upload=new upload_5xsoft
set file=upload.file("file1")
kzm=right(file.filename,4)
name="img/" & year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&kzm
   if file.fileSize>0 Then
    If kzm<>".gif" And kzm<>".jpg" Then
    response.Write("<script language=javascript>alert('只支持“.gif”和“.jpg”文件类型的图片上传！');history.go(-1)</script>")
	else		
		file.SaveAs Server.mappath(name)
			set conn=server.createobject("adodb.connection")
			connstr="Provider=Microsoft.jet.oledb.4.0;data source="&server.mappath("images/pic.mdb")
			conn.open connstr
			set rs=server.createobject("adodb.recordset")
			sql="select * from pic"
			rs.open sql,conn,1,3
			rs.addnew
			
			rs("name")=name
			rs("classid")=upload.form("classid")
			rs("pic_name")=upload.form("pic_name")
	
			rs.update
			rs.close
			set rs=nothing
			conn.close
			set rs=Nothing
	Response.Redirect "index.asp?page=1&"&"classid="&classid		
	End If
end If

set file=nothing
set upload=Nothing
%>
<SCRIPT language=JavaScript>
function CheckForm()
{
	if (document.form1.classid.value.length == 0) 
	{
		alert("请选择图片类别！");
		document.form1.classid.focus();   
		return false;
	}
		
    if (document.form1.pic_name.value.length == 0) 
	{
		alert("请填写图片名称！");
		document.form1.pic_name.focus();   
		return false;
	}
	
}
</script></center>