Example #1
0
        exit;
    }
} else {
    if ($action == 'update') {
        if (!isset($enteruser)) {
            $enteruser = '';
        }
        if ($password != $repassword) {
            ShowMsg('两次输入的密码不一样!', '-1');
            exit;
        }
        //删除头像
        if (!empty($delavatar)) {
            $avatarsize = array(1 => 'big', 2 => 'middle', 3 => 'small');
            foreach ($avatarsize as $size) {
                file_exists(PHPMYWIND_DATA . '/avatar/' . get_avatar_filepath($id, $size)) && unlink(PHPMYWIND_DATA . '/avatar/' . get_avatar_filepath($id, $size));
            }
        }
        if ($mobile != '') {
            $r = $dosql->GetOne("SELECT mobile FROM `{$tbname}` WHERE mobile='{$mobile}' and id !={$id}");
            if (!empty($r['mobile'])) {
                ShowMsg('手机号码已存在!', '-1');
                exit;
            }
        }
        if ($email != '') {
            $r = $dosql->GetOne("SELECT email FROM `{$tbname}` WHERE email='{$email}' and id !={$id}");
            if (!empty($r['email'])) {
                ShowMsg('邮箱已存在!', '-1');
                exit;
            }
Example #2
0
<?php

/*
**************************
(C)2010-2014 phpMyWind.com
update: 2012-10-23 14:30:33
person: Adu
**************************
*/
//初始化参数
$uid = isset($_GET['uid']) ? $_GET['uid'] : '';
$size = isset($_GET['size']) ? $_GET['size'] : '';
$path = get_avatar_filepath($uid, $size);
//返回头像路径
if (is_file($path)) {
    header('location:' . get_avatar_filepath($uid, $size));
} else {
    header('location:images/default_avatar.jpg');
}
/*
 * 获取指定uid的头像文件规范路径
 * 来源:Ucenter base类的get_avatar方法
 *
 * @param  int  $uid
 * @param  string  $size  头像尺寸,可选为'big', 'middle', 'small'
 * @param  string  $type  类型,可选为real或者virtual
 * @return string  头像路径
 */
function get_avatar_filepath($uid, $size = 'big', $type = '')
{
    $size = in_array($size, array('big', 'middle', 'small')) ? $size : 'big';