<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/const.asp" -->
<!--#include file="../Include/char.asp" -->
<!--#include file="../Include/upload_club.inc"-->
<!--#include file="IsLogin.asp" -->
<%
 dim rs,m_Sql
 dim m_ID
 dim m_count
 filepath="../Member/Photo/"  '个人照片的图片位置 
 m_ID = Session("CurUserID")
 m_username= Session("CurUserName")
 m_Sql = "SELECT F_LoginCount,F_Integral,F_MyImage,F_Grade,F_LastLoginTime,F_RegTime,F_Friend_sex,F_Friend_age,F_Friend_height,F_Friend_weight,F_Friend_edu,F_Friend_marry,F_Friend_area FROM T_Member WHERE F_ID=" & m_ID
 Set rs = conn.Execute(m_Sql)
 if rs.Eof then
   Response.write "对不起，无此会员！"
   Response.end
 end if
 if rs("f_grade")=1 then '设置上传照片数量
 upnum=20
 else
 upnum=5
 end if

   '更新兴趣爱好信息

   if Request.ServerVariables("REQUEST_METHOD")="POST" then
    
	set rs_cn=conn.Execute("select count(f_id) as m_count from T_member_photo where f_username='"&m_username&"'") 
	if rs_cn("m_count")>upnum then 
	Call Msgbox("对不起，请已经超出上传个人照片数量[限"&upnum+1&"张照片]！",1)
    response.end
	end if
    dim upload,file,formName,formPath,iCount,filename,fileExt,i
    set upload=new upload_5xSoft '建立上传对象
	'formPath=upload.form("filepath")
	formPath="../Member/Photo/" '个人照片存放图片位置
    m_title=upload.form("title")
	  '在目录后加(/)
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
	    if file.filesize>20000 then
        response.write ("<script language=JavaScript>alert('错误：您上传个人照片大小已超过20k！');history.go(-1);</script>")
        response.end
    end if

    fileExt=lcase(right(file.filename,4))
    if fileEXT<>".jpg" then
    response.write ("<script language=JavaScript>alert('错误：请检查您上传个人照片的格式/JPG/！');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&m_ID&"-"&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= m_ID&"-"&filenamet1
	set upload=nothing  '删除对象

   
   mSql = "insert into T_Member_photo ("
   mSql = mSql+"f_username,F_photo,F_title,F_ischeck,f_regtime)values('"&m_username&"','"&photourlb&"','"&m_title&"',0,'"&now()&"')"

   conn.execute(mSql)
   call MsgBox("谢谢您的上传照片，我们会在48小时内审核您的照片!","UserInfo.asp")
 End if

 Session("m_Integral") = rs("F_Integral")
 m_MyImage = rs("F_MyImage")
 if m_MyImage = "" then m_MyImage = "DefaultMyImage.jpg"
 session("m_MyImage") = m_MyImage
%>
<HTML><HEAD><TITLE> - 俱乐部</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link href="../css/member.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../Include/function.js"></script>
<script language="JavaScript">
<!--
function checkup() 	
{
        if (document.upphoto.title.value == "")  {
               alert("请输入照片描述");
			   document.upphoto.title.focus();
               return false;
        }
        if (document.upphoto.file_up1.value == "")  {
               alert("请选择图片文件");
			   document.upphoto.file_up1.focus();
               return false;
        }
		else {
		       return true;}
			}
//-->
</script>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!--#include file="../include/top.asp" -->
<!--#include file="../include/member_top.asp" --><!--#include file="club_top.asp" -->
<!--#include file="Top.asp" -->
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="183" align="center" valign="top"><!--#include file="left.asp" --></td>
    <td width="597" align="center" valign="top"><table width="96%"  border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="100%" height="40" align="right" valign="bottom"><img src="../Images/member/jl_03.gif" width="180" height="65"></td>
        </tr>
        <tr> 
          <td height="1" bgcolor="#c7c7c7"></td>
        </tr>
      </table>
      <TABLE cellSpacing=0 cellPadding=0 width=96% border=0>
        <TBODY>
          <TR> 
            <TD width=100% height=35><table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="77%">&nbsp;</td>
                  <td width="23%" align="center"><a href="photomanagelist.asp">&lt;&lt; 
                    查看更多个人照片</a></td>
                </tr>
              </table></TD>
          </TR>
        </TBODY>
      </TABLE>
      <TABLE cellSpacing=1 cellPadding=0 width=96% bgColor=#b4b4b4 border=0>
        <TBODY>
        <TR> 
          <TD vAlign=top align=middle width=100% bgColor=#ffffff> 
            <TABLE cellSpacing=0 cellPadding=0 width=100% border=0>
              <TBODY>
                <TR align=middle> 
                  <TD width="100%" height=150 colSpan=4>
				  <%
				  	set rs_cn=conn.Execute("select top 1 f_photo from T_member_photo where f_username='"&m_username&"' and f_ischeck=1 order by f_regtime desc") 
                   if not rs_cn.eof then
				   %>
				  <table width="100%" border="0">
                        <tr> 
                          <td align="center"><a href="photomanagelist.asp"><img src="../Member/Photo/<%=Server.URLEncode(rs_cn("f_photo"))%>" width="140" height="140" border="0"></a></td>
                        </tr>                        
                      </table>
				  <%
				  else 				 
				  %>	  
                      <SPAN 
                  style="FONT-SIZE: 14px"><B>您还没有上传照片！！</B></SPAN>
				  <%
				  end if
				  rs_cn.close
				   %>
				  </TD>
                </TR>
                <TR align=middle> 
                  <TD align=middle bgColor=#dcd0ff colSpan=4 height=30><SPAN 
                  style="FONT-SIZE: 14px"><B>上传新的照片</B></SPAN></TD>
                </TR>
              <FORM name=upphoto action=photoManage.asp method=post 
              enctype="multipart/form-data">
                <TR> 
                    <TD style="LINE-HEIGHT: 140%" colSpan=4 
                height=180><br>
                      ·上传相片将会增加您的魅力指数，反之，删除相片则要减少魅力指数。<BR>
                    ·相片文件请用<FONT 
                  color=#cc0000>GIF</FONT>或<FONT 
                  color=#cc0000>JPG</FONT>浏览器支持的文件格式。<BR>
                      ·相片文件大小不能大于<FONT 
                  color=#cc0000>200KB</FONT>，图片尺寸尽量保持<FONT 
                  color=#cc0000>320X400</FONT>的比例，不然将会出现偏差。(<font color="#FF0000">限20张以内</font>)<BR>
                    ·请保证您上传的照片与您的面貌相差不大，不要上传画像、合成照片、小时候的照片等不适于做个人<BR>
                    　形象照的图片。<BR>
                    ·不管您通过任何途径盗用他人图片，所产生的一切后果由您自己承担，一经发现，我们<BR>
                      　将无限期关闭您的帐号。<BR>
                    ·不要上传明星照、卡通图片、风景照以及其他的虚假图片。<BR>
                    ·严禁上传色情、反动、恶心图片，一经发现，我们将无限期关闭您的帐号！<BR>
                      ·请您自觉遵守以上规定，谢谢。欢迎广大会员共同监督！<br>
                    </TD>
                </TR>
                <TR align=middle> 
                    <TD align=middle bgColor=#f7f5fe colSpan=4 
                  height=55>照片描述&nbsp; 
                      <INPUT name=title size="22">
                      &nbsp;选择图片&nbsp; <input type="file" name="file_up1" size="25"> 
                      &nbsp; 
                      <INPUT name="submit" type=submit style="HEIGHT: 20px" onClick="return checkup();" value=上传照片>
                    <input type="hidden" name="filepath" value="<%=filepath%>">
                    </TD>
                </TR>
              </FORM>
            </TABLE></TD>
        </TR></TBODY>
      </TABLE> </td>
  </tr>
</table>
<!--#include file="../include/bottom.asp" -->
</BODY></HTML>
