<?php
if(!defined('IN_MYMPS')) exit('FORBIDDEN');
require MYMPS_INC."/upfile.fun.php";
if(submit_check('avatar_submit')){
	$name_file = "mymps_member_logo";
	if ($_FILES[$name_file]["name"]){
		check_upimage($name_file);
		$destination = "/face/".date('Ymd')."/";
		$mymps_image = start_upload($name_file,$destination,0,$mymps_mymps['cfg_memberlogo_limit']['width'],$mymps_mymps['cfg_memberlogo_limit']['height']);
		delete_mayi_img($face);
		delete_mayi_img($normalface);
		$db->query("UPDATE `{$db_mymps}member` SET logo='$mymps_image[0]',prelogo='$mymps_image[1]' $where");
		unset($mymps_mymps,$destination,$name_file,$mymps_image);
		write_msg('','?m=avatar&success=8');
	} else {
		write_msg('','?m=avatar&error=13');
	}
}else{
	$here='更新头像';
	$location = location();
	include mayi_tpl('avatar');
}
?>