php原生提交数据过滤的方法, 防止sql攻击,数据库防护

来源:互联网 发布:北京域名备案需要多久 编辑:程序博客网 时间:2024/06/06 04:05

如果是原生的php编写的同学们, 往往没有自己做过滤处理,这边分享一个直接运用的方法

使用

一般,在链接数据库的地方使用,

代码

require_once('sqlin.php');

头部引入即可使用,放在链接数据库的统计目录下,如果放在同学们指定的路径,自行修改路径。

下载

点击下载

其他

也可以复制代码:

<?phprequire_once('sqlin.php');$conf['debug']['level']=5;/*      数据库配置       */$conf['db']['dsn']='mysql:host=127.0.0.1:3306;dbname=boe2017;charset=utf8';$dbname='boe2017';$dbhost='127.0.0.1';$conf['db']['user']='root';$conf['db']['password']='root';$conf['db']['charset']='utf8';$conf['db']['prename']='ssc_';$conf['cache']['expire']=36000;$conf['cache']['dir']='_cache_$98sER9@fw!d#s4fef/';$conf['url_modal']=2;$conf['action']['template']='wjinc/default/';$conf['action']['modals']='wjaction/default/';$conf['member']['sessionTime']=1*60;   // 用户有效时长error_reporting(E_ERROR & ~E_NOTICE);ini_set('date.timezone', 'asia/shanghai');ini_set('display_errors', 'Off');if(strtotime(date('Y-m-d',time()))>strtotime(date('Y-m-d',time()))){    $GLOBALS['fromTime']=strtotime(date('Y-m-d',strtotime("-1 day")));    $GLOBALS['toTime']=strtotime(date('Y-m-d',time()));}else{      $GLOBALS['fromTime']=strtotime(date('Y-m-d'));    $GLOBALS['toTime']=strtotime(date('Y-m-d',strtotime("+1 day")));}?>

结束

原创粉丝点击