1 Star 3 Fork 2

mojie126/HDCN-PT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
takeamountupload.php 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
mojie126 提交于 2015-01-13 10:57 . 增加POST来源验证函数
<?php
require "include/bittorrent.php";
if ($_SERVER["REQUEST_METHOD"] != "POST")
stderr("错误", "权限不足");
dbconn();
loggedinorreturn();
checkserver();
if (get_user_class() < UC_SYSOP)
stderr("错误", "权限不足");
$sender_id = ($_POST['sender'] == 'system' ? 0 : (int) $CURUSER['id']);
$dt = sqlesc(date("Y-m-d H:i:s"));
$msg = trim($_POST['msg']);
$amount = $_POST['amount'];
if (!$msg || !$amount)
stderr("错误", "不要留空");
if (!is_numeric($amount))
stderr("错误", "上传量必须为数字");
$updateset = $_POST['clases'];
if (is_array($updateset)) {
foreach ($updateset as $class) {
if (!is_valid_id($class) && $class != 0)
stderr("错误", "不存在的用户组");
}
}else {
if (!is_valid_id($updateset) && $updateset != 0)
stderr("错误", "不存在的用户组");
}
$subject = trim($_POST['subject']);
$query = sql_query("SELECT id FROM users WHERE class IN (" . implode(",", $updateset) . ")");
$amount = sqlesc(getsize_int($amount, "G"));
sql_query("UPDATE users SET uploaded=uploaded + $amount WHERE class IN (" . implode(",", $updateset) . ")") or sqlerr(__FILE__, __LINE__);
while ($dat = mysql_fetch_assoc($query)) {
sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ($sender_id, $dat[id], $dt, " . sqlesc($subject) . ", " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
}
header("Refresh: 0; url=amountupload.php?sent=1");
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/mojie126/HDCN-PT.git
git@gitee.com:mojie126/HDCN-PT.git
mojie126
HDCN-PT
HDCN-PT
master

搜索帮助