<object runat=server id=conn1 progid="adodb.connection"></object>
<%application.Lock
conn1.Open Application("p_jyzx")
Application.UnLock
%>
<object runat=server id=connpic progid="adodb.connection"></object>
<%application.Lock
connpic.Open Application("p_pic")

Application.UnLock
%>

<%
dim rs
dim formsize,formdata,bncrlf,divider,datastart,dataend,mydata
'ptitle=Request("ptitle")
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrB(13) & chrB(10)
divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)

'Set rs = Server.CreateObject("ADODB.Recordset")
'rs.open "select * from user where user_name='" &session("Current_user")&"'",conn1,3,2
'rs("photo")=rs("photo")+1
'sex=rs("sex")
'rs.update
if formsize>500000 then
	response.redirect "my_photo.asp"
end if
%>
<%
Set rs2 = Server.CreateObject("ADODB.Recordset")

'sql="select * from sound where user_name='www'"
sql="select * from sound where user_name='" &session("Current_user")&"'"
rs2.open sql,connpic,3
if  rs2.recordcount<1 then

%>
<%

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "sound",connpic,3,2
rs.addnew
rs("sound").appendchunk mydata
rs("user_name")=session("Current_user")
'rs("ptitle")=ptitle
'rs("sex")=sex

'rs("date")=date
rs.update
set rs=nothing

response.redirect "my_photo.asp"
else

response.redirect "my_photo.asp"
end if
%>
