<?php
error_reporting(0); 
include("../../config/qiantai.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$username=ubo($_SESSION['username']);
$type="where name='$username'";
$user=queryall(user,$type);
$userid=$user['userid'];
if(!$user){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
//修改漏洞判断
if (strpos($_FILES['file']['name'],'php')!== false){
$err=iconv("GB2312","UTF-8","死黑客死全家，陈龙华全家死光光！");
$qggd = array ('status'=>"false",'msg'=>$err);   
echo json_encode($qggd);
}else{

$aggd = "../../2019newui/img/";
$bggd=array("jpg","png","gif");
function fileext($jjjjk) {return substr(strrchr($jjjjk, '.'), 1); } 
$ak=strtolower(fileext($_FILES['file']['name'])); 
if(!in_array(strtolower(fileext($_FILES['file']['name'])),$bggd)) { $text=implode(",",$bggd);} else{ $jjjjk=explode(".",$_FILES['file']['name']); do { 
$jjjjk[0]=random(30); //设置随机数长度 
$picname=implode(".",$jjjjk); 
$uploadfile2=$aggd.$picname; 
$uploadfile="/2019newui/img/".$picname; 
$zykey=$_REQUEST["zykey"];
$type="pic='$uploadfile' where zykey='$zykey' and userid='$userid'";
upalldt(daili,$type);
} 
while(file_exists($uploadfile2)); 
if (move_uploaded_file($_FILES['file']['tmp_name'],$uploadfile2)) 
{ 
if(is_uploaded_file($_FILES['file']['tmp_name'])) { 
} 
else 
{
} 
} 
}
$qggd = array ('status'=>"true");   
echo json_encode($qggd);
}
?>
