<?
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=="user_xiu_psd")
{
if($oldpsd!=$user_xiu_psd){errorview("密码错误，不能修改！");exit;}
if(!ereg("^[0-9a-zA-Z]{3,16}$",$newpsd1)){errorview("密码必须为为英文字母或数字，长度6~16之内！！");exit;}
if($newpsd1!=$newpsd2){errorview("输入的密码不相符！");exit;}
$fp=fopen("user/$user_id.php","w+") or die("file open error");
         $oo="<?";
         $user=$oo."\t".$user_id."\t".$username."\t".$newpsd2."\t".$birth."\t".$star."\t".$usersex."\t".$userblood."\t".$userfrom."\t".$userhobby."\t".$userpage."\t".$useroicq."\t".$usericq."\t".$usermail."\t".$usermobi."\t".$usertel."\t".$useraddr."\t".$usercode."\t".$userly."\t".$userdate."\n";
         fwrite($fp,$user);
         fclose($fp);
             $ses_user_id=$user_xiu_id;
             $ses_user_psd=$newpsd2;
             session_register("ses_user_id");
             session_register("ses_user_psd");
         $title="修改密码成功！";
         $ynhead2="1";
         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;
}
readclass();
$ynhead1="1";
$ynhead2="1";
$ynhead3="1";
$title="修改密码";
include"header.php";
?>
<form name="form" method="post" action="userpsd.php">
  <input type="hidden" name="ygl_method" value="user_xiu_psd"><table width="500" border="1" bordercolorlight="#B5E1F7" bordercolordark="#FFFFFF" cellpadding="0" cellspacing="0" align=center>
    <tr>
      <td colspan="3">
        <div align="center"><b><font size="3" color="#000099">修改密码</font></b></div>
      </td>
    </tr>
    <tr align="center" valign="middle">
      <td width="98">
        <div align="center">旧密码：</div>
      </td>
      <td width="155">
        <div align="center">
          <input type="password" name="oldpsd" class=text>
        </div>
      </td>
      <td width="239">
        <div align="center"> 　</div>
      </td>
    </tr>
    <tr align="center" valign="middle">
      <td width="98">
        <div align="center">新密码：</div>
      </td>
      <td width="155">
        <div align="center">
          <input type="password" name="newpsd1" class=text>
        </div>
      </td>
      <td width="239">
        <div align="center"><font color=red>*(必须为英文或数字,长度在3~16之间)</font></div>
      </td>
    </tr>
    <tr align="center" valign="middle">
      <td width="98">
        <div align="center">确认新密码：</div>
      </td>
      <td width="155">
        <div align="center">
          <input type="password" name="newpsd2" class=text>
        </div>
      </td>
      <td width="239">
        <div align="center"><font color=red>*(必须为英文或数字,长度在3~16之间)</font></div>
      </td>
    </tr>
    <tr align="center" valign="middle">
      <td width="98">
        <div align="center">　 </div>
      </td>
      <td width="155">
        <div align="center">
          <input type="submit" name="Submit" value="提  交" class=text>
          <input type="reset" name="Submit2" value="重  置" class=text>
        </div>
      </td>
      <td width="239">
        <div align="center">　 </div>
      </td>
    </tr>
  </table>
</form>
<?include"footer.php";?>