<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/const.jsp" -->
<!--#include file="../Include/char.jsp" -->
<!--#include file="../Include/upload_club.inc"-->
<!--#include file="IsLogin.jsp" -->
<%
  m_classid = checkStr(Request("classid"))
%>
<%
 m_ID = Request.Cookies("aspxnet")("CurUserID")
 m_username= Request.Cookies("aspxnet")("CurUsername")
 m_grade=request.cookies("aspxnet")("curgrade")
filepath="ClubImages/"  '子俱乐部的图片位置
if Request.ServerVariables("REQUEST_METHOD")="POST" then
 
dim upload,file,formName,formPath,iCount,filename,fileExt,i
set upload=new upload_5xSoft '建立上传对象

formPath=upload.form("filepath")
'uid=session("y_ephoto_username")
'ifshare=upload.form("ifshare")
m_name=upload.form("name")
m_manage=upload.form("manage")
m_content=upload.form("content")
m_area=upload.form("area")
classid=upload.form("classid")

'if  cstr(m_manage)<>cstr(m_username) then 
'Call Msgbox("对不起，俱乐部主席会员与您的会员不一致！",1)
'response.end
'end if
'在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/" 
iCount=0

for each formName in upload.file '列出所有上传了的文件
    set file=upload.file(formName)  '生成一个文件对象
  next  
    if file.filesize<0 then
        Call Msgbox("对不起，参数不足错误！",1)
        response.end
    end if

