⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 私密信息系统-PrivNote System v20080719 很好用的大家试试看
💻 ASP
字号:
<%
Dim NowTime
NowTime = Now()
%>
<%if Request.QueryString("key") ="" Then%>
<!--#include file="Inc/MD5.asp" -->
<!--#include file="Inc/head.asp" -->
<!--#include file="Inc/IsValid.asp" -->
<!--#include file="Inc/DelOutTime.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_CONN_STRING

'判断所提交信息合法性开始
if Trim(Request.Form("msg")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!发送信息为空!")
Elseif Trim(Request.Form("youEmail")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!您的邮箱为空!")
Elseif Trim(Request.Form("readTimeS")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!允许开始阅读时间为空!")
Elseif Trim(Request.Form("readTimeC")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!允许阅读结束时间为空!")

Elseif DateDiff("s",Trim(Request.Form("readTimeC")),Now()) > 0 Then
	Response.Redirect("Error.asp?ErrorInfo=错误!允许阅读结束时间已经过去!")

Elseif DateDiff("s",Request.Form("readTimeS"),Request.Form("readTimeC")) < 0  Then
	Response.Redirect("Error.asp?ErrorInfo=逻辑错误!结束时间比开始时间还早!")

Elseif Trim(Request.Form("sheEmail")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!阅读者邮箱为空!")
Elseif Trim(Request.Form("RNUM")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!允许阅读次数为空!")
Elseif Trim(Request.Form("RNUM")) > 10 Then
	Response.Redirect("Error.asp?ErrorInfo=错误!允许阅读次数不能大于10次!")
Elseif Trim(Request.Form("RNUM")) < 1 Then
	Response.Redirect("Error.asp?ErrorInfo=错误!允许阅读次数不能小于1次!")
Elseif Trim(Request.Form("key")) = "" Then
	Response.Redirect("Error.asp?ErrorInfo=错误!阅读密钥为空!")
Else'判断所提交信息合法性中间
	
    MM_editCmd.CommandText = "INSERT INTO [NoteTable] (Message, SenderEmail, ReadTimeStart, ReadTimeClose, ReaderEmail, ReadNumber, ReadKey, NowTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
	
'加密私密信息内容开始
Dim Message
if NoteJiaMi = "1" Then
	Dim objEncrypt
	Set objEncrypt = Server.CreateObject("myEncrypt.clsEncrypt")
	objEncrypt.KeyCode = Request.Form("key")'加密密钥
	Message = objEncrypt.Encrypt(Trim(Request.Form("msg")))
	Set objEncrypt = Nothing
Elseif NoteJiaMi = "0" Then
	Message = (Trim(Request.Form("msg")))
End if
'加密私密信息内容结束
	
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 203, 1, 1073741823, Message) ' adLongVarWChar

	if re2.Test(Request.Form("youEmail")) = False Then
		MM_editCmd.ActiveConnection.Close
		Response.Redirect("Error.asp?ErrorInfo=错误!邮件地址不正确!")
	Else
    		MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 50, Request.Form("youEmail")) ' adLongVarChar
	End if
	
	if re5.Test(Request.Form("readTimeS")) = False Then
		MM_editCmd.ActiveConnection.Close
		Response.Redirect("Error.asp?ErrorInfo=错误!开始时间不正确!")
	Else
    		MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 135, 1, -1, MM_IIF(Request.Form("readTimeS"), Request.Form("readTimeS"), null)) ' adDBTimeStamp
	End if
	
	if re5.Test(Request.Form("readTimeC")) = False Then
		MM_editCmd.ActiveConnection.Close
		Response.Redirect("Error.asp?ErrorInfo=错误!结束时间不正确!")
	Else
    		MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, -1, MM_IIF(Request.Form("readTimeC"), Request.Form("readTimeC"), null)) ' adDBTimeStamp
	End if
	
	if re2.Test(Request.Form("sheEmail")) = False Then
		MM_editCmd.ActiveConnection.Close
		Response.Redirect("Error.asp?ErrorInfo=错误!邮件地址不正确!")
	Else
    		MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 50, Request.Form("sheEmail")) ' adLongVarChar
	End if

    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, -1, MM_IIF(Request.Form("RNUM"), Request.Form("RNUM"), null)) ' adDouble

    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, 32, MD5(MD5(Trim(Request.Form("key")&NowTime)))) ' adLongVarChar
	MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, -1, MM_IIF(NowTime, NowTime, null)) ' adDBTimeStamp
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
	
