%
if Session("User") = "" then
Session("Mesg") = "Session Expired. Please Login to Proceed."
Session("SrcPath") = "menu.asp"
Response.Redirect "loginpage.asp"
end if%>
Web Control Panel - Comments - Findyourfate
Discussion Forum - View by Page
<%
function curPageURL()
dim s, protocol, port
if Request.ServerVariables("HTTPS") = "on" then
s = "s"
else
s = ""
end if
protocol = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & s
if Request.ServerVariables("SERVER_PORT") = "80" then
port = ""
else
port = ":" & Request.ServerVariables("SERVER_PORT")
end if
curPageURL = protocol & "://" & Request.ServerVariables("SERVER_NAME") &_
port & Request.ServerVariables("SCRIPT_NAME")
end function
function strLeft(str1,str2)
strLeft = Left(str1,InStr(str1,str2)-1)
end function
pagename=curPageURL()
Function Updatepageno1()
response.write(""&"" &"<" &"" &" " &"")
for i=1 to 10
response.write("" &""& i & ""& " "&"")
next
response.write(""&"" &">" &"" &" " &"")
response.write("" &""&""& "Next" &"" &""& ""& " ")
end function
function updatepageno()
no=request.QueryString("gopage")
if request.QueryString("gopage")="" or request.QueryString("gopage")=1 then
updatepageno1()
elseif request.QueryString("gopage")<=10then
updatepageno1()
elseif no=11 then
response.write "" &"" &""&"Previous" &""&"" &"" & " "
response.write(""&""&"<" &"" &" " &"")
for i=no-9 to no
response.write("" &"" & i& ""& " "&"")
next
if i <=TotalPages then
response.write(""&""&">" &"" &" " &"")
response.write("" &""&""& "Next" &"" &""& ""& " ")
end if
elseif no>11 then
response.write "" &"" &""&"Previous" &""&"" &"" & " "
response.write(""&""&"<" &"" &" " &"")
for i=no-9 to no
response.write("" &"" & i& ""& " "&"")
next
if i <=TotalPages then
response.write(""&""&">" &"" &" " &"")
response.write("" &""&""& "Next" &"" &""& ""& " ")
end if
else
response.write "" &"" &""&"Previous" &""&"" &"" & " "
response.write(""&""&"<" &"" &" " &"")
TotalPages = Rs.PageCount
for i=no to no+9
if i=" &""& i & ""& " "&"")
end if
next
response.write(""&"" &">" &"" &" " &"")
'TotalPages = oRs.PageCount
'j= request.QueryString("gopage")
if i <=TotalPages then
response.write("" &""&""& "Next" &"" &""& ""& " ")
end if
end if
end function
%>
<%
Set con = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
Set rs1 = Server.CreateObject("ADODB.RecordSet")
Set rs2 = Server.CreateObject("ADODB.RecordSet")
Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/") & "\data\newsletter.mdb;"
if request("mode")="update" then
rs2.open "select * from news_discussion where autocode="&request("sno")&"",con,3,2
if rs2.eof <>true then
rs2("memberid")=request("memberid")
rs2("writemessage")=request("comments")
rs2.update
end if
response.Redirect request("url")
elseif request("mode")="edit" then
rs2.open "select * from news_discussion where autocode="&request("sno")&"",con,3,2
if rs2.eof <>true then
memberid=rs2("memberid")
comments=rs2("writemessage")
end if
%>
User Comments- Modify
<%elseif request("mode")="delete" then
rs2.open "delete from news_discussion where autocode="&request("sno")&"",con,3,2
response.Redirect request("url")
else
rs.open "select * from news_discussion order by autocode desc",con,3,2
if rs.eof <>true then
Rs.PageSize =50
TotalPages = Rs.PageCount
iCnt = 0
if request.QueryString("gopage") <> "" then
pageNo=request.QueryString("gopage")
else
pageNo=1
end if
if rs.recordcount <= 10 then
rowcnt=rs.recordcount
else
rowcnt=rs.recordcount-((pageno*rs.pagesize)-rs.pagesize)
end if
' rowcnt=rs.recordcount-((pageno*rs.pagesize)-rs.pagesize)
If Request("gopage") = "" or Clng(Request("gopage")) > TotalPages then
Rs.AbsolutePage = 1
Else
if Clng(0 & Request("gopage")) > 1 then
rCnt = rCnt - (Rs.PageSize * (Clng(0 & Request("gopage"))-1))
End If
Rs.AbsolutePage = Clng(0 & Request("gopage"))
End If
strPageNos=""
j=1%>
S.No
|
Page Name |
<%
while not rs.eof and iCnt < Rs.PageSize %>
<% response.write rowcnt%>
|
<%
set rs1=con.execute("select * from news_discussion where pageurl='"&rs("pageurl")&"' order by entrydate desc")
if rs1.eof <>true then
%>
|
<%while not rs1.eof %>
<%=rs1("memberid")%> Wrote
<%=rs1("writemessage")%>
|
<%
rs1.movenext
wend%>
<%else%>
<%
rs.movenext
iCnt = iCnt + 1
rowcnt=rowcnt-1
wend
%>
|
<%
i=1
response.write(" " & "" &""&""& "<<" &"" &""& ""& " ")
i=i+1
if TotalPages>10 then
updatepageno()
else
strPageNos=""
j=1
For i = 1 to TotalPages
if i=rs.AbsolutePage then
strPageNos = strPageNos & " " &"" & i & ""& " "&""
else
if j >= 40 then
strPageNos = strPageNos & " " & "" & i & "" & " " &""
j=0
else
strPageNos = strPageNos & " " &"" & i &"" &" " &""
end if
end if
j=j+1
Next
response.write strPageNos
end if
response.write(" " & "" &""&""& ">>" &"" &""& ""& " ")
%>
|
<%else%>
<%end if
end if%>
|