<!-- #include file="../inc/conn.asp" -->
<!--#include file="upload_5xsoft.inc"-->
<%
if request.cookies("name")="" then
   response.write "<script language='javascript'>"
   response.write "alert('登录超时或你还没有登录！');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end
end if

dim upload,file,formName,formPath
set upload=new upload_5xSoft

formPath="../bbs/userheadimg"
if right(formPath,1)<>"/" then formPath=formPath&"/"

for each formName in upload.file
	set file=upload.file(formName)
	filesize=file.FileSize

	if filesize>0 then
		if filesize>51200 then
			response.write "<BR><BR><center>图片大小限制在50K以下<center>"
			response.end
		end if
		vfname = right(makefilename(now()),4)
		'随机数
		Randomize
		Random=Int((1000 - 100 + 1) * Rnd + 100)
		vfname=vfname&"_"&Random

		FileExt=GetExtendName(file.FileName)
		if FileExt<>"jpg" and FileExt<>"gif" then
			response.write "<BR><BR><center>只能上传gif,jpg类型的图片<center>"
			response.end
		end if
		fname = vfname & "." & GetExtendName(file.FileName)
		file.SaveAs Server.mappath(formPath&fname)
	end if
next

sql="select * from clubuser where clubuser_name='"&request.cookies("name")&"'"
set rsr=server.createobject("adodb.recordset")
rsr.open sql,conn,1,3

if filesize>0 then
rsr("userimg")=fname
end if

rsr.update
rsr.close
conn.close
response.redirect "userimg.asp"
%>
