您目前尚未登陆,请选择【登陆】或【注册
首页->留言本类->晶晶Vb.net留言板源码>>default.aspx>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:晶晶Vb.net留言板源码
当前文件:文件类型 VbGuestBook/default.aspx打开代码结构图
普通视图
		            
1<%@ Page Language="vb" AutoEventWireup="false" Debug="false"%> 2<%@ Register TagPrefix="uc1" TagName="notice" Src="notice.ascx" %> 3<%@ Register TagPrefix="uc1" TagName="sysInfo" Src="sysInfo.ascx" %> 4<%@ Register TagPrefix="uc1" TagName="copy" Src="copy.ascx" %> 5<%@ Import namespace="system.data" %> 6<%@ Import namespace="system.data.oledb" %> 7<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 8<HTML> 9 <HEAD> 10 <title> 11 <%=ConfigurationSettings.appSettings("留言簿名称")%> 12 </title> 13 <Script language="vb" runat="server"> 14 Private Function Address(ByVal IP As String) 15 If IsNumeric(Left(IP, 2)) = True Then 16 Dim conn As OleDbConnection, comd As OleDbCommand, dr As OleDbDataReader 17 Dim str1 As String, str2 As String, str3 As String, str4 As String, num As long 18 If IP = "127.0.0.1" Then IP = "192.168.0.1" 19 IF Left(IP,8)="192.168." THEN 20 Address = "内部局域网" 21 EXIT Function 22 END IF 23 str1 = Left(IP, InStr(IP, ".") - 1) 24 IP = Mid(IP, InStr(IP, ".") + 1) 25 str2 = Left(IP, InStr(IP, ".") - 1) 26 IP = Mid(IP, InStr(IP, ".") + 1) 27 str3 = Left(IP, InStr(IP, ".") - 1) 28 str4 = Mid(IP, InStr(IP, ".") + 1) 29 IF isNumeric(str1)=False or isNumeric(str2)=False or isNumeric(str3)=False or isNumeric(str4)=False THEN 30 Address = "未知" 31 EXIT Function 32 END IF 33 num = Int(str1) * 256 * 256 * 256 + Int(str2) * 256 * 256 + Int(str3) * 256 + Int(str4) - 1 34 conn = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Server.MapPath(ConfigurationSettings.AppSettings("数据库"))) 35 comd = New OleDbCommand("Select Top 1 country,city From 鉴定 Where ip1 <=" + num.ToString + " and ip2 >=" + num.ToString, conn) 36 comd.connection.open() 37 dr = comd.ExecuteReader 38 If dr.Read Then 39 Dim temStr as String 40 temStr=dr(0) & dr(1) 41 IF temStr.Length>17 THEN 42 Address = "<span title=" + temStr + ">" + Left(temStr,15) + "...</span>" 43 ELSE 44 Address = temStr 45 END IF 46 Else 47 Address = "亚洲" 48 End If 49 dr.Close() 50 comd.connection.close() 51 comd.Dispose() 52 conn.Close() 53 conn.Dispose() 54 Else 55 Address = "未知" 56 End If 57 End Function 58 Private Sub count() 59 Dim cie As HttpCookie, newguest As Boolean = False 60 cie = Request.cookies("rwfj") 61 If cie is nothing Then 62 newguest = True 63 Else 64 If cie("name") <> "guest" Then newguest = True 65 End If 66 Dim ds As DataSet 67 ds = New DataSet() 68 ds.ReadXml(Server.MapPath("data/count.xml")) 69 If DateValue(ds.Tables(0).Rows(0)(4)) <> DateValue(Date.Now) Then 70 ds.Tables(0).Rows(0)(0) = 0 71 ds.Tables(0).Rows(0)(1) = 0 72 End If 73 If newguest = True Then 74 cie = New HttpCookie("rwfj") 75 cie.Values.Add("name", "guest") 76 Response.AppendCookie(cie) 77 ds.Tables(0).Rows(0)(1) = CInt(ds.Tables(0).Rows(0)(1)) + 1 78 ds.Tables(0).Rows(0)(3) = CInt(ds.Tables(0).Rows(0)(3)) + 1 79 End If 80 ds.Tables(0).Rows(0)(4) = Date.Now 81 ds.AcceptChanges() 82 ds.WriteXml(Server.MapPath("data/count.xml")) 83 ds.Clear() 84 ds.Dispose() 85 End Sub 86 </Script> 87 <meta content="Microsoft Visual Studio .NET 7.0" name="GENERATOR"> 88 <meta content="Visual Basic 7.0" name="CODE_LANGUAGE"> 89 <meta content="JavaScript" name="vs_defaultClientScript"> 90 <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> 91 <LINK href="Styles.css" type="text/css" rel="stylesheet"> 92 </HEAD> 93 <body> 94 <form id="Form1" method="post" runat="server"> 95 <% 96 Call count() 97 Dim color1 as string,color2 as string,color3 as string,color4 as string,color5 as string 98 color1=ConfigurationSettings.appSettings("标题") 99 color2=ConfigurationSettings.appSettings("时间栏") 100 color3=ConfigurationSettings.appSettings("留言内容") 101 color4=ConfigurationSettings.appSettings("回复内容") 102 color5=ConfigurationSettings.appSettings("表格背景") 103%> 104 <TABLE id="Table1" style="MARGIN-TOP: -15px" cellSpacing="1" cellPadding="1" width="750" align="center" border="0"> 105 <TR> 106 <TD colSpan="2"><uc1:notice id="Notice1" runat="server"></uc1:notice></TD> 107 </TR> 108 <TR> 109 <TD vAlign="top" align="middle" width="50%"><uc1:sysinfo id="SysInfo1" runat="server"></uc1:sysinfo></TD> 110 <TD vAlign="top" align="middle" width="50%"> 111 <TABLE id="Table2" cellSpacing="1" cellPadding="1" width="90%" border="0"> 112 <TR> 113 <TD></TD> 114 </TR> 115 <TR> 116 <TD vAlign="top" align="middle"> 117 <% 118 Dim i As Integer, page As String, pagesize As Integer, nowpage As Integer, AllRecord As Integer 119 Dim allpage As Integer 120 i = 0 121 page = Request.QueryString("page") 122 If page = "" Or IsNumeric(page) = False Then 123 nowpage = 1 124 Else 125 nowpage = Int(page) 126 End If 127 pagesize = ConfigurationSettings.AppSettings("每页留言数量") 128 Dim conn As OleDbConnection, da As OleDbDataAdapter, ds As DataSet, sql As String 129 Dim comd As OleDbCommand, dr As OleDbDataReader 130 sql = "Select Count(*) From 留言" 131 conn = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Server.MapPath(ConfigurationSettings.AppSettings("数据库"))) 132 comd = New OleDbCommand(sql, conn) 133 comd.Connection.Open() 134 dr = comd.ExecuteReader 135 If dr.Read Then AllRecord = dr(0) 136 dr.Close() 137 comd.Connection.Close() 138 comd.Dispose() 139 if allrecord=0 THEN 140 Response.write("<TABLE width=530 border=0><tr><td align=center height=200>当前还没有留言</td></tr></table>") 141 else 142 If AllRecord Mod pagesize = 0 Then 143 allpage = AllRecord \ pagesize 144 Else 145 allpage = AllRecord \ pagesize + 1 146 End If 147 if nowpage>allpage then nowpage=allpage 148 sql="Select * From 留言 Order By 时间 DESC" 149 da = New OleDbDataAdapter(sql, conn) 150 ds=New dataset 151 da.Fill(ds, (nowpage - 1) * pagesize, pagesize, "ly") 152 For i = 0 To ds.Tables(0).Rows.Count-1 153 Dim temTime as Date,temStr as String,IP as string 154 temTime=ds.Tables(0).Rows(i)(10) 155 temStr=Year(temTime).ToString+""+Month(temTime).ToString+""+Day(temTime).ToString+""+Hour(temTime).ToString+""+Minute(temTime).ToString+"" 156 IF Ucase(ConfigurationSettings.appSettings("允许查看IP"))="NO" AND Session("name")<>ConfigurationSettings.appSettings("站长") THEN 157 IP="(已设置保密)" 158 ELSE 159 IP=ds.Tables(0).Rows(i)(8)+""+Address(ds.Tables(0).Rows(i)(8))+"" 160 END IF 161%> 162 <TABLE id=Table3 style="MARGIN-BOTTOM: 5px" cellSpacing=0 cellPadding=1 width=530 bgColor="<%=color5%>" border=0> 163 <TR> 164 <TD style="BACKGROUND-POSITION: center bottom; FONT-SIZE: 10pt; BACKGROUND-ATTACHMENT: scroll; BACKGROUND-IMAGE: url(images\bar11.JPG); BACKGROUND-REPEAT: no-repeat" width="100%" colSpan="3" height="32">&nbsp; 165 <STRONG><FONT color="<%=color1%>"> 166 <%=Cstr((nowpage - 1) * pagesize+i+1)+"."+ds.Tables(0).Rows(i)(1)%> 167 </FONT></STRONG> 168 </TD> 169 </TR> 170 <TR> 171 <TD style="BACKGROUND-POSITION: center top; BACKGROUND-ATTACHMENT: fixed; BACKGROUND-IMAGE: url(images\bar2.JPG); BACKGROUND-REPEAT: repeat-y" width="3"></TD> 172 <TD style="PADDING-LEFT: 2px" width="524"> 173 <TABLE id="Table4" style="MARGIN-TOP: -1px; MARGIN-LEFT: -1px" cellSpacing="0" cellPadding="0" width="100%" border="0"> 174 <TR> 175 <TD style="BACKGROUND-POSITION: center top; PADDING-LEFT: 2px; BACKGROUND-ATTACHMENT: fixed; BACKGROUND-IMAGE: url(images\bar4.JPG); BACKGROUND-REPEAT: repeat-x" vAlign="top" colSpan="2" height="18"><FONT color="<%=color2%>"> 176 发表时间:<%=temStr%>&nbsp; IP:<%=IP%></FONT></TD> 177 </TR> 178 <TR> 179 <TD align="middle" width="116" rowSpan="2"><IMG width=90 height=90 src="face\<%=ds.Tables(0).Rows(i)(11)%>"><BR> 180 <BR> 181 <TABLE id="Table5" cellSpacing="1" cellPadding="1" width="100%" border="0"> 182 <TR> 183 <TD style="FILTER: glow(color=#9898BA,strength=3)" align="middle"><FONT color="#990000"><FONT size="2"><%=ds.Tables(0).Rows(i)(3)%></FONT><BR> 184 </FONT>(<%=ds.Tables(0).Rows(i)(4)%>)</TD> 185 </TR> 186 </TABLE> 187 </TD> 188 <TD style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px; HEIGHT: 71px" width="408"> 189 <FONT color="<%=color3%>">