• ROS白名单服务端PHP脚本,客户端ROS脚本


    客户端ROS脚本:

    {
    :global rosid
    :global addlist do={
    /ip firewall address-list
    :if (""=[find list=white_list address="$1"]) do={
    add list=whitelist address="$1" timeout=2m
    } else={
    set [find list=white_list address="$1"] timeout=2m
    }
    }
    
    
    :local ser "http://www.ip99.xyz/shortproxy.php?rosid=$rosid"
    /tool fetch url="$ser" mode=http dst-path=iplist.rsc
    :delay 1
    /import file=iplist.rsc
    :delay 1
    /file remove [find name=iplist.rsc]
    }
    

      服务端php脚本:

    if ( isset($_GET['rosid'])) {
    	header('Content-type: text/plain');
    	$rosid=filter_input(INPUT_GET,'rosid');
    	$rosid=(int)$rosid;
    	if($rosid>0) {
    
    	} else {
    		echo "no rosid";
    		exit(0);
    	}
    	require_once './db/ip99.php';
    	$sql="select getiplist('$rosid')";
    	$conn=mysql_connect($host,$user,$pass);
    	if (!$conn) {die("could not connect to the database.
    ");}
    	mysql_query("set names 'utf8'");
    	$res=mysql_select_db($db);
    	echo ":global addlist
    ";
    
    	$sql="select ipaddress from {$tb_whiteip} where expiration>now() and find_in_set($rosid,areas)";
    	$res=mysql_query($sql,$conn);
    	while($row=mysql_fetch_row($res)) {
    		$ip=$row[0];
    		if(strlen(trim($ip))>7) {
    			echo " $addlist $ip
    ";
    		}
    	}
    	mysql_close($conn);
    	exit(0);
    }
    

      数据库 PHP文件:

    $host='www.ip99.xyz';
    $user='user';
    $pass='pass';
    $db='dbname';
    
    $tb_whiteip='whiteip';
    
    $conn=mysqli_connect($host,$user,$pass,$db);
    if (mysqli_errno($conn)) {
        die('db connect error:' . mysqli_error($conn));  
        
    } else {
        mysqli_set_charset($conn,'utf8');
    }
    

      

  • 相关阅读:
    HDU 5441 离线处理 + 并查集
    [转载]HDU 3478 判断奇环
    POJ 1637 混合图的欧拉回路判定
    [转载] 一些图论、网络流入门题总结、汇总
    UVA 820 --- POJ 1273 最大流
    [转载 ]POJ 1273 最大流模板
    POJ 3041 -- 二分图匹配
    2014西安现场赛F题 UVALA 7040
    UVA 12549
    割点、桥(一点点更新)
  • 原文地址:https://www.cnblogs.com/ip99/p/12992192.html
Copyright © 2020-2023  润新知