Paging af Gæstebog, kan ikke overskue det selv
Hej allesammen.Nu har jeg kodet en gæstebog til min hjemmeside men som sædvanligt tænker jeg først på paging til sidst... dum dummere dummest
Så jeg smider 200 point til den der kan skrue et paging system ind i siden.
Her er koden (jeg ved den er lang :D)
Guestbook.asp
#####################################
<!--#include file="../Header.asp"-->
<%
Call Log
%>
<body>
<%
If Request.Querystring("uid") <> "" Then
Set rsProfile = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM accounts WHERE acct = '" & Request.Querystring("uid") & "'"
rsProfile.Open strSQL, Conn, 1, 3
Set rsProfileInfo = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM accounts_info WHERE acct = '" & Request.Querystring("uid") & "'"
rsProfileInfo.Open strSQL, Conn, 1, 3
Set rsProfileShow = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM accounts_info_show WHERE acct = '" & Request.Querystring("uid") & "'"
rsProfileShow.Open strSQL, Conn, 1, 3
Set rsGB = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM website_guestbooks WHERE acct = '" & Request.Querystring("uid") & "' ORDER BY id DESC"
rsGB.Open strSQL, Conn, 1, 3
If rsProfileInfo("tag") <> "" Then
Tag = " <b>[" & rsProfileInfo("tag") & "]</b>"
Else
Tag = ""
End If
StatusCalc = DateDiff("n", rsProfileInfo("last_activity"), Now())
If rsProfileInfo("status") = "Online" Then
OStatusPic = "<img src='../images/Online.png'>"
Else
OStatusPic = "<img src='../images/Offline.png'>"
End If
If CInt(StatusCalc) >= 10 AND rsProfileInfo("status") = "Online" Then
OStatusPic = "<img src='../images/Offline.png'>"
strSQL = "UPDATE accounts_info SET status = 'Offline' WHERE acct = '" & Request.Querystring("uid") & "'"
Conn.Execute(strSQL)
End If
If Session("Username") <> "" Then
%>
<form method="post" action="PostGuestbook.asp?uid=<%=Request.Querystring("uid")%>">
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#2d3f03">
<td style="border-bottom: thin dashed #000000;" height="20" colspan="2">Guestbook for <%=OStatusPic%><a href="Profile.asp?UID=<%=Request.Querystring("uid")%>"><b><%=rsProfile("login")%></b></a><%=Tag%></td>
</tr>
<tr bgcolor="#474747">
<td style="border-bottom: thin dashed #000000;" colspan="2" align="center"><textarea name="Message" cols="61" rows="6" style="background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;"></textarea></td>
</tr>
<tr bgcolor="#272727">
<td height="20"><input type="submit" value="Send!" style="background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;"> <input type="checkbox" name="PrivMsg"> Private Message</td>
<td align="right">Smileys</td>
</tr>
</table>
</form>
<%
End If
If rsGB.EOF Then
%>
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#2d3f03">
<td>This user doesn't have any guestbook messages.</td>
</tr>
</table>
<%
Else
%>
<form method="post" action="GuestbookAction.asp" name="gbForm" id="gbForm">
<%
If Session("Username") <> "" Then
If CInt(Request.Querystring("uid")) = CInt(Session("uid")) Then
If rsSAP("delete_gb_msg") = 1 Then
Buttons = "<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td><input type='button' value='Mark All' onclick='checkedAll();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Make Private' onclick='ChangeActionMp(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Delete' onclick='ChangeActionDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Complete Deletion' onclick='ChangeActionCDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'></td></tr></table><br>"
Else
Buttons = "<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td><input type='button' value='Mark All' onclick='checkedAll();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Make Private' onclick='ChangeActionMp(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Delete' onclick='ChangeActionDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'></td></tr></table><br>"
End If
ElseIf rsSAP("delete_gb_msg") = 1 AND rsSAP("private_gb_msg") = 1 Then
Buttons = "<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td><input type='button' value='Mark All' onclick='checkedAll();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Make Private' onclick='ChangeActionMp(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Delete' onclick='ChangeActionDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Complete Deletion' onclick='ChangeActionCDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'></td></tr></table><br>"
ElseIf rsSAP("delete_gb_msg") = 1 Then
Buttons = "<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td><input type='button' value='Mark All' onclick='checkedAll();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Delete' onclick='ChangeActionDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Complete Deletion' onclick='ChangeActionCDel(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'></td></tr></table><br>"
ElseIf rsSAP("private_gb_msg") = 1 Then
Buttons = "<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'><tr><td><input type='button' value='Mark All' onclick='checkedAll();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'> <input type='button' value='Make Private' onclick='ChangeActionMp(); document.gbForm.submit();' style='background-color: transparent; border: thin dashed #FFFFFF; color: #FFFFFF;'></td></tr></table><br>"
Else
Buttons = ""
End If
Else
Buttons = ""
End If
Response.Write Buttons
%>
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<%
Do until rsGB.EOF
Set rsPP = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM accounts WHERE acct = '" & rsGB("p_acct") & "'"
rsPP.Open strSQL, Conn, 1, 3
Set rsPPI = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM accounts_info WHERE acct = '" & rsGB("p_acct") & "'"
rsPPI.Open strSQL, Conn, 1, 3
Set rsSmileys = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM website_smileys ORDER BY id DESC"
rsSmileys.Open strSQL, Conn, 1, 3
If rsPPI("tag") <> "" Then
TagP = " <b>[" & Left(rsPPI("tag"),1) & "]</b>"
Else
TagP = ""
End If
StatusCalcP = DateDiff("n", rsPPI("last_activity"), Now())
If rsPPI("status") = "Online" Then
OStatusPic = "<img src='../images/Online.png'>"
Else
OStatusPic = "<img src='../images/Offline.png'>"
End If
If CInt(StatusCalcP) >= 10 Then
OStatusPic = "<img src='../images/Offline.png'>"
strSQL = "UPDATE accounts_info SET status = 'Offline' WHERE acct = '" & rsGB("p_acct") & "'"
Conn.Execute(strSQL)
End If
If rsGB("private") = 1 Then
Priv = "<b>PRIVATE</b> - "
Else
Priv = ""
End If
If rsGB("deleted") = 1 Then
Del = "<center><b>" & _
"##############################<br>" & _
"## THIS MESSAGE HAS BEEN DELETED ##<br>" & _
"##############################" & _
"</b></center><br>"
Else
Del = ""
End If
If CD(Date(),2) = CD(DatePart("d",rsGB("datetime")) & "-" & DatePart("m",rsGB("datetime"))& "-" & DatePart("yyyy",rsGB("datetime")),2) Then
PostDate = "Today, " & Z(DatePart("h",rsGB("datetime"))) & ":" & Z(DatePart("n",rsGB("datetime"))) & ":" & Z(DatePart("s",rsGB("datetime")))
ElseIf CD(DateAdd("d",-1,Now()),2) = CD(rsGB("datetime"),2) Then
PostDate = "Yesterday, " & Z(DatePart("h",rsGB("datetime"))) & ":" & Z(DatePart("n",rsGB("datetime"))) & ":" & Z(DatePart("s",rsGB("datetime")))
Else
PostDate = ProperDate(rsGB("datetime"),1)
End If
Answer = "<a href='Guestbook.asp?uid=" & rsGB("p_acct") & "'><b>See Guestbook</b></a>"
If rsSmileys.EOF Then
GBMessage = Replace(rsGB("message"),"<","<")
GBMessage = Replace(GBMessage,">",">")
GBMessage = Replace(GBMessage,vbCrLf,"<br>")
Else
GBMessage = Replace(rsGB("message"),"<","<")
GBMessage = Replace(GBMessage,">",">")
GBMessage = Replace(GBMessage,vbCrLf,"<br>")
Do until rsSmileys.EOF
GBMessage = Replace(GBMessage,rsSmileys("smiley"),"<img src='http://flexwow.servegame.com/images/smileys/" & rsSmileys("image") & "' border='0'>")
rsSmileys.MoveNext
Loop
End If
If Session("Username") <> "" Then
If CInt(Request.Querystring("uid")) = CInt(Session("uid")) Then
DelMsg = " <a onclick='check(" & rsGB("id") & ");ChangeActionDel();document.gbForm.submit();'><img src='../images/Delete.png' border='0' height='10' width='10'></a> <input type='checkbox' name='GBMark' id='" & rsGB("id") & "' value='" & rsGB("id") & "'>"
ElseIf rsSAP("delete_gb_msg") = 1 Then
DelMsg = " <a onclick='check(" & rsGB("id") & ");ChangeActionDel();document.gbForm.submit();'><img src='../images/Delete.png' border='0' height='10' width='10'></a> <input type='checkbox' name='GBMark' id='" & rsGB("id") & "' value='" & rsGB("id") & "'>"
Else
DelMsg = ""
End If
If rsGB("deleted") = 0 Then
If rsGB("private") = 0 Then
%>
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#2d3f03">
<td style="border-bottom: thin dashed #000000;"><%=Priv%><%=PostDate%> <%=OStatusPic%><b><a href="Profile.asp?uid=<%=rsPP("acct")%>"><%=rsPP("login")%></a></b><%=TagP%></td>
<td style="border-bottom: thin dashed #000000;" align="right"><%=Answer%><%=DelMsg%></td>
</tr>
<tr bgcolor="#474747">
<td colspan="2"><%=Del%><%=GBMessage%></td>
</tr>
</table>
<br>
<%
Else
If CInt(rsGB("acct")) = CInt(Session("uid")) OR CInt(rsGB("p_acct")) = CInt(Session("uid")) Then
%>
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#2d3f03">
<td style="border-bottom: thin dashed #000000;"><%=Priv%><%=PostDate%> <%=OStatusPic%><b><a href="Profile.asp?uid=<%=rsPP("acct")%>"><%=rsPP("login")%></a></b><%=TagP%></td>
<td style="border-bottom: thin dashed #000000;" align="right"><%=Answer%><%=DelMsg%></td>
</tr>
<tr bgcolor="#474747">
<td colspan="2"><%=Del%><%=GBMessage%></td>
</tr>
</table>
<br>
<%
End If
End If
Else
If Session("uid") = "1" Then
%>
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#2d3f03">
<td style="border-bottom: thin dashed #000000;"><%=Priv%><%=PostDate%> <%=OStatusPic%><b><a href="Profile.asp?uid=<%=rsPP("acct")%>"><%=rsPP("login")%></a></b><%=TagP%></td>
<td style="border-bottom: thin dashed #000000;" align="right"><%=Answer%><%=DelMsg%></td>
</tr>
<tr bgcolor="#474747">
<td colspan="2"><%=Del%><%=GBMessage%></td>
</tr>
</table>
<br>
<%
End If
End If
Else
If rsGB("deleted") = 0 Then
If rsGB("private") = 0 Then
%>
<table width="100%" border="0" style="border: thin dashed #000000;" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#2d3f03">
<td style="border-bottom: thin dashed #000000;"><%=Priv%><%=PostDate%> <%=OStatusPic%><b><a href="Profile.asp?uid=<%=rsPP("acct")%>"><%=rsPP("login")%></a></b><%=TagP%></td>
<td style="border-bottom: thin dashed #000000;" align="right"><%=Answer%></td>
</tr>
<tr bgcolor="#474747">
<td colspan="2"><%=Del%><%=GBMessage%></td>
</tr>
</table>
<br>
<%
End If
End If
End If
rsSmileys.Close
Set rsSmileys = Nothing
rsPP.Close
Set rsPP = Nothing
rsPPI.Close
Set rsPPI = Nothing
rsGB.MoveNext
Loop
%>
</table>
</form>
<%
Response.Write Buttons
End If
rsGB.Close
Set rsGB = Nothing
rsProfileShow.Close
Set rsProfileShow = Nothing
rsProfile.Close
Set rsProfile = Nothing
rsProfileInfo.Close
Set rsProfileInfo = Nothing
Else
Response.Write "The information given was incorrect"
End If
%>
<!--#include file="../Bottom.asp"-->
#####################################