<?
require"ygl.php";
if(!isset($ses_user_id)||!isset($ses_user_psd)){errorview("对不起，你没有登陆！！");exit;}
$user_xiu_id=$ses_user_id;
$user_xiu_psd=$ses_user_psd;
read_user_zl($user_xiu_id);
if($userpass1!=$user_xiu_psd){errorview("非法用户不允许修改资料！");exit;}else $userpass1=$txluserpsd;
if(!file_exists("user/$user_xiu_id.php")){errorview("对不起，没有该用户！");exit;}
if($ygl_method=="userxiu")
         {
         if(empty($user_xiu_id)||empty($user_xiu_name)){errorview("请认真填写好必需要填的资料！！");exit;}
         if(!ereg("^[0-9a-zA-Z]{3,20}$",$user_xiu_id)){errorview("用户帐号错误！！");exit;}
         if(!empty($user_xiu_hobby)&&strlen($user_xiu_hobby)>50){errorview("您的所填写的爱好不能大于25个汉字！");exit;}
         if(!empty($user_xiu_oicq)&&!ereg("^[0-9]{5,16}$",$user_xiu_oicq)){errorview("QQ号码不对啊，请认真填写！！");}
         if(!empty($user_xiu_icq))if(!ereg("^[0-9]{5,18}$",$user_xiu_icq)){errorview("ICQ号码不对啊，请认真填写！！");exit;}
         if(!empty($user_xiu_mail))if(!ereg(".*\@.*\..*",$user_xiu_mail)){errorview("您的Email输入错误！");exit;}
         if(!empty($user_xiu_mobi))if(!ereg("^[0-9-]{11,15}$",$user_xiu_mobi)){errorview("手机号码不对，请认真填写！！");exit;}
         if(!empty($user_xiu_tel))if(!ereg("^[0-9-]{6,15}$",$user_xiu_tel)){errorview("住址电话号码不对，请认真填写！！");exit;}
         if(!empty($user_xiu_addr))if(strlen($user_xiu_addr)>100){errorview("住址不能大于50个汉字！");exit;}
         if(!empty($user_xiu_code))if(!ereg("^[0-9-]{6,6}$",$user_xiu_code)){errorview("邮编错误！！");exit;}
         if(!empty($user_xiu_ly))if(strlen($user_xiu_ly) > 200){errorview("您的简短留言不能大于100个汉字！");exit;}
         $user_xiu_name=safe_cover($user_xiu_name);
         $user_xiu_year=safe_cover($user_xiu_year);
         $user_xiu_month=safe_cover($user_xiu_month);
         $user_xiu_day=safe_cover($user_xiu_day);
         $user_xiu_sex=safe_cover($user_xiu_sex);
         $user_xiu_blood=safe_cover($user_xiu_blood);
         $user_xiu_from=safe_cover($user_xiu_from);
         $user_xiu_hobby=safe_cover($user_xiu_hobby);
         $user_xiu_oicq=safe_cover($user_xiu_oicq);
         $user_xiu_icq=safe_cover($user_xiu_icq);
         $user_xiu_mail=safe_cover($user_xiu_mail);
         $user_xiu_mobi=safe_cover($user_xiu_mobi);
         $user_xiu_tel=safe_cover($user_xiu_tel);
         $user_xiu_page=safe_cover($user_xiu_page);
         $user_xiu_addr=safe_cover($user_xiu_addr);
         $user_xiu_code=safe_cover($user_xiu_code);
         $user_xiu_ly=safe_cover($user_xiu_ly);
         $user_xiu_date=date("Y")."/".date("n")."/".date("j")."/".date("G").":".date("i");
         $user_xiu_born=$user_xiu_year."年".$user_xiu_month."月".$user_xiu_day."日";
         $birth=$user_xiu_year."/".$user_xiu_month."/".$user_xiu_day;
                if($birth=str_replace("/","/",$birth));
                   {
                   list($biryear,$birmon,$birday)=split('\/',$birth);
                   $birday=($birday*10)/10;
                   if($birday<10){
                   $startmp=$birmon."0".$birday;
                   }
                   else{
                   $startmp=$birmon.$birday;
                   }
                    if (($startmp>=120)&&($startmp<=218))$star="水瓶座";
                    if (($startmp>=219)&&($startmp<=320))$star="双鱼座";
                    if (($startmp>=321)&&($startmp<=419))$star="白羊座";
                    if (($startmp>=420)&&($startmp<=520))$star="金牛座";
                    if (($startmp>=521)&&($startmp<=621))$star="双子座";
                    if (($startmp>=622)&&($startmp<=722))$star="巨蟹座";
                    if (($startmp>=723)&&($startmp<=822))$star="狮子座";
                    if (($startmp>=823)&&($startmp<=922))$star="处女座";
                    if (($startmp>=923)&&($startmp<=1022))$star="天秤座";
                    if (($startmp>=1023)&&($startmp<=1121))$star="天蝎座";
                    if (($startmp>=1122)&&($startmp<=1221))$star="射手座";
                    if (($startmp>=1222)||($startmp<=119))$star="摩羯座";
                   }
         $fp=fopen("user/$user_id.php","w+") or die("file open error");
         $oo="<?exit;";
         $user=$oo."\t".$user_xiu_id."\t".$user_xiu_name."\t".$user_xiu_psd."\t".$birth."\t".$star."\t".$user_xiu_sex."\t".$user_xiu_blood."\t".$user_xiu_from."\t".$user_xiu_hobby."\t".$user_xiu_page."\t".$user_xiu_oicq."\t".$user_xiu_icq."\t".$user_xiu_mail."\t".$user_xiu_mobi."\t".$user_xiu_tel."\t".$user_xiu_addr."\t".$user_xiu_code."\t".$user_xiu_ly."\t".$user_xiu_date."\n";
         fwrite($fp,$user);
         fclose($fp);
         read_card($user_xiu_id);
         if($w_addr=="")$w_addr="无";
         $fpcard=fopen("user/$user_xiu_id.crd","w+") or die("file open error");
         $usercard=$user_xiu_id."\t".$user_xiu_name."\t".$w_addr."\t".$user_xiu_tel."\t".$user_xiu_mobi."\t".$user_xiu_mail."\n";
         fwrite($fpcard,$usercard);
         fclose($fpcard);
         $title="修改资料成功";
         include"header.php";
   print<<<EOT
<table width="100%" border="1" cellspacing="0" cellpadding="4"  bordercolorlight="#B5E1F7" bordercolordark="#FFFFFF">
<tr><td><div align="center">你已成功修改了个人资料!</div></td></tr><tr><td>
<div align="center">&lt;<a href="login.php">点击返回</a>&gt;</div></td></tr></table>
EOT;
include"footer.php";
exit;
        }
