<%@ codepage ="936" %>
<!--#include file="mycartconn/conn.asp" -->
<!--#include file="mycartconn/Function.asp"-->
<!--#include file="mycartconn/ubbcode.asp"-->
<!--#include file="mycartconn/fso.asp"-->
<!--#include file="mycartconn/page.asp"-->
<!--#include file="mycartconn/md5.asp"-->
<!--#include file="mycartconn/je.asp"-->
<%
dim action
action=server.htmlencode(request("action"))
if action="checklogin" then 
	If request.Cookies(my_url)("huiyuan")<>"" And request.Cookies(my_url)("hypwd")<>"" Then
		response.write "1"
	Else
		response.write "0"
	End if
end If
if action="logout" then 
	'*****************************************更新在线会员表
	'判断是否使用了代理
	if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
		ip=Request.ServerVariables("REMOTE_ADDR")
	else
		ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	end if

	set jilu=conn.execute("select name,sj from online where name='"&FilterJs(replace(Request.Cookies(my_url)("huiyuan"),"'",""))&"'")
	if jilu.eof then
		conn.execute("delete online where ip='"&ip&"' and name='游客'")
	Else
		onlinesj=datediff("n",rs_dj("sj"),now())
		conn.execute("update djcount set onlinesj=onlinesj+"&onlinesj&" where huiyuan='"&rs_dj("name")&"'")
		conn.execute("delete online where name='"&replace(Request.Cookies(my_url)("huiyuan"),"'","")&"'")
	end if
	jilu.close:set jilu=Nothing
	'*****************************************

	Response.Cookies(my_url)("huiyuan")=""
	Response.Cookies(my_url)("userid")=""
	Response.Cookies(my_url)("usernick")=""
	Response.Cookies(my_url)("hypwd")=""
	Response.Cookies(my_url)("DailiID")=""
	response.redirect "index.asp"
end If

If action="modpass" then   '修改密码
	if Request("userpass")<>"" And Request("newpass")<>""  then
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="select password from huiyuan where huiyuan='"&FilterJs(replace(Request.Cookies(my_url)("huiyuan"),"'",""))&"' and password='"&md5(request("userpass"))&"'"
		rs.open sql,conn,1,3
		if rs.eof then
			Response.Write "0"
		else
			rs("password")=md5(request("newpass"))
			Response.Cookies(my_url)("hypwd")=md5(request("newpass"))
			rs.update
			rs.close
			set rs=nothing
			Response.Write "1"
		end if
	end if
End if

If action="getpass" then   '找回密码
	email=FilterJs(lcase(request("email")))
	num=FilterJs(request("num"))
	if Session("ValidCode")<>cstr(trim(num)) then
		Response.Write "0"
		response.end
	end If
	newpass=Right(MakedownName(),6)
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select id from huiyuan where huiyuan='"&replace(email,"'","")&"' or mail='"&replace(email,"'","")&"'"
	rs.open sql,conn,1,1
	if Not (rs.bof And rs.eof) then
		SenderName="info@nanyangren.com" 
		SenderPass="123456"
		MailServer="mail.nanyangren.com" 
		Sender="info@nanyangren.com"        '发件人邮箱
		Subject=my_name&"密码找回"

		body="<style>"
		body=body & "BODY{FONT-FAMILY: '宋体';FONT-SIZE: 9pt;text-decoration: none;line-height: 150%;FONT-SIZE: 9pt;background:#ffffff;}"
		body=body & "TD{FONT-FAMILY: '宋体';FONT-SIZE: 9pt;}"
		body=body & "</style>" &vbcrlf
		body=body & "<BR>您好！您在<a href='"&myurl&"' target=_blank>"&my_name&"</a>注册的密码被初始是化为："&newpass
		conn.execute("update huiyuan set password='"&md5(newpass)&"' where huiyuan='"&replace(email,"'","")&"' or mail='"&replace(email,"'","")&"'")
		message=SendMail(MailServer,email,Subject,body,Sender,SenderName,SenderPass)
		if message="OK" then
			Response.Write "1"
		else
			Response.Write "0"
		end If
	Else
		Response.Write "0"
	End If
	rs.close
	Set rs=nothing
End if

'用户注册开始///*********************************************************************************
if action="register" then 
	email=FilterJs(lcase(request("email")))
	pwd=request("pwd")

	server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
	server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))	
	if not mid(server_v1,8,len(server_v2))=server_v2 then
		Response.Write "104"
		response.end
	end if

	if Session("ValidCode")<>cstr(trim(request("num"))) then
		Response.Write "0"
		response.end
	end If

	If Not IsValidEmail(email) Then
		response.write "3"
		response.end
	End If

	username=Split(email,"@")(0)
	If InStr(username,"'")>0 Or InStr(username,",")>0 Or  InStr(username," ")>0 Or InStr(username,".")>0 Then
		response.write "1"
		response.end
	End If
	
	If Len(pwd)<6 Then
		response.write "2"
		response.end
	End If

	set rs = conn.execute("select huiyuan from huiyuan where huiyuan='"&email&"'")
	if not (rs.bof And rs.eof) Then
		response.write "201"
		response.End
	end If
	rs.close
	Set rs=Nothing
	
	if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
	ip=Request.ServerVariables("REMOTE_ADDR")
	else
	ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	end If

	set rs = conn.execute("select top 1 ip,sj from huiyuan where ip='"&ip&"' order by id desc")
	if not (rs.bof And rs.eof) Then
		if datediff("n",cdate(rs("sj")),now())<10 then
			Response.Write "301"
			response.end
		End if
	end If
	rs.close
	Set rs=nothing

	set rs=server.createobject("adodb.recordset")
	sql="select huiyuan,password,nickname,xb,img,kind,mail,ip,ip2,DailiID,owner,je2 from huiyuan"
	rs.open sql,conn,1,3

	'添加一个用户到数据库
	rs.addnew
	rs("huiyuan")=email
	rs("password")=md5(pwd)
	rs("nickname")=username
	rs("xb")="隐藏"
	rs("img")="face/mofahe.jpg"
	rs("kind")=1
	rs("mail")=email
	rs("ip") = ip
	rs("ip2") = ip
	rs("je2")= 100
	rs("owner")=1
	rs("DailiID")=0
	rs.update
	rs.close
	set rs=Nothing
	
	if huiyuan_yz<>"1" then
		conn.execute("Update huiyuan set zt=1,userid=id where huiyuan='"&email&"'")
		Response.Cookies(my_url)("huiyuan")=email
		Response.Cookies(my_url)("userid")=conn.execute("select id from huiyuan where huiyuan='"&email&"'")(0)
		Response.Cookies(my_url)("usernick")=username
		Response.Cookies(my_url)("hypwd")=md5(pwd)
		Response.Cookies(my_url)("DailiID")=0
		'*****************************************载入在线会员表中
		set jilu=conn.execute("select name from online where name='"&email&"'")
		if jilu.eof then
		conn.execute("delete online where ip='"&ip&"' and name='游客'")
		conn.execute("insert into online (name,ip,pic,DailiID)VALUES('"&email&"','"&ip&"',1,0)")
		else
		conn.execute("update online set name='"&email&"',sj='"&now()&"',ip='"&ip&"' where name='"&email&"'")
		end if
		jilu.close:set jilu=nothing

		'*****************************************载入会员等级库
		set userdj=conn.execute("select huiyuan from djcount where huiyuan='"&email&"'")
		if userdj.eof or userdj.bof then
		  conn.execute("insert into djcount (huiyuan,DailiID)VALUES('"&email&"',0)")
		end if
		userdj.close:set userdj=nothing
		'***************************************************************************************
		Response.Cookies(my_url)("login_sj")=now()
	End If
	
	response.write "5"
	response.end
End If
'用户注册结束///*********************************************************************************