'加入判断，看是否有此会员
sql="select f_username,f_sex,f_birthday,f_edu,f_realname,f_email,f_qq,f_tel,f_grade from T_member where f_username='"&m_username&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
if  rs.eof then 
Call Msgbox("对不起，俱乐部主席会员不存在！",1)
response.end
end if
if rs("f_sex")=1 then
m_sex="男"
else
m_sex="女"
end if
m_age=int(year(date())-year(rs("f_birthday")))
m_edu=rs("f_edu")
m_realname=rs("f_realname")
m_email=rs("f_email")
m_qq=rs("f_qq")
m_tel=rs("f_tel")
m_grade=rs("f_grade")
rs.close
set rs=nothing



   
    if file.filesize>100000 then
        response.write ("<script language=JavaScript>alert('错误：您上传子俱乐部的照片大小已超过100k！');history.go(-1);</script>")
        response.end
    end if

    fileExt=lcase(right(file.filename,4))
    if fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".png" then
    response.write ("<script language=JavaScript>alert('错误：请检查您上传子俱乐部的照片的格式/JPG/GIG/PNG/！');history.go(-1);</script>")
    response.end
    end if 

    filenamett=file.FileName
	m_rnd=cint(((hour(now)*second(now))*rnd(5))+574)
  '  filenamett=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&file.FileName
	filenamett=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&clng(m_ID*m_rnd)&fileExt
	
    filename=formPath&filenamett

    filesize=file.filesize
    if file.FileSize>0 then         '如果 FileSize > 0 说明有文件数据
        file.SaveAs Server.mappath(filename)   '
          iCount=iCount+1
    end if

    set file=nothing

    FilePath=Server.MapPath(".")	
    FilePath=FilePath & "\pic\" 
	



    '开始变更所有文件扩展名为jpg
  ' filenamelen=len(filenamet)
 '  filenamelen=filenamelen-4
   filenamet1=filenamett
  ' filenamet=left(filenamet,filenamelen)
  ' filenamet=filenamet&".jpg"
    '结束文件名变更

    xx=right("00"&hour(time),2)
    ff=right("00"&minute(time),2)
    mm=right("00"&second(time),2)
    itime=xx & ":" & ff & ":" & mm

    itime=idate&itime
  
    photourlb=formPath & filenamet1
   ' photourls=formPath & "small_" & filenamet
	m_datenow=now()
	sql1="select * from t_club"
	set rs1=server.createobject("ADODB.Recordset")
     rs1.open sql1,conn,1,3
	 rs1.addnew
	' rs1("f_id")=itime
	 rs1("f_photo")=photourlb
     rs1("f_name")=m_name
	 rs1("f_regtime")=m_datenow
	 rs1("f_manage_username")=m_username
	 rs1("f_content")=m_content
	 rs1("f_username")=m_username
	  rs1("f_area")=m_area
	  	  rs1("f_quanclass")=classid	
	  rs1("f_usercount")=rs1("f_usercount")+1  
	 rs1.update
	' m_club_id=itime
	' rs1.movenext	 
	 rs1.close
	 set rs1=nothing
	sql1="select f_id from t_club where f_name='"&m_name&"' and f_photo='"&photourlb&"'"
	set rs1=server.createobject("ADODB.Recordset")
	rs1.open sql1,conn
	if not rs1.eof then
	m_club_id=rs1("f_id")
	end if
	rs1.close
	set rs1=nothing
	 '写入俱乐部会员表
	set rs1=server.createobject("ADODB.Recordset")
	sql1="select * from t_club_member"
	rs1.open sql1,conn,1,3
	rs1.addnew
	rs1("f_club_id")=m_club_id
	rs1("f_username")=m_username
	rs1("f_sex")=m_sex
	rs1("f_age")=m_age
	rs1("f_edu")=m_edu
	rs1("f_realname")=m_realname
	rs1("f_email")=m_email
	rs1("f_qq")=m_qq
	rs1("f_tel")=m_tel
	rs1("f_grade")=m_grade
	rs1("f_regtime")=m_datenow
	rs1("f_ischeck")=1
	rs1("f_identity")="主席"
	rs1.update	
	rs1.close
	set rs1=nothing
	'FilePath1=Server.MapPath("..") & "\ClubImages\" &m_club_id
	FilePath1=Server.MapPath("..") & "\Club\ClubImages\" &m_club_id
    Set Fso=server.createobject("scripting.filesystemobject")
    if Fso.FileExists(FilePath1) then
    response.redirect "发生错误"
    response.end
    else
    Fso.CreateFolder(FilePath1)
   end if	
    'conn.execute "insert into photourl (photourl,photourls,ifshare,uid,photointro,imgheight,imgwidth,filesize,puttime) values ('"&photourlb&"','"&photourls&"',"&cint(ifshare)&",'"&uid&"','"&photointro&"','"&imgheight&"','"&imgwidth&"','"&filesize&"','"&itime&"')"
  '  conn.execute "update userinfo set usesize=usesize+'"&filesize&"',photono=photono+1 where uid='"&uid&"'"

 '  conn.execute "update photocoll set collsize=collsize+'"&filesize&"',collsum=collsum+1,moditime='"&itime&"' where id=" & collid
  '  conn.execute "update sysinfo set usesize=usesize+'"&filesize&"',sumphoto=sumphoto+1,uptime='"&itime&"'"

    '结束数据库写入

    'response.write "<br>文件上传完毕<br>" & itime

    set upload=nothing  '删除对象
    url="QQ_index.jsp"
    response.redirect url 
    end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>创建小圈子</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
media=all href="css/quan_index.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2800.1555" name=GENERATOR></HEAD>
<BODY>
<DIV id=logo><SPAN><A href="login.jsp" 
target=_blank>登陆</A> <A href="../bbs/user/UserJoin.jsp" 
target=_blank>注册</A> </SPAN> <A 
title=运城地带小圈子-首页 href="#"><B>运城地带小圈子</B></A> 
</DIV><!--Main start-->
<DIV id=main><!--导航 start-->
	<DIV id=nav><A href="../">首页</A> | <A 
href="QQ_default.jsp">运城地带</A> | <A 
href="QQ_index.jsp">小圈子</A> | <A 
href="../blog/">运城博客</A> | <A 
href="photo_default.jsp">网络相册</A> | <A 
href="QQ_ployall.jsp">精彩活动</A> | <A 
href="friend_index.jsp">交友频道</A> | <A 
href="../bbs/" target=_blank>运城社区</A> </DIV><!--导航 end--><!--内容contain start-->
<DIV id=contain>
<H2><IMG style="LEFT: 0px; POSITION: absolute; TOP: 0px" 
src="img/quan_index_title.gif">运城地带 - 小圈子</H2><!--setgroup start-->
<DIV id=setupgroup>

