www.gusucode.com > 翼动留言板 2.1源码程序 > Book_Write_Check.asp

    <%
Option Explicit
'************************************************************************************
'开发组		翼动工作室
'姓名		郑景德
'网名		旭日
'QQ			3178920
'个人网站		http://www.wingroom.com
'本页:
		'留言本系统留言提交处理
'
'************************************************************************************
%>
<!--#include file="inc/config.asp"-->
<!--#include file="inc/DBControl.asp"-->
<!--#include file="inc/Function.asp"-->

<%
Dim Cfg,Flib,DB
Dim Sql
Set Cfg = New Config
Set Db = New DBControl
Set Flib = New FunctionLib

Function GetFormItem(ItemValue)
	GetFormItem=Flib.FilterStr(Request.Form(ItemValue))
End Function

Dim UserName,Sex,Oicq,HomePage,Ip,Email,Title,Content,AddDate

	'获取表单信息
	UserName = Trim(GetFormItem("UserName"))
	Sex = Trim(GetFormItem("Sex"))
	Oicq = Trim(GetFormItem("Oicq"))
	HomePage = Trim(GetFormItem("HomePage"))
	Email = Trim(GetFormItem("Email"))
	Title = Trim(GetFormItem("Title"))
	Content = GetFormItem("Content")
	Ip = Request.ServerVariables("REMOTE_HOST")
	
	'验证姓名是否为空
	If UserName="" Then
		Flib.Alert "对不起,用户姓名不能为空!","BACK",1
		Response.End
	End If
	'验证留言标题是否为空
	If Title="" Then
		Flib.Alert "对不起,留言标题不能为空!","BACK",1
		Response.End
	End If
	'验证留言内容是否为空
	If Content="" Then
		Flib.Alert "对不起,留言内容不能为空!","BACK",1
		Response.End
	End If
	'验证Email格式
	'如果为空就不验证
	If Email<>"" Then
		If Not Flib.CheckEmail(Email) Then
			Flib.Alert "对不起,Email格式不正确!","BACK",1
			Response.End
		End If
	End If
	'验证QQ格式,纯数字
	If Oicq<>"" Then
		If Not Flib.CheckQQ(Oicq) Then
			Flib.Alert "对不起,QQ格式不正确!","BACK",1
			Response.End
		End If
	End If

	Db.Open()
	Sql = "INSERT INTO wr_BookList (UserName,Sex,Oicq,Email,Ip,HomePage,Title,Content,AddDate) Values('"& UserName &"','"& Sex &"','"& Oicq &"','"& Email &"','"& Ip &"','"& HomePage &"','"& Title &"','"& Content &"','"& Now() &"')"

	Db.ExeCute(Sql)
	Db.Close()

	If Session("Flag") = "Logined" Then
		Flib.Alert "提交成功!","Book_Manage.asp",0
	Else
		Flib.Alert "提交成功!","Default.asp",0
	End If
%>
<%
Set Cfg = Nothing
Set Db = Nothing
Set Flib = Nothing
%>