'开始发送通知邮件
	
if re2.Test(Request.Form("youEmail")) = True Then

	toemail = ""&Request.Form("youEmail")&"" '邮件将发送的地址
	
	set jmail = server.createobject("jmail.message") '创建组件
	jmail.silent = true '开启错误码
	jmail.logging = true '打开日记访问
	jmail.charset = "gb2312" '邮件编码
	jmail.contentType = "text/html" '邮件格式(HTML:text/html)
	jmail.addrecipient toemail '邮件发送地址
	jmail.from = fromemail '发送邮件者地址
	jmail.FromName = ""&sysName&"特快专递"
	jmail.subject = ""&sysName&"发送者通知邮件" '邮件标题
	'获取系统安装路径开始
	k=split("" & Request.ServerVariables("PATH_INFO") & "","/") 
	n=ubound(k) 
	FileName=k(n)
	menu = replace(Request.ServerVariables("PATH_INFO"),FileName,"")
	host = Request.ServerVariables("Http_Host")
	URL = "http://"&host&menu
	'Response.Write URL
	'获取系统安装路径结束
	jmail.body = "您于"&sysName&"成功对 "&Request.Form("sheEmail")&" 进行了发送私密信息的操作<br /><br /><b>生成的私密信息阅读地址:</b><br /><a href='"&URL&"?key="&MD5(MD5(Request.Form("key")&NowTime))&"' target='_blank'>"&URL&"?key="&MD5(MD5(Request.Form("key")&NowTime))&"</a><br /><br /><b>阅读密钥您设置为:</b><br />"&Trim(Request.Form("key"))&"<br /><br /><b>阅读时限您设置为:</b><br />"&Request.Form("readTimeS")&" 到 "&Request.Form("readTimeC")&"<br /><br /><b>阅读次数您设置为:</b><br />"&Request.Form("RNUM")&"次<br /><br /><font color=red>请您注意:如果超过所设置的 允许阅读时间 或者达到 允许阅读的次数 这条私密信息将自动销毁。</font><p>(提醒:本邮件为系统自动发送 请勿回复 谢谢!) <br /><br />本邮件发出时系统时间为:["&NowTime&"] </p>" '邮件内容

	jmail.mailserverusername = username '登录邮件服务器用户名
	jmail.mailserverpassword = pass '登录邮件服务器密码

	jmail.priority = 3 '优先级(1-5)5为最高
	jmail.send(servername) '邮件发送
	set jmail = nothing '关闭对象
End if
'结束发送通知邮件

'开始发送通知阅读者邮件
if re2.Test(Request.Form("sheEmail")) = True Then

	toemail = ""&Request.Form("sheEmail")&"" '邮件将发送的地址

	set jmail = server.createobject("jmail.message") '创建组件
	jmail.silent = true '开启错误码
	jmail.logging = true '打开日记访问
	jmail.charset = "gb2312" '邮件编码
	jmail.contentType = "text/html" '邮件格式(HTML:text/html)
	jmail.addrecipient toemail '邮件发送地址
	jmail.from = fromemail '发送邮件者地址
	jmail.FromName = ""&sysName&"特快专递"
	jmail.subject = ""&sysName&"阅读者通知邮件" '邮件标题
	'获取系统安装路径开始
	k=split("" & Request.ServerVariables("PATH_INFO") & "","/") 
	n=ubound(k) 
	FileName=k(n)
	menu = replace(Request.ServerVariables("PATH_INFO"),FileName,"")
	host = Request.ServerVariables("Http_Host")
	URL = "http://"&host&menu
	'Response.Write URL
	'获取系统安装路径结束
	jmail.body = "您的朋友从"&sysName&"成功对您发送了一条私密信息<br /><b>您的朋友要求您在:"&Request.Form("readTimeS")&" 到 "&Request.Form("readTimeC")&" 这段时间内阅读。</b><br /><br />阅读地址:</b><br /><a href='"&URL&"?key="&MD5(MD5(Request.Form("key")&NowTime))&"' target='_blank'>"&URL&"?key="&MD5(MD5(Request.Form("key")&NowTime))&"</a><br /><br /><b>阅读密钥为:</b><br />"&Trim(Request.Form("key"))&"<br /><br /><br /><b>此私密信息您只能阅读:</b>"&Request.Form("RNUM")&" 次<br /><br /><font color=red>请您注意:如果超过发送者设置的 允许阅读时间 或者达到 允许阅读的次数 这条私密信息将自动销毁。</font><p>(提醒:本邮件为系统自动发送 请勿回复 谢谢!) <br /><br />本邮件发出时系统时间为:["&NowTime&"] </p>" '邮件内容

	jmail.mailserverusername = username '登录邮件服务器用户名
	jmail.mailserverpassword = pass '登录邮件服务器密码

	jmail.priority = 3 '优先级(1-5)5为最高
	jmail.send(servername) '邮件发送
	set jmail = nothing '关闭对象
