<?php
/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
if(!eregi($_SERVER['SERVER_NAME'], $_SERVER['HTTP_REFERER'])) {exit("UploadPicErrorx130");}
include "include/cctvai.conn.php";
include "include/cctvai.inc.php";
$tempFile=file_get_contents("php://input");
if(!empty($tempFile)) {
	$targetFiles="upload/userpic/" . $CcTvAi_com_userid . ".jpg";
	$file=fopen($targetFiles, "w");
	fwrite($file, $tempFile);
	fclose($file);
	$tmpPath=_cctvai_root_ . "upload/userpic/" . $CcTvAi_com_userid . ".jpg";
	if(isImage($tmpPath)===false) {@unlink($tmpPath);exit("UploadPicError");}
	$IMG48="upload/userpic/" . $CcTvAi_com_userid . "_48x48.jpg";
	$IMG120="upload/userpic/" . $CcTvAi_com_userid . "_120x120.jpg";
	$IMG200="upload/userpic/" . $CcTvAi_com_userid . "_200x200.jpg";
	resizeImage($tmpPath, 48, 48, $IMG48);
	resizeImage($tmpPath, 120, 120, $IMG120);
	resizeImage($tmpPath, 200, 200, $IMG200);
	@unlink($tmpPath);
	$db->query("update " . tname('user') . " set cd_photo='upload/userpic/" . $CcTvAi_com_userid . "_200x200.jpg' where cd_id='" . $CcTvAi_com_userid . "'");
	exit('UploadPicSucceed');
} else {
	exit('UploadPicError');
}
?>