$ynhead2="1";
$title="用户修改资料";
include"header.php";?>
<form method=post action="userxiu.php" enctype=multipart/form-data>
  <table width="423" border="0" cellspacing="2" cellpadding="2" align="center">
    <tr>
      <td colspan="2">
        <input type="hidden" name="ygl_method" value="userxiu">
        <div align="center"><b><font color="#0099FF" size="3">用户资料修改</font></b><font color=red>（带*号的必填！）</font></div>
      </td>
    </tr>
    <tr>
      <td  align=center bgcolor="#eeeeee">用户帐号:</td>
      <td bgcolor="#eeeeee">
        <?echo $user_id;?>
        <input type="hidden" name="user_xiu_id" value="<?echo $user_id;?>" class=text>
        <font color=red>(不能修改)</font></td>
    </tr>
    <tr>
      <td colspan="2">
        <div align="center"><b>个人真实资料</b></div>
      </td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">真实姓名：</div>
      </td>
      <td width="332" bgcolor="#eeeeee">
        <input name="user_xiu_name" size="16" value="<?echo $username;?>" class=text>
        <font color=red>*</font> </td>
    </tr>
    <tr>
      <td width="77">
        <div align="center">出生：</div>
      </td>
      <td width="332">
        <input type="text" name="user_xiu_year" maxlength="4" size="5" value="<?echo $biryear;?>" class=text>
        年
        <input type="text" name="user_xiu_month" size="3" maxlength="2" value="<?echo $birmon;?>" class=text>
        月
        <input type="text" name="user_xiu_day" size="3" maxlength="2" value="<?echo $birday;?>" class=text>
        日 <font color=red>*</font></td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">性别：</div>
      </td>
      <td width="332" bgcolor="#eeeeee">
        <input type="text" name="user_xiu_sex" size="2" maxlength="2" value="<?echo $usersex;?>" class=text>
        <font color=red>*</font> </td>
    </tr>
    <tr>
      <td width="77">
        <div align="center">血型：</div>
      </td>
      <td width="332">
        <input type="text" name="user_xiu_blood" size="2" maxlength="2" value="<?echo $userblood;?>" class=text>
        型 </td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">籍贯：</div>
      </td>
      <td width="332" bgcolor="#eeeeee"><font color="#800000">
        <input type="text" name="user_xiu_from" value="<?echo $userfrom;?>" size="8" class=text>
        </font><font color=red>*</font></td>
    </tr>
    <tr>
      <td width="77">
        <div align="center">爱好：</div>
      </td>
      <td width="332">
        <input type="text" name="user_xiu_hobby" value="<?echo $userhobby;?>" class=text>
      </td>
    </tr>
    <tr bgcolor="#eeeeee">
      <td>
        <div align="center">个人主页：</div>
      </td>
      <td>
        <input type="text" name="user_xiu_page" value="<?echo $userpage;?>" class=text>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <div align="center"><b><font color="#800000"> </font></b></div>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <div align="center"><b>联系资料</b></div>
      </td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">OICQ：</div>
      </td>
      <td width="332" bgcolor="#eeeeee">
        <input type="text" name="user_xiu_oicq" size="16" value="<?echo $useroicq;?>" class=text>
      </td>
    </tr>
    <tr>
      <td width="77">
        <div align="center">ICQ：</div>
      </td>
      <td width="332">
        <input type="text" name="user_xiu_icq" size="16" value="<?echo $usericq;?>" class=text>
      </td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">E-Mail：</div>
      </td>
      <td width="332" bgcolor="#eeeeee">
        <input type="text" name="user_xiu_mail" size="20" value="<?echo $usermail;?>" class=text>
      </td>
    </tr>
    <tr>
      <td width="77">
        <div align="center">手机：</div>
      </td>
      <td width="332">
        <input type="text" name="user_xiu_mobi" size="15" value="<?echo $usermobi;?>" class=text>
      </td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">住址电话：</div>
      </td>
      <td width="332" bgcolor="#eeeeee">
        <input type="text" name="user_xiu_tel" size="15" value="<?echo $usertel;?>" class=text>
      </td>
    </tr>
    <tr>
      <td width="77">
        <div align="center">住址：</div>
      </td>
      <td width="332">
        <input type="text" name="user_xiu_addr" value="<?echo $useraddr;?>" class=text>
      </td>
    </tr>
    <tr>
      <td width="77" bgcolor="#eeeeee">
        <div align="center">邮编：</div>
      </td>
      <td width="332" bgcolor="#eeeeee">
        <input type="text" name="user_xiu_code" size="10" value="<?echo $usercode;?>" class=text>
      </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2">
        <div align="center"><b>简短留言</b></div>
      </td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#eeeeee">
        <div align="center">
          <textarea name="user_xiu_ly" cols="40" rows="5" class=text><?echo $userly;?></textarea>
        </div>
      </td>
    </tr>
    <tr>
      <td width="77">&nbsp;</td>
      <td width="332">
        <input type="submit" value="提  交" name="botton" class=text>
        &nbsp;
        <input type="reset" value="重  写" name="reset" class=text>
      </td>
    </tr>
  </table>
</form>
<?include"footer.php";?>