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

📄 z_dgsave.asp

📁 此文件为一个电子同学录
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="z_dgconn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/Char.asp" -->
<%
'---------------------
' write by fisher
' 本插件经由 fisher 修改适应岩岩电子同学录,并加入点歌收费
'---------------------
	stats="点歌控制面板"
	dim isfull,abgcolor
	isfull=false		
	founderr=false

	if not  founduser then
		errmsg=errmsg+"<br>"+"<li>客人不可以查阅点歌列表"
		errmsg=errmsg+"<br>"+"<li>请先<a href=login.asp><font color=blue>登录</font></a>,还没有<a href=reg.asp><font color=blue>注册</font></a>"
		call txl_error()
		response.end
	end if
	if founderr then
	   call head()
	   call head_var("错误信息",Request.ServerVariables("HTTP_REFERER"))
	   call txl_error()
        else
	   call head()
	   call head_var("点歌祝福","Z_dglistall.asp")
	   abgcolor="tablebody2"
        end if   
	
%>
		<table cellpadding=3 cellspacing=1 border=0 align=center class=tableborder1 width=<%=txl_body(19)%>>
			<tr>
				<th><a href=z_dglistall.asp><font color=white><b>所有点歌列表</b></font></a></th>
				<th><a href=z_dglistme.asp><font color=white><b>我的点歌列表</b></font></a></th>
				<th><a href=z_dgwrite.asp><font color=white><b>我要点歌</b></font></a></th>
			</tr>
			<tr>
				<td class=tablebody2 align=center valign=middle colspan="3">点手歌曲祝福你的好友</td>
			</tr>
		</table>
		<br>
<% 
dim lincept,lcontent,lmedianame,lurl
dim successmsg

lincept=replace(Request.Form("incept"),"'","")
lcontent=replace(Request.Form("content"),"'","")
lcontent=replace(server.htmlencode(lcontent),chr(13)," ")
lmedianame=replace(Request.Form("medianame"),"'","")
lurl=Request.Form("url")

if lincept="" then 
	errmsg=errmsg+"<br>"+"<li>请输入接收用户名"
	founderr=true
else
	if instr(lincept,"全体同学")>0 then
		lincept="全体同学"
		isfull=true
	else 	
		lincept=split(lincept,"|")
		if ubound(lincept)>=5 then
			errmsg=errmsg+"<br>"+"<li>最多只能发送给5个用户"
			founderr=true
		end if
	end if	
end if
if lmedianame="" then 
	errmsg=errmsg+"<br>"+"<li>请输入歌曲名"
	founderr=true
end if
if lurl="" or lurl="http://" then 
	errmsg=errmsg+"<br>"+"<li>请正确输入音乐地址"
	founderr=true
end if
if lcontent="" then 
	errmsg=errmsg+"<br>"+"<li>请输入祝福语"	
	founderr=true
end if
if len(lmedianame)>50 then '--------------判断名字
	errmsg=errmsg+"<br>"+"<li>歌曲名不能多于50字"
	founderr=true	
end if
if len(lcontent)>200 then '--------------判断名字
	errmsg=errmsg+"<br>"+"<li>祝福语不能多于200字"
	founderr=true	
end if
if founderr then
	call txl_error()
	response.end
end if
	dim haverr      '是否有不存在的用户『绿水青山』
	haverr=false
	call updata()
	call CloseDB()
	call success()
	'call dvbbs.activeonline()
	call foot()
	
	
'===================================
sub updata()
	dim ii

	if isfull then
			set rs=server.createobject("adodb.recordset")
			sql="select * from media" 
			rs.open sql,connDG,3,2
			rs.addnew
			rs("sender")=membername
			rs("incept")=lincept
			rs("sendtime")=now()
			rs("content")=lcontent
			rs("medianame")=lmedianame
			rs("url")=lurl
			rs.update
			rs.close
			set rs=nothing
			errmsg=""
			successmsg="<li>点歌祝福已成功发出!<br><li>你向所有的同学发送了点歌祝福<br><br>"	
	else	
		for ii=0 to ubound(lincept)
			set rs=server.createobject("adodb.recordset")
			sql="select username from [user] where realname='"&lincept(ii)&"'"
			rs.open sql,conn,1,1
			if rs.eof and rs.bof then
				errmsg=errmsg+"<br>"+"<li>论坛没有<font color=red>["&lincept(ii)&"]</font>这个用户"
				haverr=true
			else
				rs.close
				set rs=server.createobject("adodb.recordset")
				sql="select * from [user] where realname='"&membername&"'"
				rs.open sql,conn,1,3 
				if rs("usermoney")<100 then  '此处判断使用点歌必须拥有的最低资产标准,可自行修改为你所需要的
					errmsg=errmsg+"您的社区币已经低于<font color=#FF0000>100</font>元,不能再点歌了。每点一首歌将花费您<font color=#FF0000>20</font>元社区币<br>"
					haverr=true
				else
				rs("usermoney")=rs("usermoney")-20   '此处判断使用点歌所花费金钱标准,可自行修改为你所需要的
				rs.update
				rs.close
				
				sql="select * from media" 
				rs.open sql,connDG,3,2
				rs.addnew
				rs("sender")=membername
				rs("incept")=lincept(ii)
				rs("sendtime")=now()
				rs("content")=lcontent
				rs("medianame")=lmedianame
				rs("url")=lurl
				rs.update
				rs.close
				set rs=nothing
				
				dim sender,title,body
				sender=membername
				title="送给您的祝福"
				body="[color=green]"&membername&"[/color] 点了一首歌 [color=navy]"&lmedianame&"[/color] 给你!"&chr(10)&"祝福语:[color=blue]"&lcontent&"[/color] "&chr(10)&"[B][URL=Z_dglistme.asp]点击这里查看点歌[/URL][/B]"
				sql="insert into message(incept,sender,title,content,flag,DelR,DelS,issend) values('"&lincept(ii)&"','"&sender&"','"&title&"','"&body&"',0,0,0,1)"
				conn.Execute(sql)
				successmsg=successmsg+"<br><li>点歌祝福已成功发出!系统已向<font color=green>["&lincept(ii)&"]</font>发出短消息通知,并自动扣除您<font color=#FF0000>20</font>元社区币!"
				end if
			end if	
		next
	end if		
end sub

sub success()
%>
	<table cellpadding=3 cellspacing=1 border=0 align=center class=tableborder1 width=<%=txl_body(19)%>>
		<tr> 
		        <th colspan="2" width="100%"><b>点歌发送情况</b></th>
		</tr>
		<tr> 
		  <td width="100%" class=tablebody1><%if haverr then%><b>操作结果:</b><br><br><%=errmsg%><br><%=successmsg%><%else%><b>操作成功:</b><br><br><%=successmsg%><%end if%></td>
		</tr>
		<tr align="center"> 
		  <td width="100%" class=tablebody2>
			<a href="Z_dglistall.asp"> << 返回所有点歌列表</a>
		  </td>
		</tr>  
	</table>
<%
end sub
%>

⌨️ 快捷键说明

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