呵呵,好提议 我觉得这个没什么意思。有心生蛋没心夫子,老手的话你这东西人家看都不看。新手人家看了也不知道是怎么回事,一个代码乱七八糟的。有要有心给那些新手的话弄个好点的顺便上个原理图。加以详细说明,他的原理等。。。。。 #6位日期版,给你参考一下#
#清除所有/ppp secret的remote-address ip
/ppp secret
:foreach j in= do={:if (!="") do={unset $j remote-address;}}
#计算日期
:global ipn 11
:local Date ;:local Year ([:pick $Date 7 11]-1)
:local Month ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $Date 0 3]])
:local Day [:pick $Date 4 6];:if ([:pick $Date 4 5] = 0) do={:set Day [:pick $Date 5 6]};:set Day ($Day-1)
:local leapyear 0,31,59,90,120,151,181,212,243,273,304,334,0,31,60,91,121,152,182,213,244,274,305,335
:global Today ($Year*365+$Year/4)
:if (($Year-$Year/4*4) != 3) do={:set Today ($Today+[:pick $leapyear $Month]+$Day)} else={:set Today ($Today+[:pick $leapyear ($Month+12)]+$Day)}
:local usname;:local uspfl;:local Ccomment;:local Exp;:local CYear;:local CMonth;:local CDay;:local CToday
:global Week ($Today-$Today/7*7)
:log error ("今天: " .$Year+1 ."-". $Month+1 ."-". $Day+1 ." 星期". $Week);
/ppp secret
:foreach i in= do={
:set Ccomment
:set usname
:if ([:typeof [:tonum [:pick $Ccomment 0 6]]]="num" && [:typeof [:tonum [:pick $Ccomment 6 7]]]!="num") do={
:set Exp [:pick $Ccomment 0 6];:set CToday 0
:set uspfl ;:set CYear ([:pick $Exp 0 2]-1);:set CYear ("20" . "$CYear");:set CToday ($CYear*365+$CYear /4)
:set CMonth [:pick $Exp 2 4];:if ([:pick $Exp 2 3] = 0) do={ :set CMonth [:pick $Exp 3 4]};:set CMonth ($CMonth-1)
:set CDay [:pick $Exp 4 6];:if ([:pick $Exp 4 5] = 0) do={ :set CDay [:pick $Exp 5 6]};:set CDay ($CDay-1)
:if (($CYear-$CYear/4*4) != 3) do={:set CToday ($CToday+[:pick $leapyear $CMonth]+$CDay)} else={:set CToday ($CToday+[:pick $leapyear ($CMonth+12)]+$CDay)}
:if ($CToday < $Today) do={ disable $i
:set Ccomment ( $Ccomment . " [脚本停用]" )
/ppp secret set $i comment=$Ccomment;
/ppp active remove
:log error ("已停帐号:" . $usname . ",到期时间是:" . $CYear+1 . "-" . $CMonth+1 . "-" . $CDay+1)} else={
:local lc;:local rc;
:set lc [:find $Ccomment "["]
:set rc [:find $Ccomment "]"]
:if ( ($lc<$rc)&&($rc-$lc=9)) do={:set Ccomment ( [:pick $Ccomment 0 $lc]);/ppp secret set $i comment=$Ccomment;}
:if (($CToday-5) < $Today) do={
:if ([:len $uspfl]=6) do={
:if ([:pick $uspfl 0 4]="1.8M") do={set $i remote-address=("112.9" . [:pick $uspfl 5 6] . ".16." . $ipn);:set ipn ($ipn+1)}
:if ([:pick $uspfl 0 4]="3.6M") do={set $i remote-address=("112.9" . [:pick $uspfl 5 6] . ".17." . $ipn);:set ipn ($ipn+1)}
:if ([:pick $uspfl 0 4]="5.3M") do={set $i remote-address=("112.9" . [:pick $uspfl 5 6] . ".18." . $ipn);:set ipn ($ipn+1)}}
:if ([:len $uspfl]=7) do={
:if ([:pick $uspfl 0 4]="1.8M") do={set $i remote-address=("112." . (90+[:pick $uspfl 5 7]) . ".16." . $ipn);:set ipn ($ipn+1)}
:if ([:pick $uspfl 0 4]="3.6M") do={set $i remote-address=("112." . (90+[:pick $uspfl 5 7]) . ".17." . $ipn);:set ipn ($ipn+1)}
:if ([:pick $uspfl 0 4]="5.3M") do={set $i remote-address=("112." . (90+[:pick $uspfl 5 7]) . ".18." . $ipn);:set ipn ($ipn+1)}}
/ppp active remove ;:log error ("用户:" . $usname . " 使用期剩余" . $CToday-$Today . "天,已通过网页提示")}
}} else={:log info ("用户:" . $usname . " 日期标记错误!")}} 这部分要你自己修改的:
:if (($CToday-3) < $Today) do={
:if ($uspfl="1.8M") do={set $i remote-address=("192.168.2. . "$ipn");:set ipn ($ipn+1)}
:if ($uspfl="3.6M") do={set $i remote-address=("192.168.4. . "$ipn");:set ipn ($ipn+1)}
:if ($uspfl="5.3M") do={set $i remote-address=("192.168.6. . "$ipn");:set ipn ($ipn+1)}}
/ppp active remove ;:log error ("用户:" . $usname . " 使用期剩余" . $CToday-$Today . "天,已通过网页提示")}
}} else={:log info ("用户:" . $usname . " 日期标记错误!")}} 3楼正解;P:victory: 很不错,看有没有高手可以指点! 本帖最后由 szhefeng 于 2012-7-13 19:31 编辑
去学学Adobe Photoshop他们是怎么做教程的,这东西不是说我不懂我是觉得新手看你的这个没有个1~2,3年他们是上不了手的;P
页:
[1]