if action="login" Then   '用户登陆

	inputnum=request("num")
	If Session("ValidCode")<>inputnum Then
		response.write "0"
		response.end
	End if

	if datediff("s",cdate(Request.Cookies(my_url)("login_sj")),now())<30 then
		Response.Write "1"
		response.end
	Else

		email=FilterJs(LCase(request("email")))
		huiyuan=Split(email,"@")(0)
		password=md5(request("pwd"))
		issavelogin=request("issavelogin")

		set rs=server.createobject("adodb.recordset")
		sql="select huiyuan,nickname,userid,password,je2,sj2,js,zt,ip2,dayleavecount,daypingcount,DailiID,vip from huiyuan where huiyuan='"&email&"' and password='"&password&"'"
		rs.open sql,conn,1,3
		if not(rs.bof and rs.eof) then
			if email=rs("huiyuan") and password=rs("password") then
				if rs("zt")=1 Then
				
					Select Case CInt(rs("vip"))
					Case 0
						je_login=my_je02
					Case 1
						je_login=my_je02_01
					Case 2,3,4
						je_login=my_je02_02
					End select

					if datediff("d",rs("sj2"),now())>0 then
						rs("je2")=rs("je2")+je_login
						rs("dayleavecount")=0
						rs("daypingcount")=0

						'加入金币消费记录
						Set rs_je=Server.CreateObject("ADODB.Recordset")
						sql_je="select * from je"
						rs_je.open sql_je,conn,1,3 
						rs_je.addnew
						rs_je("je")=je_login
						rs_je("lx")=1
						rs_je("huiyuan_1")=email
						rs_je("bz")="每天第一次登录"
						rs_je("sj")=Now()
						rs_je("DailiID")=rs("DailiID")
						rs_je.update
						rs_je.close
						Set rs_je=Nothing
					end if
					rs("sj2")=now()
					rs("js")=rs("js")+1

					'判断是否使用了代理
					if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
						ip=Request.ServerVariables("REMOTE_ADDR")
					else
						ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
					end if
					rs("ip2")=ip
					rs.update
					Response.Cookies(my_url)("huiyuan")=rs("huiyuan")
					Response.Cookies(my_url)("userid")=rs("userid")
					Response.Cookies(my_url)("usernick")=rs("nickname")
					Response.Cookies(my_url)("hypwd")=rs("password")
					Response.Cookies(my_url)("DailiID")=rs("DailiID")
					passport_hd_ishidden=request("passport_hd_ishidden")
					If passport_hd_ishidden="" Then passport_hd_ishidden=0
					session("passport_hd_ishidden")=passport_hd_ishidden
					issavelogin=request("issavelogin")
					if issavelogin="" then issavelogin=0
					if issavelogin<>0 then
						Response.Cookies(my_url).Expires=date()+int(issavelogin*365)
					end if

					'*****************************************载入在线会员表中
					set jilu=conn.execute("select name from online where name='"&rs("huiyuan")&"'")
					if jilu.eof then
					conn.execute("delete online where ip='"&ip&"' and name='游客'")
					conn.execute("insert into online (name,ip,pic,DailiID)VALUES('"&rs("huiyuan")&"','"&ip&"',1,"&rs("DailiID")&")")
					else
					conn.execute("update online set name='"&rs("huiyuan")&"',sj='"&now()&"',ip='"&ip&"' where name='"&rs("huiyuan")&"'")
					end if
					jilu.close:set jilu=nothing

					'*****************************************载入会员等级库
					set userdj=conn.execute("select huiyuan from djcount where huiyuan='"&rs("huiyuan")&"'")
					if userdj.eof or userdj.bof then
					  conn.execute("insert into djcount (huiyuan,DailiID)VALUES('"&rs("huiyuan")&"',"&rs("DailiID")&")")
					end if
					userdj.close:set userdj=nothing
					'***************************************************************************************
					Response.Cookies(my_url)("login_sj")=now()

					response.write "4"
					response.end

				elseif rs("zt")=0 then
					response.write "2"
					response.end
				elseif rs("zt")=2 then
					response.write "3"
					response.end
				end if
			else
				response.write "205"
				response.end
			end if
		Else
			rs.close

			'自动注册并登陆
			username=Split(email,"@")(0)
			If InStr(username,"'")>0 Or InStr(username,",")>0 Or  InStr(username," ")>0 Or InStr(username,".")>0 Then
				response.write "205"
				response.end
			End If
			
			If Len(request("pwd"))<6 Then
				response.write "204"
				response.end
			End If

			set rs = conn.execute("select huiyuan from huiyuan where huiyuan='"&lcase(email)&"'")
			if not (rs.bof And rs.eof) Then
				response.write "205"
				response.End
			end If
			rs.close
			Set rs=Nothing
			
			if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
			ip=Request.ServerVariables("REMOTE_ADDR")
			else
			ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
			end If

			set rs = conn.execute("select top 1 ip,sj from huiyuan where ip='"&ip&"' order by id desc")
			if not (rs.bof And rs.eof) Then
				if datediff("n",cdate(rs("sj")),now())<10 then
					Response.Write "301"
					response.end
				End if
			end If
			rs.close
			Set rs=nothing

			set rs=server.createobject("adodb.recordset")
			sql="select huiyuan,password,nickname,xb,img,kind,mail,ip,ip2,DailiID,owner,je2 from huiyuan"
			rs.open sql,conn,1,3

			'添加一个用户到数据库
			rs.addnew
			rs("huiyuan")=email
			rs("password")=password
			rs("nickname")=username
			rs("xb")="隐藏"
			rs("img")="face/mofahe.jpg"
			rs("kind")=1
			rs("mail")=email
			rs("ip") = ip
			rs("ip2") = ip
			rs("owner")=1
			rs("je2")= 100
			rs("DailiID")=0
			rs.update
			rs.close
			set rs=Nothing
			
			if huiyuan_yz<>"1" then
				conn.execute("Update huiyuan set zt=1,userid=id where huiyuan='"&email&"'")
				Response.Cookies(my_url)("huiyuan")=email
				Response.Cookies(my_url)("userid")=conn.execute("select id from huiyuan where huiyuan='"&email&"'")(0)
				Response.Cookies(my_url)("usernick")=username
				Response.Cookies(my_url)("hypwd")=password
				Response.Cookies(my_url)("DailiID")=0

				'*****************************************载入在线会员表中
				set jilu=conn.execute("select name from online where name='"&email&"'")
				if jilu.eof then
				conn.execute("delete online where ip='"&ip&"' and name='游客'")
				conn.execute("insert into online (name,ip,pic,DailiID)VALUES('"&email&"','"&ip&"',1,0)")
				else
				conn.execute("update online set name='"&email&"',sj='"&now()&"',ip='"&ip&"' where name='"&email&"'")
				end if
				jilu.close:set jilu=nothing

				'*****************************************载入会员等级库
				set userdj=conn.execute("select huiyuan from djcount where huiyuan='"&email&"'")
				if userdj.eof or userdj.bof then
				  conn.execute("insert into djcount (huiyuan,DailiID)VALUES('"&email&"',0)")
				end if
				userdj.close:set userdj=nothing
				'***************************************************************************************
				Response.Cookies(my_url)("login_sj")=now()

				response.write "4"
				response.end

			End If

			response.write "5"
			response.end
		end If

		rs.close
		set rs=Nothing

	End IF
End if

if action="checknum" Then   '验证码
	inputnum=request("inputnum")
	If Cstr(Session("ValidCode"))=Cstr(inputnum) Then
		response.write "1"
	Else
		response.write "0"
	End if
End if

if action="checkemail" Then   '验证Email
	email=FilterJs(Replace(request("email"),"'",""))
	If IsValidEmail(email) Then
		username=Split(email,"@")(0)
		If InStr(username,"'")>0 Or InStr(username,",")>0 Or  InStr(username," ")>0 Or InStr(username,".")>0 Then
			response.write "1"
			response.end
		End if
		set rs = conn.execute("select huiyuan from huiyuan where huiyuan='"&lcase(email)&"'")
		if not (rs.bof And rs.eof) then
			response.write "1"
		else
			response.write "0"  '正确
		end If
		rs.close
		Set rs=nothing
	Else
		response.write "1"
	End If
End if

if action="makeslide_save" then 
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.redirect "/login.asp"
		response.end
	End If
	bh=year(date) & right("00"&month(date),2) & right("00"&day(date),2)
	formPath="/upload/conver/"&bh
	call add_myfso(formPath)

	slide_tmp_width = server.htmlencode(FilterJs(request("slide_tmp_width")))
	If slide_tmp_width="" Then slide_tmp_width=0
	slide_tmp_notification = server.htmlencode(FilterJs(request("slide_tmp_notification")))
	slide_tmp_height = server.htmlencode(FilterJs(request("slide_tmp_height")))
	If slide_tmp_height="" Then slide_tmp_height=0
	slide_tmp_border = server.htmlencode(FilterJs(request("slide_tmp_border")))
	slide_tmp_style = server.htmlencode(FilterJs(request("slide_tmp_style")))
	slide_tmp_userid = server.htmlencode(FilterJs(request("slide_tmp_userid")))
	slide_tmp_myspaceid = server.htmlencode(FilterJs(request("slide_tmp_myspaceid")))
	If slide_tmp_myspaceid="" Then slide_tmp_myspaceid=0
	slide_tmp_theme = server.htmlencode(FilterJs(request("slide_tmp_theme")))
	slide_tmp_music_id = server.htmlencode(FilterJs(request("slide_tmp_music_id")))
	If slide_tmp_music_id="" Then slide_tmp_music_id=0
	slide_tmp_music = server.htmlencode(FilterJs(request("slide_tmp_music")))
	slide_tmp_background = server.htmlencode(FilterJs(request("slide_tmp_background")))
	slide_tmp_play_mode = server.htmlencode(FilterJs(request("slide_tmp_play_mode")))
	If slide_tmp_play_mode="" Then slide_tmp_play_mode=0
	slide_tmp_bgcolor = server.htmlencode(FilterJs(request("slide_tmp_bgcolor")))
	slide_tmp_plus = server.htmlencode(FilterJs(request("slide_tmp_plus")))
	slide_tmp_caption_mode = server.htmlencode(FilterJs(request("slide_tmp_caption_mode")))
	If slide_tmp_caption_mode="" Then slide_tmp_caption_mode=0
	slide_tmp_caption_transparent = server.htmlencode(FilterJs(request("slide_tmp_caption_transparent")))
	slide_tmp_caption_fontsize = server.htmlencode(FilterJs(request("slide_tmp_caption_fontsize")))
	slide_tmp_caption_fontcolor = server.htmlencode(FilterJs(request("slide_tmp_caption_fontcolor")))
	slide_tmp_caption_bgcolor = server.htmlencode(FilterJs(request("slide_tmp_caption_bgcolor")))
	slide_tmp_caption_speed = server.htmlencode(FilterJs(request("slide_tmp_caption_speed")))
	If slide_tmp_caption_speed="" Then slide_tmp_caption_speed=0
	slide_tmp_images = server.htmlencode(FilterJs(request("slide_tmp_images")))
	name = server.htmlencode(FilterJs(request("name")))
	cate = server.htmlencode(FilterJs(request("cate")))
	tags = server.htmlencode(FilterJs(request("tags")))
	share_set = server.htmlencode(FilterJs(request("share_set")))

	If slide_tmp_images="" Then
		response.write "请添加图片后方可保存！<a href='javascript:history.go(-1);'>返回</a>"
		response.end
	End If
	
	if name<>"" Then

		splitStr="{p}1"
		If InStr(slide_tmp_images,"{p}2")>0 Then splitStr="{p}2"
		If InStr(slide_tmp_images,"{p}3")>0 Then splitStr="{p}3"
		If InStr(slide_tmp_images,"{p}4")>0 Then splitStr="{p}4"

		If InStr(slide_tmp_images,splitStr)>0 Then
			DefPic=Split(slide_tmp_images,splitStr)(0)
			If InStr(DefPic,"{p}")>0 Then
				DefPic=Split(DefPic,"{p}")(1)
			Else
				response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
				response.end
			End if
		Else
			response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
			response.end
		End If

		If DefPic<>"" Then    '提取首张图片作为封面图
			If InStr(LCase(DefPic),myurl)>0 Then   '是本地图片
				PicPath=Replace(DefPic,myurl,"")
				temp1=split(PicPath,"/")
				picFilename=temp1(ubound(temp1))

				'缩图、水印
				ljj=Server.MapPath(PicPath)
				Set Jpeg = Server.CreateObject("Persits.Jpeg")
				Jpeg.Open (ljj)
				'开始变更所有文件扩展名为jpg
				xt=left(picFilename,len(picFilename)-4)
				xt=xt&".jpg"
				'结束文件名变更

				'开始判断哪边为长边，以长边进行缩放
				imgWidth=Jpeg.OriginalWidth
				imgHeight=Jpeg.OriginalHeight

				if imgHeight>imgWidth then 
					Jpeg.Width=120
					Jpeg.Height=Jpeg.OriginalHeight/(Jpeg.OriginalWidth/120)
				end if
				if imgWidth>=imgHeight then 
					Jpeg.Height=120
					Jpeg.Width=Jpeg.OriginalWidth/(Jpeg.OriginalHeight/120)
				end if
				'结束判断

				x=CInt((Jpeg.Width-120)/2)
				y=CInt((Jpeg.Height-120)/2)
				x1=x+120
				y1=y+90
				Jpeg.Canvas.Brush.Color = &HFFFFFF
				Jpeg.Sharpen 1, 125   '锐利处理
				Jpeg.Crop x,y,x1,y1   '切割处理
				Jpeg.Save (Server.MapPath(formPath) & "\" & xt)

				xt=formPath&"/"&xt

				Set Jpeg = Nothing
				
			Else					'是外部图片，则需要下载到本地

				url=DefPic
				fileExt=Right(DefPic,4)

				if int(instr(lcase(DefPic),".asp"))>0 or int(instr(lcase(DefPic),".asa"))>0 then
					response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
					response.end
				end If
				If LCase(fileExt)<>".jpg" And LCase(fileExt)<>".gif" And LCase(fileExt)<>".png" And LCase(fileExt)<>".bmp" Then
					fileExt=".jpg"
				End if
				
				set xmlhttp=server.createobject("MSXML2.serverXMLHTTP")
				xmlhttp.open "GET",url,false
				xmlhttp.send()
				if err.number<>0 then err.Clear 
				if xmlhttp.readystate<>4 then
					xt="/upload/conver/demo_img_0.jpg"
				else
					img=xmlhttp.ResponseBody
					set objAdostream=server.createobject("ADODB.Stream")
					objAdostream.Open()
					objAdostream.type=1
					objAdostream.Write(img)
					call add_myfso(formPath)

					FileName=MakedownName()&fileExt

					set myfso = Server.CreateObject("Scripting.FileSystemObject")
					if myfso.FileExists(server.mappath(formPath&"/"&FileName))=false then
						objAdostream.SaveToFile(server.mappath(formPath&"/"&FileName))
						objAdostream.SetEOS
						set objAdostream=nothing
					end if
					saveimg=formPath&"/"&FileName
				end if
				set xmlhttp=Nothing

				If saveimg<>"" then
					'缩图、水印
					ljj=Server.MapPath(saveimg)
					Set Jpeg = Server.CreateObject("Persits.Jpeg")
					Jpeg.Open (ljj)
					xt=FileName
					'结束文件名变更

					'开始判断哪边为长边，以长边进行缩放
					imgWidth=Jpeg.OriginalWidth
					imgHeight=Jpeg.OriginalHeight

					if imgHeight>imgWidth then 
						Jpeg.Width=120
						Jpeg.Height=Jpeg.OriginalHeight/(Jpeg.OriginalWidth/120)
					end if
					if imgWidth>=imgHeight then 
						Jpeg.Height=120
						Jpeg.Width=Jpeg.OriginalWidth/(Jpeg.OriginalHeight/130)
					end if
					'结束判断

					x=CInt((Jpeg.Width-120)/2)
					y=CInt((Jpeg.Height-120)/2)
					x1=x+120
					y1=y+90
					Jpeg.Canvas.Brush.Color = &HFFFFFF
					Jpeg.Sharpen 1, 125   '锐利处理
					Jpeg.Crop x,y,x1,y1   '切割处理
					Jpeg.Save (Server.MapPath(formPath) & "\" & xt)

					xt=formPath&"/"&xt
					Set Jpeg = Nothing
				End if
			End if
		Else
			response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
			response.end
		End if
		If xt="" Then xt="/upload/conver/demo_img_0.jpg"
		sql="select * from A_slide"
		Set rs= Server.CreateObject("ADODB.Recordset")
		rs.open sql,conn,1,3
		rs.addnew
		rs("slide_width") = slide_tmp_width
		rs("slide_notification") = slide_tmp_notification
		rs("slide_height") = slide_tmp_height
		rs("slide_border") = slide_tmp_border
		rs("slide_style") = slide_tmp_style
		rs("slide_userid") = slide_tmp_userid
		rs("slide_myspaceid") = slide_tmp_myspaceid
		rs("slide_theme") = slide_tmp_theme
		rs("slide_music_id") = slide_tmp_music_id
		rs("slide_music") = slide_tmp_music
		rs("slide_background") = slide_tmp_background
		rs("slide_play_mode") = slide_tmp_play_mode
		rs("slide_bgcolor") = slide_tmp_bgcolor
		rs("slide_plus") = slide_tmp_plus
		rs("slide_caption_mode") = slide_tmp_caption_mode
		rs("slide_caption_transparent") = slide_tmp_caption_transparent
		rs("slide_caption_fontsize") = slide_tmp_caption_fontsize
		rs("slide_caption_fontcolor") = slide_tmp_caption_fontcolor
		rs("slide_caption_bgcolor") = slide_tmp_caption_bgcolor
		rs("slide_caption_speed") = slide_tmp_caption_speed
		rs("slide_images") = slide_tmp_images

		splitStr="{p}1"
		If InStr(slide_tmp_images,"{p}2")>0 Then splitStr="{p}2"
		If InStr(slide_tmp_images,"{p}3")>0 Then splitStr="{p}3"
		If InStr(slide_tmp_images,"{p}4")>0 Then splitStr="{p}4"

		Arrimgs=Split(slide_tmp_images,splitStr)
		rs("photoNum") = UBound(Arrimgs)
		rs("name") = name
		rs("defpic") = xt
		rs("cate") = cate
		rs("tags") = tags
		rs("share_set") = share_set
		rs("flag") = Slide_flag
		rs("huiyuan") = request.Cookies(my_url)("huiyuan")
		userid=request.Cookies(my_url)("userid")
		If userid="" Or IsNull(userid) Then 
			userid=conn.execute("select userid from huiyuan where huiyuan='"&request.Cookies(my_url)("huiyuan")&"'")(0)
		End IF
		rs("userid") = userid
		rs.update
		rs.close
		Set rs=Nothing
		moliheID=conn.execute("select id from A_slide where defpic='"&xt&"'")(0)
		If InStr(LCase(Request.ServerVariables("HTTP_REFERER")),"stepbystep.asp")>0 then
			response.write "<script language=""javascript"">parent.sl.stepbystep_share('"&moliheID&"');</script>"
		Else
			response.redirect "share.asp?moliheid="&moliheID&"&st=save"
		End if
		response.end
	else
		response.write "请输入名称！<a href='javascript:history.go(-1);'>返回</a>"
		response.end
	end if
end If

if action="editslide_save" then 
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.redirect "/login.asp"
		response.end
	End If
	bh=year(date) & right("00"&month(date),2) & right("00"&day(date),2)
	formPath="/upload/conver/"&bh
	call add_myfso(formPath)

	moliheid=request("moliheid")
	slide_tmp_width = server.htmlencode(FilterJs(request("slide_tmp_width")))
	If slide_tmp_width="" Then slide_tmp_width=0
	slide_tmp_notification = server.htmlencode(FilterJs(request("slide_tmp_notification")))
	slide_tmp_height = server.htmlencode(FilterJs(request("slide_tmp_height")))
	If slide_tmp_height="" Then slide_tmp_height=0
	slide_tmp_border = server.htmlencode(FilterJs(request("slide_tmp_border")))
	slide_tmp_style = server.htmlencode(FilterJs(request("slide_tmp_style")))
	slide_tmp_userid = server.htmlencode(FilterJs(request("slide_tmp_userid")))
	slide_tmp_myspaceid = server.htmlencode(FilterJs(request("slide_tmp_myspaceid")))
	If slide_tmp_myspaceid="" Then slide_tmp_myspaceid=0
	slide_tmp_theme = server.htmlencode(FilterJs(request("slide_tmp_theme")))
	slide_tmp_music_id = server.htmlencode(FilterJs(request("slide_tmp_music_id")))
	If slide_tmp_music_id="" Then slide_tmp_music_id=0
	slide_tmp_music = server.htmlencode(FilterJs(request("slide_tmp_music")))
	slide_tmp_background = server.htmlencode(FilterJs(request("slide_tmp_background")))
	slide_tmp_play_mode = server.htmlencode(FilterJs(request("slide_tmp_play_mode")))
	If slide_tmp_play_mode="" Then slide_tmp_play_mode=0
	slide_tmp_bgcolor = server.htmlencode(FilterJs(request("slide_tmp_bgcolor")))
	slide_tmp_plus = server.htmlencode(FilterJs(request("slide_tmp_plus")))
	slide_tmp_caption_mode = server.htmlencode(FilterJs(request("slide_tmp_caption_mode")))
	If slide_tmp_caption_mode="" Then slide_tmp_caption_mode=0
	slide_tmp_caption_transparent = server.htmlencode(FilterJs(request("slide_tmp_caption_transparent")))
	slide_tmp_caption_fontsize = server.htmlencode(FilterJs(request("slide_tmp_caption_fontsize")))
	slide_tmp_caption_fontcolor = server.htmlencode(FilterJs(request("slide_tmp_caption_fontcolor")))
	slide_tmp_caption_bgcolor = server.htmlencode(FilterJs(request("slide_tmp_caption_bgcolor")))
	slide_tmp_caption_speed = server.htmlencode(FilterJs(request("slide_tmp_caption_speed")))
	If slide_tmp_caption_speed="" Then slide_tmp_caption_speed=0
	slide_tmp_images = replace(replace(replace(server.htmlencode(FilterJs(request("slide_tmp_images"))),"=",""),"(",""),")","")
	

	If slide_tmp_images="" Then
		response.write "请添加图片后方可保存！<a href='javascript:history.go(-1);'>返回</a>"
		response.end
	End If

	splitStr="{p}1"
	If InStr(slide_tmp_images,"{p}2")>0 Then splitStr="{p}2"
	If InStr(slide_tmp_images,"{p}3")>0 Then splitStr="{p}3"
	If InStr(slide_tmp_images,"{p}4")>0 Then splitStr="{p}4"

	If InStr(slide_tmp_images,splitStr)>0 Then
		DefPic=Split(slide_tmp_images,splitStr)(0)
		If InStr(DefPic,"{p}")>0 Then
			DefPic=Split(DefPic,"{p}")(1)
		Else
			response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
			response.end
		End if
	Else
		response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
		response.end
	End If

	If DefPic<>"" Then    '提取首张图片作为封面图
		If InStr(LCase(DefPic),myurl)>0 Then   '是本地图片
			PicPath=Replace(DefPic,myurl,"")
			temp1=split(PicPath,"/")
			picFilename=temp1(ubound(temp1))

			'缩图、水印
			ljj=Server.MapPath(PicPath)
			Set Jpeg = Server.CreateObject("Persits.Jpeg")
			Jpeg.Open (ljj)
			'开始变更所有文件扩展名为jpg
			xt=left(picFilename,len(picFilename)-4)
			xt=xt&".jpg"
			'结束文件名变更

			'开始判断哪边为长边，以长边进行缩放
			imgWidth=Jpeg.OriginalWidth
			imgHeight=Jpeg.OriginalHeight

			if imgHeight>imgWidth then 
				Jpeg.Width=120
				Jpeg.Height=Jpeg.OriginalHeight/(Jpeg.OriginalWidth/120)
			end if
			if imgWidth>=imgHeight then 
				Jpeg.Height=120
				Jpeg.Width=Jpeg.OriginalWidth/(Jpeg.OriginalHeight/120)
			end if
			'结束判断

			x=CInt((Jpeg.Width-120)/2)
			y=CInt((Jpeg.Height-120)/2)
			x1=x+120
			y1=y+90
			Jpeg.Canvas.Brush.Color = &HFFFFFF
			Jpeg.Sharpen 1, 125   '锐利处理
			Jpeg.Crop x,y,x1,y1   '切割处理
			Jpeg.Save (Server.MapPath(formPath) & "\" & xt)

			xt=formPath&"/"&xt

			Set Jpeg = Nothing
			
		Else					'是外部图片，则需要下载到本地

			url=DefPic
			fileExt=Right(DefPic,4)

			if int(instr(lcase(DefPic),".asp"))>0 or int(instr(lcase(DefPic),".asa"))>0 then
				response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
				response.end
			end If
			If LCase(fileExt)<>".jpg" And LCase(fileExt)<>".gif" And LCase(fileExt)<>".png" And LCase(fileExt)<>".bmp" Then
				fileExt=".jpg"
			End if
			
			set xmlhttp=server.createobject("MSXML2.serverXMLHTTP")
			xmlhttp.open "GET",url,false
			xmlhttp.send()
			if err.number<>0 then err.Clear 
			if xmlhttp.readystate<>4 then
				xt="/upload/conver/demo_img_0.jpg"
			else
				img=xmlhttp.ResponseBody
				set objAdostream=server.createobject("ADODB.Stream")
				objAdostream.Open()
				objAdostream.type=1
				objAdostream.Write(img)
				call add_myfso(formPath)

				FileName=MakedownName()&fileExt

				set myfso = Server.CreateObject("Scripting.FileSystemObject")
				if myfso.FileExists(server.mappath(formPath&"/"&FileName))=false then
					objAdostream.SaveToFile(server.mappath(formPath&"/"&FileName))
					objAdostream.SetEOS
					set objAdostream=nothing
				end if
				saveimg=formPath&"/"&FileName
			end if
			set xmlhttp=Nothing

			If saveimg<>"" then
				'缩图、水印
				ljj=Server.MapPath(saveimg)
				Set Jpeg = Server.CreateObject("Persits.Jpeg")
				Jpeg.Open (ljj)
				xt=FileName
				'结束文件名变更

				'开始判断哪边为长边，以长边进行缩放
				imgWidth=Jpeg.OriginalWidth
				imgHeight=Jpeg.OriginalHeight

				if imgHeight>imgWidth then 
					Jpeg.Width=120
					Jpeg.Height=Jpeg.OriginalHeight/(Jpeg.OriginalWidth/120)
				end if
				if imgWidth>=imgHeight then 
					Jpeg.Height=120
					Jpeg.Width=Jpeg.OriginalWidth/(Jpeg.OriginalHeight/130)
				end if
				'结束判断

				x=CInt((Jpeg.Width-120)/2)
				y=CInt((Jpeg.Height-120)/2)
				x1=x+120
				y1=y+90
				Jpeg.Canvas.Brush.Color = &HFFFFFF
				Jpeg.Sharpen 1, 125   '锐利处理
				Jpeg.Crop x,y,x1,y1   '切割处理
				Jpeg.Save (Server.MapPath(formPath) & "\" & xt)

				xt=formPath&"/"&xt
				Set Jpeg = Nothing
			End if
		End if
	Else
		response.write "抱歉！图片整理出错，请重新制作！<a href='javascript:history.go(-1);'>返回</a>"
		response.end
	End if
	If xt="" Then xt="/upload/conver/demo_img_0.jpg"


	sql="select * from A_slide where id="&CLng(moliheid)&""
	Set rs= Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,3
	If Not (rs.bof And rs.eof) then
	rs("slide_width") = slide_tmp_width
	rs("slide_notification") = slide_tmp_notification
	rs("slide_height") = slide_tmp_height
	rs("slide_border") = slide_tmp_border
	rs("slide_style") = slide_tmp_style
	rs("slide_userid") = slide_tmp_userid
	rs("slide_myspaceid") = slide_tmp_myspaceid
	rs("slide_theme") = slide_tmp_theme
	rs("slide_music_id") = slide_tmp_music_id
	rs("slide_music") = slide_tmp_music
	rs("slide_background") = slide_tmp_background
	rs("slide_play_mode") = slide_tmp_play_mode
	rs("slide_bgcolor") = slide_tmp_bgcolor
	rs("slide_plus") = slide_tmp_plus
	rs("slide_caption_mode") = slide_tmp_caption_mode
	rs("slide_caption_transparent") = slide_tmp_caption_transparent
	rs("slide_caption_fontsize") = slide_tmp_caption_fontsize
	rs("slide_caption_fontcolor") = slide_tmp_caption_fontcolor
	rs("slide_caption_bgcolor") = slide_tmp_caption_bgcolor
	rs("slide_caption_speed") = slide_tmp_caption_speed
	rs("slide_images") = slide_tmp_images

	splitStr="{p}1"
	If InStr(slide_tmp_images,"{p}2")>0 Then splitStr="{p}2"
	If InStr(slide_tmp_images,"{p}3")>0 Then splitStr="{p}3"
	If InStr(slide_tmp_images,"{p}4")>0 Then splitStr="{p}4"

	Arrimgs=Split(slide_tmp_images,splitStr)
	rs("photoNum") = UBound(Arrimgs)

	DefPic = LCase(rs("DefPic"))     '删除首图
	If DefPic<>"/upload/conver/demo_img_0.jpg" And DefPic<>LCase(xt) then
		Set fso = Server.CreateObject("Scripting.FileSystemObject")
		strRubbishFile=server.MapPath(DefPic)
		if fso.FileExists(strRubbishFile) then
			fso.DeleteFile(strRubbishFile)
		end if
		set fso=Nothing
	End if

	rs("defpic") = xt
	rs.update
	End if
	rs.close
	Set rs=Nothing
	If InStr(LCase(Request.ServerVariables("HTTP_REFERER")),"modstepbystep.asp")>0 then
		response.write "<script language=""javascript"">parent.sl.stepbystep_share('"&moliheID&"');</script>"
	Else
		response.redirect "share.asp?moliheid="&moliheID&"&st=save"
	End if
	response.end

end If



If action="editmoliheinfo" Then  '编辑盒子信息
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.end
	End If
	moliheid=request("moliheid")
	name=request("name")
	tags=request("tags")
	instruction=request("instruction")
	cate=request("cate")
	share_set=request("share_set")

	sql="select name,tags,cate,share_set,mydesc from A_slide where id="&CLng(moliheid)&""
	Set rs= Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,3
	If Not (rs.bof And rs.eof) Then
		If name<>"" Then rs("name") = name
		If tags<>"" Then rs("tags") = tags
		If cate<>"" Then rs("cate") = cate
		If share_set<>"" Then rs("share_set") = share_set
		If instruction<>"" Then rs("mydesc") = instruction
		rs.update
	End If
	rs.close
	Set rs=Nothing
End if

If action="delmolihe" Then  '删除
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.end
	End If
	Function noOwner(nstr)
		If nstr<>"" then
			Set rst= Server.CreateObject("ADODB.Recordset")
			sqlt="select count(id) from A_slide where slide_images like '%"&nstr&"%'"
			rst.open sqlt,conn,1,1
			If Not (rst.bof And rst.eof) Then
				If CInt(rst(0))>1 Then 
					noOwner=False
				Else
					noOwner=true
				End if
			Else
				noOwner=true
			End if
		Else
			noOwner=false
		End if
	End Function

	moliheid=request("id")
	sql="select DefPic,slide_images from A_slide where id="&CLng(moliheid)&""
	Set rs= Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,3
	If Not (rs.bof And rs.eof) Then

		DefPic = rs("DefPic")     '删除首图
		If DefPic<>"/upload/conver/demo_img_0.jpg" then
			Set fso = Server.CreateObject("Scripting.FileSystemObject")
			strRubbishFile=server.MapPath(DefPic)
			if fso.FileExists(strRubbishFile) then
				fso.DeleteFile(strRubbishFile)
			end if
			set fso=Nothing
		End if


		slide_tmp_images = rs("slide_images")     '删除内展示图
		splitStr="{p}1"
		If InStr(slide_tmp_images,"{p}2")>0 Then splitStr="{p}2"
		If InStr(slide_tmp_images,"{p}3")>0 Then splitStr="{p}3"
		If InStr(slide_tmp_images,"{p}4")>0 Then splitStr="{p}4"


		Arrimgs=Split(slide_tmp_images,splitStr)
		For i=0 To UBound(Arrimgs)-1
			If InStr(LCase(Arrimgs(i)),myurl)>0 Then   '是本地图片
				If InStr(Arrimgs(i),"{p}")>0 Then
					PicPath=Split(Arrimgs(i),"{p}")(1)
					PicPath=Replace(PicPath,myurl,"")
				Else
					PicPath=Replace(Arrimgs(i),myurl,"")
				End If
				If PicPath<>"" And Not IsNull(PicPath) And PicPath<>"/upload/conver/demo_img_0.jpg"  Then
				  If noOwner(PicPath) then
					Set fso = Server.CreateObject("Scripting.FileSystemObject")
					strRubbishFile=server.MapPath(Replace(PicPath,myurl,""))
					if fso.FileExists(strRubbishFile) then
						fso.DeleteFile(strRubbishFile)
					end if
					set fso=Nothing
				  End if
				End If
			End if
		next
	
		rs.delete
		rs.update

	End If
	rs.close
	Set rs=Nothing
End If


if action="xml" then 
	moliheid=FilterJs(request("moliheid"))
	referer=request("referer")
	sql="select slide_border,slide_style,slide_theme,slide_music,slide_background,slide_play_mode,slide_bgcolor,slide_plus,slide_caption_mode,slide_caption_transparent,slide_caption_fontsize,slide_caption_fontcolor,slide_caption_bgcolor,slide_caption_speed,slide_images from A_slide where id="&CLng(moliheid)&""
	Set rs= Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,1
	If Not (rs.bof And rs.eof) then
	slide_tmp_border = rs("slide_border")
	slide_tmp_style = rs("slide_style")
	slide_tmp_theme = rs("slide_theme")
	slide_tmp_music = rs("slide_music")
	slide_tmp_background = rs("slide_background")
	slide_tmp_play_mode = rs("slide_play_mode")
	slide_tmp_bgcolor = rs("slide_bgcolor")
	slide_tmp_plus = rs("slide_plus")
	slide_tmp_caption_mode = rs("slide_caption_mode")
	slide_tmp_caption_transparent = rs("slide_caption_transparent")
	slide_tmp_caption_fontsize = rs("slide_caption_fontsize")
	slide_tmp_caption_fontcolor = rs("slide_caption_fontcolor")
	slide_tmp_caption_bgcolor = rs("slide_caption_bgcolor")
	slide_tmp_caption_speed = rs("slide_caption_speed")
	slide_tmp_images = rs("slide_images")
	End if
	rs.close
	Set rs=Nothing
	If referer<>"www."&my_url  then
		conn.execute("update A_slide set views=views+1 where id="&CLng(moliheid)&"")
	End if
	response.write "<?xml version=""1.0"" encoding=""gb2312"" ?>"
	response.write "<root>"
	response.write "<border src="""&slide_tmp_border&""" />"
	response.write "<theme src="""&slide_tmp_theme&""" />"
	response.write "<style src="""&slide_tmp_style&""">"

	splitStr="{p}1"
	If InStr(slide_tmp_images,"{p}2")>0 Then splitStr="{p}2"
	If InStr(slide_tmp_images,"{p}3")>0 Then splitStr="{p}3"
	If InStr(slide_tmp_images,"{p}4")>0 Then splitStr="{p}4"
	Arrimgs=Split(slide_tmp_images,splitStr)
	For i=0 To UBound(Arrimgs)-1
		If InStr(Arrimgs(i),"{p}")>0 Then
			response.write "<image src="""&Split(Arrimgs(i),"{p}")(1)&""" title="""&strLeft(Replace(Split(Arrimgs(i),"{p}")(0),"{img}",""),20)&""" />"
		Else
			response.write "<image src="""&Arrimgs(i)&""" title="""" />"
		End if
	next
	response.write "</style>"
	response.write "<background src="""&slide_tmp_background&""" color="""&slide_tmp_bgcolor&""" />"
	response.write "<sound src="""&slide_tmp_music&""" />"
	response.write "<caption fc="""&slide_tmp_caption_fontcolor&""" bc="""&slide_tmp_caption_bgcolor&""" size="""&slide_tmp_caption_fontsize&""" mode="""&slide_tmp_caption_mode&""" alpha="""&slide_tmp_caption_transparent&""" speed="""&slide_tmp_caption_speed&""" />"
	response.write "<plus id="""&slide_tmp_plus&""" />"
	response.write "</root>"
end If

If action="rank" Then  '评分  '需要登陆
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.redirect "/login.asp"
		response.end
	End If
	If session("toupiao")>=10 Then
		response.write "err"
		response.end
	End if
	moliheid=request("slideid")
	rank=request("rank")
	sql="select xh,bxh from A_slide where id="&CLng(moliheid)&""
	Set rs= Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,3
	If Not (rs.bof And rs.eof) Then
		If CStr(rank)="1" Then
			rs("xh")=rs("xh")+1
		Else
			rs("bxh")=rs("bxh")+1
		End If
		session("toupiao")=session("toupiao")+1
		rs.update
	End If
	rs.close
	Set rs=nothing
End if


If action="comment" then   '评论
	comment_allow=conn.execute("select comment_allow from huiyuan where userid=(select userid from A_slide where id="&CLng(slideid)&")")(0)
	If comment_allow="" Or IsNull(comment_allow) Then comment_allow=1
	If CInt(comment_allow)=1 Then 
		slideid=request("slideid")
		username=request("username")
		content=request("content")

		'判断是否使用了代理
		if Request.ServerVariables("HTTP_X_FORWARDED_FOR") = ""  then
			ip=Request.ServerVariables("REMOTE_ADDR")
		else
			ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
		end if

		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="select name,userid,content,ip,aid from A_ping"
		rs.open sql,conn,1,3
		rs.addnew
		rs("name")=server.htmlencode(FilterJs(username))
		If Request.Cookies(my_url)("userid")<>"" Then rs("userid")=Request.Cookies(my_url)("userid")
		rs("content")=server.htmlencode(FilterJs(content))
		rs("ip")=ip
		rs("aid")=CLng(slideid)
		rs.update
		rs.close
		Set rs=Nothing
		conn.execute("update A_slide set liuyan=liuyan+1 where id="&CLng(slideid)&"")
		Response.Write "1"
	Else
		Response.Write "0"
	End if
End If

If action="addfriend" then   '订阅
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.end
	End If
	userid=request("userid")
	friendArr=""
	If CLng(userid)=CLng(Request.Cookies(my_url)("userid")) Then
		response.write "207"
		response.end
	End if
	set rs=server.createobject("adodb.recordset")
	sql="select ding,userid,DailiID from A_ding where userid="&CLng(Request.Cookies(my_url)("userid"))&""
	rs.open sql,conn,1,3
	If Not(rs.bof And rs.eof) Then
		friendArr=rs("ding")
		If Trim(friendArr)<>"" Then
			if instr(friendArr,"|")>0 then
				idArr=split(friendArr,"|")
				for i = 0 to ubound(idArr)
					If CLng(userid)=CLng(idarr(i)) Then
						response.write "208"
						response.end
						Exit for
					End if
				Next
			else
				rs("ding")=rs("ding") & "|" & userid
			end If
			rs("ding")=rs("ding") & "|" & userid
		End If
		rs.update
		response.write "1"
	Else
		rs.addnew
		rs("ding")=userid
		rs("userid")=FilterJs(replace(Request.Cookies(my_url)("userid"),"'",""))
		rs("DailiID")=Request.Cookies(my_url)("DailiID")
		rs.update
		response.write "1"
	End if
	rs.close
	set rs=Nothing
End If

If action="delfriend" then   '删除订阅
	If request.Cookies(my_url)("huiyuan")="" or request.Cookies(my_url)("hypwd")="" Then
		response.end
	End If
	userid=request("userid")
	friendArr=""
	If CLng(userid)=CLng(Request.Cookies(my_url)("userid")) Then
		response.end
	End if
	set rs=server.createobject("adodb.recordset")
	sql="select ding from A_ding where userid="&CLng(Request.Cookies(my_url)("userid"))&""
	rs.open sql,conn,1,3
	If Not(rs.bof And rs.eof) Then
		friendArr=rs("ding")
		friendArr=Replace(friendArr,userid,"")
		friendArr=Replace(friendArr,"||","|")
		If Left(friendArr,1)="|" Then friendArr=Right(friendArr,Len(friendArr)-1)
		rs("ding")=friendArr
		rs.update
	End if
	rs.close
	set rs=Nothing
End If

if action="" then%> 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="title" content="网易相册,51相册,动感相册,个人相册,相册视频,flash相册,网络相册空间,免费相册空间等等，尽在<%=my_name%>!" />
<meta name="keywords" content="<%=my_name%>,51相册,网易相册,写真美女相册,个人相册,非主流,图片,QQ相册,个人空间,动感相册,网络相册,相册视频,qq相册,flash相册,家庭电子相册,非主流电子相册,电子相册制作软件,相册,Widget,免费相册" />
<meta name="description" content="<%=my_name%>最快捷稳定的个人网易相册，提供免费相册空间和优秀的相册技术支持，提供网易相册、非主流相册、个人相册、相册视频、网络相册、非主流电子相册制作,无限化的相册容量，精彩图片荟萃，<%=my_name%>永远为大家服务！" />
<meta name="robots" content="all" />
<title>动感相册制作第一平台-<%=my_name%>,一分钟,做网易相册/网络相册/动感相册</title>
<meta name="verify-v1" content="jb7RSDpB7LYJRKEh0s3oPdwxNeMc+zwCFazTJ5NeZao=" />
<link href="common/css/main_xiu.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/get_config.asp"></script>
<script type="text/javascript" src="js/flash_no.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript" src="js/register.js"></script>
<script type="text/javascript" src="js/event.js"></script>
<script type="text/javascript" src="js/seven_form.js"></script>
<script type="text/javascript" src="js/tlists.js"></script>
<script language="JavaScript">
//document.domain	="<%=my_url%>";
//if(window!=top) top.location=self.location;
</script>
<script type="text/javascript">
et = new events(); 
reg = new reg();
function $(id){return document.getElementById(id)?document.getElementById(id):null;}
function showS(id,now,total)
{
	for(i=0;i<=total;i++){
		o = $(id+i);
		if(i==now) o.className = "selected";
		else o.className = "";
	}
}
function showalbum(v){
	var html="",len;
	for(i=0, len=album[v].length; i<len; i++){
		html += '<li id="albumtop'+i+'" onmouseover="showS(\'albumtop\','+i+',9);" class="'+(i==0?"selected":"")+'"><b>'+(i+1)+'</b>';
		html += '<a href="<%=myurl%>/molihe-'+album[v][i].aplaymod+'-'+album[v][i].aid+'.asp" class="img"  target="_blank"><img src="<%=myurl%>/'+album[v][i].aimg+'" width="44" height="44" title="'+album[v][i].at+'\n\作者：'+album[v][i].ah+'\n\浏览数：'+album[v][i].apv+'" /></a>';
		html += '<p class="title"><a href="<%=myurl%>/molihe-'+album[v][i].aplaymod+'-'+album[v][i].aid+'.asp"  target="_blank">'+album[v][i].at+'</a></p>';
		html += '<p class="pv">人气：'+album[v][i].apv+'</p></li>';
	}
	//document.getElementById("topSlideShow").innerHTML=html;
}
</script>

</head>
<body>
<NOSCRIPT><IFRAME SRC=index.asp></IFRAME></NOSCRIPT>
<!-- 头部begin -->
<script type="text/javascript" id="loginOrnot"></script>
<script type="text/javascript" src="js/login.js"></script>
<div class="headerWarp">
	<!--#include file="menu.asp" -->    <!--****************菜单文件******************-->
</div>
<div class="infoWarp">
	<div id="info">
    	<img src="images/index_radiate.gif" style="position:absolute; top:0; left:0;" />
        <div class="call_board">
			<script type="text/javascript" src="js/call_board_msg.js"></script>
            <script type="text/javascript" src="js/call_board.js"></script>
    	</div>
        <div class="loginWarp" id="newuser"><script type="text/javascript">login_register();</script></div>
    </div>
</div><!-- 头部end -->
<div class="wrap">
    <div class="index_ONE">
        <div class="index_step">
        	<a href="<%=myurl%>/makemolihe.asp"><img src="images/space.gif" width="260" height="106" title="制作相册" /></a>
            <ul onclick="location.href='stepbystep.asp';" title="跟我学做<%=my_name%>">
            	<li class="clearfix A">
                	<b>第一步：添加</b><br />
                    批量上传图片，轻松导入QQ相册/360圈/网易相册及网络图片!
                </li>
                <div class="clear"></div>
                <li class="clearfix B">
                	<b>第二步：定制</b><br />
                    大量丰富的一键定制超炫套餐，还可自定义背景音乐，更多乐趣尽在其中!
               </li>
               <div class="clear"></div>
               <li class="clearfix C">
               		<b>第三步：保存</b><br />
                    只要填写电子邮箱就可以注册，保存后随时可进行编辑修改；
                </li>
                <div class="clear"></div>
                <li class="clearfix D">
                	<b>第四步：分享</b><br />
                    支持常用博客/空间平台，取代码超快便捷。让你的相册炫动起来吧!
               </li>
            </ul>
        </div><!--.index_step end-->
        
        <div id="indexFlash">
		<%
		bannerFlash="flash/other/index_show"
		bannerParm="openwin=1&nocount=1&referer=7"

		'bannerFlash="swf/hubao"
		'bannerParm="openwin=1&nocount=1&referer=7"

		mofahecookie=request.cookies(my_url)("mofahecookie")
		If mofahecookie<>"" then
			set rs = server.createobject("adodb.recordset")
			sql = "select top 1 id,slide_play_mode from A_slide where flag=1 and share_set=1 and tui=1 order by newid()"
			rs.open sql,conn,1,1
			if Not (rs.bof And rs.eof) Then
				If CInt(rs("slide_play_mode"))>=2 then
					bannerFlash="main2"
					bannerParm="moliheid="&rs("id")&"&referer=7&playmode="&rs("slide_play_mode")
				Else
					bannerFlash="main"
					bannerParm="moliheid="&rs("id")&"&referer=7"
				End If
			End if
			rs.close
			Set rs=Nothing
		else
			response.cookies(my_url)("mofahecookie")="yes"
			Response.Cookies(my_url).Expires=date()+30
		End If
		%>
        <script type="text/javascript">
        AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,19,0','width','450','height','338','src','<%=bannerFlash%>', 'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','<%=bannerFlash%>', 'wmode','opaque','allowFullScreen','true','id','mainFlash','FlashVars','<%=bannerParm%>');</script>
        </div><!--indexFlash end-->
        <div id="topSlideDWM">
            <div class="topSlideNav">
				热门作品推荐
            </div>
            <ul id="topSlideShow">

<%
	Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select top 10 id,defpic,name,hits,views from A_slide where flag=1 and share_set=1 order by hits desc"
	rs.open sql,conn,1,1
	rs.CacheSize = 10
	my_count=rs.recordcount
	i=1
	while not rs.eof and i<=10
		my_id=rs("id")
		my_hename=rs("name")
		my_defpic=rs("defpic")
		my_hits=rs("hits")
		my_views=rs("views")
	%>
				<li id="albumtop<%=i-1%>" onmouseover="showS('albumtop',<%=i-1%>,<%=my_count-1%>);" class="<%If i=1 Then response.write "selected"%>"><b><%=i%></b><a href="mofahe.asp?moliheid=<%=my_id%>" class="img"  target="_blank"><img src="<%=my_defpic%>" width="44" height="44" alt="<%=my_hename&Chr(10)&Chr(13)&"作者："&my_hename&""&Chr(10)&Chr(13)&"浏览数："&CInt(my_hits)+CInt(my_views)&""%>" /></a><p class="title"><a href="mofahe.asp?moliheid=<%=my_id%>"  target="_blank"><%=my_hename%></a></p><p class="pv">人气：<%=CInt(my_hits)+CInt(my_views)%></p></li>
	  <%
	rs.MoveNext
	i=i+1
	Wend
	rs.close
	Set rs=nothing
	%> 
				<!--< script type="text/javascript">showalbum('D');</script >-->
			</ul>
            <div class="clear"></div>
        </div><!--topSlideDWM end--><div class="clear"></div>
    </div><!--.index_ONE end-->
</div><!--.warp end-->
<div class="main">
	<div class="wrap">
       <div  style="margin:10px auto;">
   	     <script type="text/javascript">
			AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','950','height','90','src','swf/950x90','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','swf/950x90' ); //end AC code
</script>
       </div>
       
       
	  
<script type="text/javascript">
function $(id){return document.getElementById(id)?document.getElementById(id):null;}
function clev(obj){
	if(obj.value == "请输入关键字"){
		obj.value="";
	}
}
function setv(obj){
	if(obj.value == ""){
		obj.value="请输入关键字";
	}
}
function check(){
	obj = document.getElementById("f1_key");
	if(obj.value == "请输入关键字"){
		obj.className = "I-keywords_error";
		event.returnValue = false;
	}
}

// search
function getHotKey(hotkey){
	var frm = document.getElementById('frm_search_1');
	//frm.f_by.options[0].selected = 'selected';
	frm.f_key.value = hotkey;
	frm.submit();
}
</script>
<div class="smallSearch">
	<img src="images/index_search.gif" width="40" height="35" style="position:absolute;" />
    <span class="hot_keywords">大家都在搜索： <a href="search.asp?f_tag=刘亦菲" target="_blank">刘亦菲</a>
<a href="search.asp?f_tag=网易相册" target="_blank">网易相册</a>
<a href="search.asp?f_tag=非主流相册" target="_blank">非主流相册</a>　<a href="random.asp" target=_blank>乱弹</a></span>
    <form id="frm_search_1" name="frm_search_1" method="post" action="search.asp" onsubmit="check();">
        <input type="hidden" id="f1_by" name="f_by" value=""/>
        <input name="v" type="radio" value="4" onclick="$('f1_type').style.display = 'none'; document.getElementById('f1_by').value=this.value;" checked/>作品名称
        <input name="v" type="radio" value="3" onclick="$('f1_type').style.display = 'inline'; document.getElementById('f1_by').value=this.value;"/>作品分类
        <input name="v" type="radio" value="2" onclick="$('f1_type').style.display = 'none'; document.getElementById('f1_by').value=this.value;"/>作者
        <input name="v" type="radio" value="1" onclick="$('f1_type').style.display = 'none'; document.getElementById('f1_by').value=this.value;"/>标签		
        <select name="f_type" id="f1_type" style="display:none">
            <option value="*">所有分类</option>
			<%
				Set rs_cate= Server.CreateObject("ADODB.Recordset")
				sql_cate="select * from A_cate order by cateid"
				rs_cate.open sql_cate,conn,1,1
				Do While Not rs_cate.eof
					response.write "<option label="""&Trim(rs_cate("cate"))&""" value="""&Trim(rs_cate("cateid"))&""">"&Trim(rs_cate("cate"))&"</option>"
					rs_cate.movenext
				Loop
				rs_cate.close
				Set rs_cate=nothing%>
        </select>
        <input class="I-keywords" type="text" onfocus="clev(this);" onblur="setv(this);" name="f_key" id="f1_key"   value="请输入关键字" />
        
        <input type="submit" value="搜索" class="I-search" />
<input type="button" value="高级搜索" onclick="javascript:var frm = document.getElementById('frm_search_1');frm.stype.value='2';frm.submit();" class="I-search" />
        
         <input type="hidden" id="stype" name="stype" value="1" />
        <input type="hidden" id="f1_alldate" name="f_alldate" value="ON" />
    </form>
</div><!--.smallSearch end-->		<div class="slideShow">
			<ul class="slideShowNav" id="category_list">
				<li class="selected"><a href="javascript:et.index_category_slidelist('0');">精品推荐</a></li>
				<%
				Set rs_cate= Server.CreateObject("ADODB.Recordset")
				sql_cate="select * from A_cate order by cateid"
				rs_cate.open sql_cate,conn,1,1
				ii_cate=1
				Do While Not rs_cate.eof
					If CInt(ii_cate)<6 Then
						response.write "<li><a href=""javascript:et.index_category_slidelist('"&rs_cate("cateid")&"');"">"&Trim(rs_cate("cate"))&"</a></li>"
					ElseIf CInt(ii_cate)=6 Then 
						response.write "<li style=""margin-right:6px""><a href=""javascript:et.index_category_slidelist('6');"">"&Trim(rs_cate("cate"))&"</a></li>"
					ElseIf CInt(ii_cate)=7 Then 
						response.write "<li style=""margin-right:0;""><a href=""javascript:et.index_category_slidelist('7');"">"&Trim(rs_cate("cate"))&"</a></li>"
					End if
					rs_cate.movenext
					ii_cate=ii_cate+1
				Loop
				rs_cate.close
				Set rs_cate=nothing%>
			</ul>
			<div class="clear"></div>
			<div class="slideShowListWrap">
				<ul class="slideShowList" id="category_slide">

	<%
	Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select top 24 id,defpic,name,userid,hits,views,cate from A_slide where flag=1 and share_set=1 and tui=1 order by datetime desc"
	rs.open sql,conn,1,1
	rs.CacheSize = 24
	page1("24")
	i=1
	while not rs.eof and i<=24%>
<li onmouseover="this.className='over'" onmouseout="this.className=''">
	<a href='mofahe.asp?moliheid=<%=rs("id")%>' target=oMain class="slideImg">
	<span class="icon_play"></span>
	<img src="<%=rs("defpic")%>" width="120" height="90" alt="<%=rs("name")%>" title="<%=rs("name")%>" /></a>
	<p>名称：<a href="mofahe.asp?moliheid=2005044771" class="slideTitle" target="_blank"><%=rs("name")%></a></p>
	<p>作者：<a href="user.asp?huiyuan=<%=rs("userid")%>" class="userName"><%=conn.execute("select nickname from huiyuan where userid="&rs("userid")&"")(0)%></a></p>
	<p>浏览：<%=rs("hits")+rs("views")%>人</p>
	<p>分类：<a href="category-<%=rs("cate")%>.asp" target="_blank"><%=conn.execute("select cate from A_cate where cateid="&rs("cate")&"")(0)%></a></p>
</li>
	  <%
	rs.MoveNext
	i=i+1
	Wend
	rs.close
	Set rs=Nothing
	%>
				</ul>
				<div class="clear"></div>
                <div style="text-align:right; padding:10px 18px 10px 0; position:relative;">
                <div style=" position:absolute; left:30px !important; left:-800px; top:20px !important; top:25px;" class="help_kb"><a href="question.asp" target="_blank">帮助：作品图片慢或者无法显示？请点击这里！</a>　　<a href="http://picasa.google.com/download/thanks.asp" target="_blank">下载非主流图片制作工具</a></div><a id="category_more" href="best.asp"><img src="images/index_more.gif" /></a></div>
			</div>
			<div class="clear"></div>
		</div><!--.slideShow end-->

		<div class="friendsLinks">
			<h3>合作伙伴:&nbsp;&nbsp;&nbsp;
			<!--#include file="Links.asp" -->
			</h3>
		</div><!--.friendsLinks end-->
	</div><!--.wrap-->
</div><!--.main end-->
<!--#include file="Foot.asp" -->
</body>
</html>

<%
End If

conn.close
Set conn=Nothing
%>
