www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > master/myinfo.asp

    <!--#include file="check.asp"-->
<!-- #include file="../inc/conn.asp" -->
<!-- #include file="../inc/function.asp" -->
<!--#include file="../inc/asppage.asp"-->
<%
%>
<html>
<head>
<meta http-equiv="value-Type" value="text/html; charset=gb2312">
<title>myinfo</title>
<link href="css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function del(id)
{
	var ok;
	ok=confirm("删除后不可恢复!您确定要删除此相片吗?");
	if (ok==true)
	{
		window.location="myinfo.asp?action=del&id="+id;
	}
	else
	{}
}
	function lookpic()
	{
		document.getElementById('myphoto').innerHTML="<img src=\""+document.getElementById('file').value+"\" width=\"121\" height=\"163\">";
	}
</script>
</head>
<body topmargin="10" background="images/bg1024.gif">
<%
action=RequestSafeStr("action")
Select Case action
	Case "add"
		Call add()
	Case "save"
		Call save()
	Case "edit"
		Call edit()
	Case "editsave"
		Call editSave()
	Case "del"
		Call del()
	Case "top"
		Call top()
	Case else
		Call show()
End Select
%>

<%
Sub save()
	propertystr=RequestFormStr("propertystr")
	value=RequestFormStr("value")
	url=RequestFormStr("url")
	If propertystr="" Then
		Call MessageBox("请输入属性名称!","")
		Response.End
	End If
	If value="" Then
		Call MessageBox("请输入值!","")
		Response.End
	End If
	set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from myinfo"
	rs.open sql,conn,1,3
	rs.addnew
		rs("propertystr")=propertystr
		rs("value")=value
	rs.update
	rs.close
	Call MessageBox("添加属性成功!","myinfo.asp")
End Sub

Sub editSave()
	id=RequestFormNum("id")
	If id<>0 then
	propertystr=RequestFormStr("propertystr")
	value=RequestFormStr("value")
	url=RequestFormStr("url")
	If propertystr="" Then
		Call MessageBox("请输入属性名称!","")
		Response.End
	End If
	If value="" Then
		Call MessageBox("请输入值!","")
		Response.End
	End If
		set rs=Server.CreateObject("ADODB.Recordset")
		sql="select * from myinfo Where id="& id &""
		rs.open sql,conn,2,3
		If Not rs.eof then
			rs("propertystr")=propertystr
			rs("value")=value
		rs.update
		End If
		rs.close
		Call MessageBox("修改成功!","myinfo.asp")
	End If
End Sub

Sub show()
	sql="Select * From myinfo Order by id asc"
	Set mypage=new xdownpage   '创建对象
	mypage.getconn=conn    '得到数据库连接
	mypage.getsql=sql
	mypage.pagesize=20    '设置每一页的记录条数据为5条
	set rs=mypage.getrs()    '返回Recordset
	'Set rs=conn.Execute("Select * From myinfo Order by id desc")
%>
	<table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
		<tr> 
		  <th height="25" colspan="3">我的资料</th>
		</tr>
		<tr>
			<td class=Forumrow width="50">编号</td>
			<td class=Forumrow >属性/值</td>
			
		</tr>
		<%
		for i=1 to mypage.pagesize 
			If rs.eof Then
				Exit for
			End If 
		%>
		<tr> 
		<form action="" method="post">
		<input type="hidden" name="action" value="editsave">
		<input type="hidden" name="id" value="<%=rs("id")%>">
		  <td class=Forumrow><%=rs("id")%></td>
		  <td class=Forumrow align="left">
			<input type="text" name="propertystr" value="<%=rs("propertystr")%>">&nbsp;
			<input type="text" name="value" value="<%=rs("value")%>">&nbsp;
			<input type="submit" value="修改">
		</td>

			</form>
		</tr>
		<%
			rs.MoveNext
		Next
		%>
		<tr align="center"><td colspan="3" class=Forumrow><%mypage.showpage() %></td></tr>
	</table>
	<table width="98%" border="1" class="tableBorder" style="margin-top:5px;" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
	<form action="upmyphoto.asp" method="post" enctype="multipart/form-data" name="sub_upload" target="_self">
		<tr align="left">
			<td class=Forumrow>
				<span id="myphoto"><img src="../upfile/myphoto.jpg" width="121" height="163"></span>
				<br><input type="file" name="file" id="file" size="30" onchange="lookpic()">&nbsp;<input type="submit" name="submit" value="上传我的相片">(标准尺寸121X163,只支持jpg和gif格式,上传成功后,)
			</td>
			</tr></form>
	</table>
	
	
<%
	
End Sub

Sub add()
%>
<table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
	<form name="add" method="post" action="myinfo.asp">
	<input type="hidden" name="action" value="save">
    <tr> 
		<th height="25" colspan="2">添加属性</th>
    </tr>
    <tr> 
		<td width="15%" height="25" align="right" class=Forumrow>属性:</td>
		<td align="left" class=Forumrow>&nbsp;
			<input name="propertystr" type="text" value="" size="25" maxlength="20" style="width:80">&nbsp;</td>
    </tr>
    <tr> 
		<td width="15%" height="25" align="right" class=Forumrow>内容:</td>
		<td align="left" class=Forumrow>&nbsp;
			<input name="value" type="text" value="" size="25" style="width:300">&nbsp;</td>
    </tr>

	<tr>
		<td class=Forumrow></td>
		<td height="30" class=Forumrow>&nbsp;
			<input type="submit" name="Submit" value="添加" class="input1">
			<input type="reset" name="Submit" class="input1"></td>
	</tr>
  </form>
</table>
<%
End Sub

Sub edit()
	id=RequestQueryNum("id")
	Set rs=conn.Execute("Select * From myinfo Where id="& id &"")
	If Not rs.eof Then
%>
<table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
  <form name="add" method="post" action="myinfo.asp">
  <input type="hidden" name="action" value="editsave">
  <input type="hidden" name="id" value="<%=id%>">
    <tr> 
		<th height="25" colspan="2">修改属性</th>
    </tr>
    <tr> 
		<td width="15%" height="25" align="right" class=Forumrow>属性:</td>
		<td align="left" class=Forumrow>&nbsp;
			<input name="propertystr" type="text" value="<%=rs("propertystr")%>" size="25" maxlength="20" style="width:80">&nbsp;</td>
    </tr>
    <tr> 
		<td width="15%" height="25" align="right" class=Forumrow>内容:</td>
		<td align="left" class=Forumrow>&nbsp;
			<input name="value" type="text" value="<%=rs("value")%>"" size="25" style="width:300">&nbsp;</td>
    </tr>

	<tr>
		<td class=Forumrow></td>
		<td height="30" class=Forumrow>&nbsp;
			<input type="submit" name="Submit" value="修改" class="input1">
			<input type="reset" name="reset" class="input1"></td>
	</tr>
  </form>
</table>
<%
	End If
End Sub
%>
</body>
</html>