<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("inc/ftcode.php");
include_once("conn.php");
include_once("checkuser.php");
include_once("bbsuser.php");

$userid=intval(get_cookie('clubuser_id'));
if ($_POST["act"]=="Y"){
   $clubuser_name=ftbbs_request(trim($_POST["clubuser_name"]));
   $clubuser_email=ftbbs_request(trim($_POST["clubuser_email"]));
   $clubuser_address=ftbbs_request(trim($_POST["clubuser_address"]));
   $clubuser_marriage=$_POST["clubuser_marriage"];
   $homepagetitle=ftbbs_request(trim($_POST["homepagetitle"]));
   $clubuser_note=$_POST["clubuser_note"];
   $str="update {$tablepre}clubuser set clubuser_email='".$clubuser_email."',clubuser_marriage='".$clubuser_marriage."',clubuser_address='".$clubuser_address."',homepagetitle='".$homepagetitle."',clubuser_note='".$clubuser_note."' where clubuser_id=".$userid;
   mysql_query($str);
   $msg="(<font color=red>修改成功!</font>)";
}
$sql="select clubuser_name,clubuser_email,clubuser_sex,clubuser_address,clubuser_marriage,homepagetitle,bokeer,clubuser_note,cssfile from {$tablepre}clubuser where clubuser_id=".$userid;
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
if ($numrows!=0){
   $bokeer=$myrow["bokeer"];
   $cssfile="blogcss/".$myrow["cssfile"];
   if ($cssfile=="blogcss/"){
      $cssfile="blogcss/2.css";
   }
}
?>
<html><head><meta http-equiv=content-type content="text/html; charset=utf-8>">
<title>修改个人资料</title>
<link rel="stylesheet" type="text/css" href="<?=$cssfile?>">
</head>
<script language="javascript">
<!--
	function check(form)
	{
    if (form.clubuser_name.value=="")
    	{
    		alert("请填写用户名！");
    		form.clubuser_name.focus();
    		return false;
  	}
    if (form.clubuser_email.value=="")
    	{
    		alert("请填写你的Email！");
    		form.clubuser_email.focus();
    		return false;
  	}
    if ((form.clubuser_email.value.indexOf("@")==-1)||(form.clubuser_email.value.indexOf(".")==-1))
    	{
    		alert("email格式有错！(例如：master@x.com)");
    		form.clubuser_email.focus();
    		return false;
  	    }
    if (form.clubuser_address.value=="")
    	{
    		alert("请填写你的地址！");
    		form.clubuser_address.focus();
    		return false;
  	}
    if (form.homepagetitle.value=="")
    	{
    		alert("请填写blog的标题！");
    		form.homepagetitle.focus();
    		return false;
  	}
   return true;
	}
//-->
</script>
<body>
<center>
<?
include_once("usernav.php");
include_once("myhead.php");
?>
<div class="stage">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="layout">
<tr>
<td width="22%" valign="top" class="c2t3">
<div id="mod_profile" class="mod" rel="drag">
<?
include_once("usercalog.php");
?>
</div>
</td>
<td width="78%" valign="top" class="c2t1">
<div id="m_blog" class="modbox"><br>
              <table width="89%" border="0" align="center">
                <form name="form1" method="post" action="" onsubmit="return check(this)">
                  <tr> 
                    <td height="30"><div align="center"></div></td>
                    <td height="30" class="f14"><strong>修改个人资料</strong><?=$msg?></td>
                  </tr>
                  <tr> 
                    <td width="17%" height="30"><div align="right">用户名:</div></td>
                    <td width="83%"><input name="clubuser_name" type="text" id="clubuser_name" value="<?=$myrow["clubuser_name"]?>" size="40" disabled>
                    </td>
                  </tr>
                  <tr> 
                    <td height="30"><div align="right">性 别:</div></td>
                    <td><input name="clubuser_sex" type="radio" value="男" <? if ($myrow["clubuser_sex"]=="男"){?>checked<? }?>>
                      男
                      <input type="radio" name="clubuser_sex" value="女" <? if ($myrow["clubuser_sex"]=="女"){?>checked<? }?>>
                      女</td>
                  </tr>
                  <tr> 
                    <td height="30"><div align="right">Email:</div></td>
                    <td><input name="clubuser_email" type="text" id="clubuser_email" value="<?=$myrow["clubuser_email"]?>" size="40"></td>
                  </tr>
                  <tr> 
                    <td height="30"><div align="right">婚姻状况:</div></td>
                    <td>
<input name="clubuser_marriage" type="radio" value="未婚" <? if ($myrow["clubuser_marriage"]=="未婚"){?>checked<? }?>>
                      未婚 
                      <input type="radio" name="clubuser_marriage" value="已婚" <? if ($myrow["clubuser_marriage"]=="已婚"){?>checked<? }?>>
                      已婚</td>
                  </tr>
                  <tr> 
                    <td height="30"><div align="right">地 址:</div></td>
                    <td><input name="clubuser_address" type="text" id="clubuser_address" value="<?=$myrow["clubuser_address"]?>" size="40"></td>
                  </tr>
                  <tr> 
                    <td height="30"><div align="right">blog标题:</div></td>
                    <td><input name="homepagetitle" type="text" id="homepagetitle" value="<?=$myrow["homepagetitle"]?>" size="40"></td>
                  </tr>
                  <tr> 
                    <td height="30"><div align="right">简 介:</div></td>
                    <td><textarea name="clubuser_note" cols="40" rows="12" id="clubuser_note"><?=htmltocode($myrow["clubuser_note"])?></textarea></td>
                  </tr>
                  <tr> 
                    <td height="45">
                  </td>
                    <td><input type="submit" name="Submit" value="确认修改">
                      <input name="act" type="hidden" id="act" value="Y"></td>
                  </tr>
                </form>
              </table>
            </div>
</td>
</tr></table>
</div>
</div>
<br><center>
<?
include_once("tail.php");
?>
  </center>
</center>
</body>
</html>