alert("只支持上传图片文件!");window.location.href="shop.php";';
exit;
}
// 限制文件大小为2MB
$max_size = 2 * 1024 * 1024; // 2MB
if ($kefuurl['size'] > $max_size || $banner['size'] > $max_size || $banner_one['size'] > $max_size || $banner_two['size'] > $max_size) {
echo '';
exit;
}
// 生成文件名
$kefuurl_name = time() . '_' . rand(10000, 99999) . '.' . $kefuurl_ext;
$banner_name = time() . '_' . rand(10000, 99999) . '.' . $banner_ext;
$banner_one_name = time() . '_' . rand(10000, 99999) . '.' . $banner_one_ext;
$banner_two_name = time() . '_' . rand(10000, 99999) . '.' . $banner_two_ext;
// 获取文件临时路径
$kefuurl_tmp = $kefuurl['tmp_name'];
$banner_tmp = $banner['tmp_name'];
$banner_one_tmp = $banner_one['tmp_name'];
$banner_two_tmp = $banner_two['tmp_name'];
// 将文件存储到服务器
$kefuurl_path = 'uploads/' . $kefuurl_name;
$banner_path = 'uploads/' . $banner_name;
$banner_one_path = 'uploads/' . $banner_one_name;
$banner_two_path = 'uploads/' . $banner_two_name;
// 判断文件是否上传成功
if (move_uploaded_file($kefuurl_tmp, $kefuurl_path)) {
$sql = "UPDATE shopsy SET kefuurl='$kefuurl_path' WHERE puid='$puid'";
mysqli_query($con, $sql);
}
if (move_uploaded_file($banner_tmp, $banner_path)) {
$sql = "UPDATE shopsy SET banner='$banner_path' WHERE puid='$puid'";
mysqli_query($con, $sql);
}
if (move_uploaded_file($banner_one_tmp, $banner_one_path)) {
$sql = "UPDATE shopsy SET banner_one='$banner_one_path' WHERE puid='$puid'";
mysqli_query($con, $sql);
}
if (move_uploaded_file($banner_two_tmp, $banner_two_path)) {
$sql = "UPDATE shopsy SET banner_two='$banner_two_path' WHERE puid='$puid'";
mysqli_query($con, $sql);
}
// 获取跳转链接
$link = $_POST['link'];
$link_one = $_POST['link_one'];
$link_two = $_POST['link_two'];
// 将数据存储到数据库中
$sql = "UPDATE shopsy SET link='$link', link_one='$link_one', link_two='$link_two',shop_name='$shop_name', kefutime='$kefutime' WHERE puid='$puid'";
if (mysqli_query($con, $sql)) {
echo '';
} else{
echo '' . mysqli_error($con);
}
}
?>