zoukankan      html  css  js  c++  java
  • 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');
    }
    

      

  • 相关阅读:
    centos yum安装与配置vsFTPd FTP服务器(转)
    CentOS 6.9安装配置nmon
    Linux 中将用户添加到组的指令
    linux 设置用户组共享文件
    linux时间同步ntpdate
    java获取端口号,不用request
    centos6.5 yum安装redis
    Centos6 yum安装nginx
    Nginx 不支持WebSocket TCP
    django中的分页应用 django-pure-pagination
  • 原文地址:https://www.cnblogs.com/ip99/p/12992192.html
Copyright © 2011-2022 走看看