End if
'结束发送通知阅读者邮件
	Response.Redirect("Error.asp?ErrorInfo=成功发送私密信息!")
End if'判断所提交信息合法性结束

  End If
End If
%>
<!------------Html------------->
<p style="color: green">让私密信息只能由指定的阅读者阅读!<br />
私密信息阅读后自动销毁,安全保障信息的准确传达与有效防止私密信息意外泄露!<br />
可指定阅读者允许阅读时限范围与允许阅读次数,私密信息可定制阅读密钥!<br />
阅读者阅读后将自动邮件通知发送人,如果您填写了接收通知邮箱的话~</p>

  <table width="500" border="0" cellpadding="0" cellspacing="2" bgcolor="#D4D0C8">
    <form name="form1" method="POST" action="<%=MM_editAction%>"><tr>
      <td height="20" valign="middle" bgcolor="#FFFFFF" class="TDBG">发送者邮箱:
        <input name="youEmail" type="text" id="youEmail" size="15" class="TDBG" title="输入信息发送者接收阅读通知的邮件地址,"/>
        &nbsp; 阅读者邮箱:
        <input name="sheEmail" type="text" id="sheEmail" size="15" class="TDBG"/>
        &nbsp;阅读次数:
        <select name="RNUM" class="TDBG" id="RNUM">
          <option value="1" selected class="TDBG">读一次</option>
          <option value="2" class="TDBG">读二次</option>
          <option value="3" class="TDBG">读三次</option>
          <option value="4" class="TDBG">读四次</option>
          <option value="5" class="TDBG">读五次</option>
          <option value="6" class="TDBG">读六次</option>
          <option value="7" class="TDBG">读七次</option>
          <option value="8" class="TDBG">读八次</option>
          <option value="9" class="TDBG">读九次</option>
          <option value="10"class="TDBG">读十次</option>
        </select></td>
    </tr>
    <tr>
      <td bgcolor="#345581"><textarea name="msg" cols="88" rows="10" id="msg" class="TDBG"></textarea></td>
    </tr>
    <tr>
      <td height="20" valign="middle" bgcolor="#FFFFFF" class="TDBG">阅读时限:
        <input name="readTimeS" type="text" id="readTimeS" value="<%=NowTime%>" size="15" class="TDBG"/>
-&gt;
<input name="readTimeC" type="text" id="readTimeC" value="<%=NowTime+1%>" size="15" class="TDBG"/>
<!--#include file="Inc/GetPsw.asp" -->
        &nbsp;
        阅读密钥:
        <input name="key" type="text" class="TDBG" id="key" value="<%=gen_key(8)%>" size="8">
        &nbsp;
        <input type="submit" name="Submit" value=">>Post It!<<" class="TDBG" /></td>
    </tr>
    <input type="hidden" name="MM_insert" value="form1">
    </form>
</table>
  <br />
  <!--#include file="Inc/foot.asp" -->
<%Else%>
<script language=javascript>setTimeout("document.form1.submit()",100)</script>
<form name="form1" method="post" action="http://<%=Request.ServerVariables("Http_Host")%>/Read.asp">
<input type="hidden" name="key" value="<%=Request.QueryString("key")%>">
</form>
<%End if%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -