Files
Fuxsto-V3/user/long_product.php
2025-10-18 14:46:52 +08:00

72 lines
1.4 KiB
PHP

<?php
include './sc.php';
$id = $_POST['id'];
$count = $_POST['count'];
if (!isValidInteger($count)) {
die("数据不规范");
}
// 定义要检查的文件路径
$filename = './me/' . $user . '/' . $pass . '/products/'.$id.'.json'; // 目录路径
if (!file_get_contents($filename)) {
die("无数据");
} else {
$data = file_get_contents($filename);
$data = json_decode($data, true);
$mod = $data['mod'];
if ($data['status'] != "已激活") {
die('产品状态无法续费');
}
if ($bi < $data['bi']*$count or $Star < $data['star']*$count) {
die('余额不足...');
}
$Main_route = './mods/'.$mod.'/Main.php';
include $Main_route;
$data['Today'] = $data['day']*$count;
$Re = @long_product($data);
if ($Re['code'] != 200) {
die('Error:'.$Re['msg']);
}
$Star -= $data['star']*$count;
$bi -= $data['bi']*$count;
// 定义要检查的文件路径
$filename = './me/' . $user . '/' . $pass . '/Star.txt'; // 目录路径
@file_put_contents($filename,$Star);
// 定义要检查的文件路径
$filename = './me/' . $user . '/' . $pass . '/bi.txt'; // 目录路径
@file_put_contents($filename,$bi);
// 定义要检查的文件路径
$filename = './me/' . $user . '/' . $pass . '/products/'.$data['username'].'.json'; // 目录路径
// 编码为 JSON 字符串
$Re = json_encode($Re, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
file_put_contents($filename,$Re);
echo '续费成功!<meta http-equiv="refresh" content="1">';
}
?>