<?php
$arr = array();
$user['id'] < 1 && yun_error(mlang('请先登陆'));
if (IS_POST)
{
    $arr = array();

    ereg("^[-a-zA-Z0-9_\.]+\@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,3}$", $_POST['email']) or
        yun_error(mlang('邮箱格式不正确'), 'yun_onfocus("email");');
    $result = $db->query("select * from " . PF . "user where email='" . addslashes($_POST['email']) .
        "' && id<>'$user[id]'");
    $db->num_rows($result) && yun_error(mlang('邮箱已存在'), 'yun_onfocus("email");');
    $arr['email'] = $_POST['email'];
    $sql = sql_update($arr);
    if ($db->query("update " . PF . "user set $sql where id='$user[id]'"))
    {
        yun_succeed(mlang('修改成功'), url(RPGM . 'show/'));
    } else
    {
        yun_error(mlang('修改失败'));
    }
}
?>