<FIELDSET><LEGEND>创建小圈子</LEGEND>
 <FORM name=SignUpForm 
              onsubmit="return FrontPage_Form1_Validator(this)" 
              action=QQ_addclub.jsp method=post enctype="multipart/form-data">
<H3>填写您的小圈子</H3>
<DIV class=rim2><LABEL><SPAN>小圈子名称:</SPAN><INPUT id=name size=33 name=name> 
</LABEL><LABEL><SPAN>小圈子管理员:</SPAN><INPUT id=manage disabled size=33 
value=<%=m_username%> name=manage> </LABEL><LABEL><SPAN>所在地区:</SPAN>  <select 
      name=area id="area" style="BACKGROUND-COLOR: #ffffff; WIDTH: 170px">                          
                            <option value=市区>市区</option>
                            <option value=新罗区>新罗区</option>
                            <option value=漳平市>漳平市</option>
                            <option value=永定县>永定县</option>
							<option value=上杭县>上杭县</option> 
						    <option value=武平县>武平县</option> 
						    <option value=连城县>连城县</option> 
							<option value=长汀县>长汀县</option>
							<option value=其它市>其它市</option>
                                   </select>
 </LABEL><LABEL><SPAN>小圈子说明:</SPAN><TEXTAREA id=content name=content rows=8 cols=48></TEXTAREA> 
</LABEL><LABEL><SPAN>上传图片:</SPAN>
<INPUT style="FONT-SIZE: 9pt; BACKGROUND-COLOR: #ffffff"  type="file" name="file_up1" size="30"> 
</LABEL> </DIV><INPUT type="hidden" 
value="<%=m_classid%>" name="classid"><input type="hidden" name="filepath" value="<%=filepath%>"> <INPUT type=submit value="确 定" name=submit> <INPUT type=reset value="取 消" name=reset> </FORM></FIELDSET> </DIV><!--setgroup end--><!--search start-->
<FORM id=so name=search action=QQ_search.jsp method=post><LABEL 
for=sokey><SPAN>搜索小圈子:</SPAN> <INPUT class=soinput id=sokey size=33 
name=keyword> <INPUT id=sobot type=image src="img/so_bot.gif" 
name=imageField> </LABEL></FORM><!--search end--><!--foot start-->
<DIV id=foot><A class=list href="../about/?Para=Intro" target=_blank>关于我们</A> ┊ <A class=list href="../about/?Para=Contact" target=_blank>联系方式</A> ┊ <A class=list href="../about/?Para=Job" target=_blank>招贤纳士</A> ┊ <A class=list href="../about/?Para=AdService" target=_blank>广告服务</A> ┊ <A class=list href="../about/?Para=Cooperate" target=_blank>合作伙伴</A> ┊ <A class=list href="../so/Suggestion.jsp" target=_blank> 留言/投诉</A> ┊ <A class=list href="../about/?Para=Job" target=_blank></A><BR><%=Site_info(5)%> </DIV><!--foot end-->
<DIV><!--内容contain end--></DIV><!--Right list start--><!--Right list end--></DIV><!--左导航 start-->
<DIV id=leftlist>
<DL>
  <DT>小圈子 
  <%
	  set rs_c=server.createobject("adodb.recordset")
	  sql_c="select * from T_quan order by classid asc"
	  rs_c.open sql_c,conn
	  do while not rs_c.eof	
	  %> 
  <DD><A href="QQ_clublist.jsp?classid=<%=rs_c("classid")%>"><%=rs_c("F_namequan")%></A> 
  <%rs_c.movenext
	  loop
		rs_c.close
		set rs_c=nothing
		%>
</DD></DL></DIV><!--左导航 end--></DIV><!--Main end--></BODY></HTML>
