s.php,s.php · ciweiin/海洋cms 海洋影视管理系统 - 免费开源PHP - Gitee.com

该博客主要讨论了网站安全措施,包括输入数据的过滤与转义,防止SQL注入和XSS攻击。通过使用lib_replace_end_tag()函数替换潜在危险字符,以及stripslashes_array()函数消除反斜杠,确保用户提交的数据安全无害。同时,博客还介绍了检查用户签到状态的代码,确保每日只能签到一次,增加用户互动。
摘要由CSDN通过智能技术生成

session_start();

error_reporting(0);

function lib_replace_end_tag($str)

{

if (empty($str)) return false;

$str = htmlspecialchars($str);

$str = str_ireplace('/', "", $str);

$str = str_ireplace('[', "", $str);

$str = str_ireplace(']', "", $str);

$str = str_ireplace('>', "", $str);

$str = str_ireplace('

$str = str_ireplace('?', "", $str);

$str = str_ireplace('&', "", $str);

$str = str_ireplace('|', "", $str);

$str = str_ireplace('(', "", $str);

$str = str_ireplace(')', "", $str);

$str = str_ireplace('{', "", $str);

$str = str_ireplace('}', "", $str);

$str = str_ireplace('%', "", $str);

$str = str_ireplace('=', "", $str);

$str = str_ireplace(',', "", $str);

$str = str_ireplace(':', "", $str);

$str = str_ireplace(';', "", $str);

$str = str_ireplace('*', "", $str);

$str = str_ireplace('if', "i", $str);

$str = str_ireplace('0x', "", $str);

$str = str_ireplace('@', "", $str);

$str = str_ireplace('--', "", $str);

$str = str_ireplace('/*', "", $str);

$str = str_ireplace('*/', "", $str);

$str = str_ireplace('*!', "", $str);

$str = str_ireplace('//', "", $str);

$str = str_ireplace('\\', "", $str);

$str = str_ireplace('#', "", $str);

$str = str_ireplace('%00', "", $str);

$str = str_ireplace('0x', "", $str);

$str = str_ireplace('%0b', "", $str);

$str = str_ireplace('%23', "", $str);

$str = str_ireplace('%26', "", $str);

$str = str_ireplace('%7c', "", $str);

$str = str_ireplace('hex', "he", $str);

$str = str_ireplace('file_', "fil", $str);

$str = str_ireplace('updatexml', "update", $str);

$str = str_ireplace('extractvalue', "extract", $str);

$str = str_ireplace('union', "unio", $str);

$str = str_ireplace('benchmark', "bench", $str);

$str = str_ireplace('sleep', "slee", $str);

$str = str_ireplace('load_file', "", $str);

$str = str_ireplace('outfile', "out", $str);

$str = str_ireplace('ascii', "asc", $str);

$str = str_ireplace('char', "cha", $str);

$str = str_ireplace('chr', "ch", $str);

$str = str_ireplace('substr', "sub", $str);

$str = str_ireplace('substring', "sub", $str);

$str = str_ireplace('script', "scri", $str);

$str = str_ireplace('frame', "fra", $str);

$str = str_ireplace('information_schema', "infor", $str);

$str = str_ireplace('exp', "ex", $str);

$str = str_ireplace('information_schema', "infor", $str);

$str = str_ireplace('GeometryCollection', "Geomet", $str);

$str = str_ireplace('polygon', "poly", $str);

$str = str_ireplace('multipoint', "multi", $str);

$str = str_ireplace('multilinestring', "multi", $str);

$str = str_ireplace('linestring', "lines", $str);

$str = str_ireplace('multipolygon', "multi", $str);

$str = str_ireplace('base64', "bas", $str);

return $str;

}

$_GET = stripslashes_array($_GET);

$_POST = stripslashes_array($_POST);

$_COOKIE = stripslashes_array($_COOKIE);

$_REQUEST = stripslashes_array($_REQUEST);

$GLOBALS = stripslashes_array($GLOBALS);

$_SERVER = stripslashes_array($_SERVER);

$_SESSION = stripslashes_array($_SESSION);

$_FILES = stripslashes_array($_FILES);

$_ENV = stripslashes_array($_ENV);

$HTTP_RAW_POST_DATA = stripslashes_array($HTTP_RAW_POST_DATA);

$http_response_header = stripslashes_array($http_response_header);

function stripslashes_array(&$array) {

while(list($key,$var) = each($array)) {

if ($key != 'argc' && $key != 'argv' && (strtoupper($key) != $key || ''.intval($key) == "$key")) {

if (is_string($var)) {

$array[$key] = lib_replace_end_tag($var);

}

if (is_array($var)) {

$array[$key] = stripslashes_array($var);

}

}

}

return $array;

}

require_once("include/common.php");

require_once(sea_INC."/main.class.php");

if($cfg_spoints==0){showmsg('未开启签到功能', 'member.php');exit;}

$u=addslashes($_SESSION['sea_user_id']);

if(empty($u) OR !is_numeric($u)){showmsg('无法获取目标用户ID', 'member.php');exit;}

$row = $dsql->GetOne("Select stime from sea_member where id='$u'");

$nowtime=time();

$lasttime=$row['stime'];

if($nowtime-$lasttime > 86400 )

{

$dsql->ExecuteNoneQuery("Update sea_member set stime = $nowtime where id='$u'");

$sql="Update sea_member set points = points+$cfg_spoints where id=$u";

$dsql->ExecuteNoneQuery("$sql");

showmsg('签到成功!', 'member.php');exit;

}

else

{

showmsg('已经签到!', 'member.php');exit;

}

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值