p0int 0 Posted 2008-07-03 21:23:52 Share Posted 2008-07-03 21:23:52 на ваш суд выкладываю скрипт привязки биллинга к программе блокировки внимание скрипт работает таким образом блокирует всех кроме тех у кого положительный баланс для нормаьной его работы рекомендуеться привязывать еще ip + mac arp -s ip mac все пожелания и предложения писать сюда скрип запускать при старте биллинга и в файле /etc/stargazer/OnChange cat /etc/rc.d/block_unpaid #!/usr/bin/php <? $data="0.0.0.0/0\n"; $d = dir("/var/stargazer/users"); while (false !== ($entry = $d->read())) { if (($entry[0]<>".")){ $cash=shell_exec("cat /var/stargazer/users/".$entry."/stat|grep Cash|cut -d \"=\" -f2"); $pass=shell_exec("cat /var/stargazer/users/".$entry."/conf|grep Tariff|cut -d \"=\" -f2"); { $ip=shell_exec("cat /var/stargazer/users/".$entry."/conf|grep IP|cut -d \"=\" -f2"); $ip=trim($ip); $mac=shell_exec("arp -an|grep ".$ip."\)|cut -d \"(\" -f2 |cut -d \" \" -f3"); if ($cash>0) if (trim($mac) !="<incomplete>") $data.=$ip."@!".$mac."\n"; else $data.="!".$ip."\n"; } } } file_put_contents("/var/lib/ip-sentinel/ips.cfg",$data); ?> Link to post Share on other sites
fredik 0 Posted 2008-07-04 19:00:12 Share Posted 2008-07-04 19:00:12 а под базу мускуля не кто такое не практиковал? если есть поделитесь если не трудно... Link to post Share on other sites
p0int 0 Posted 2008-07-04 22:55:14 Author Share Posted 2008-07-04 22:55:14 для мускуля #!/usr/bin/php <? $data="0.0.0.0/0\n"; @mysql_connect("localhost","LOGIN","PASSWORD") or die('Sorry can`t connect to database'); @mysql_select_db("stg") or die('error db'); $sql="SELECT * FROM `users` WHERE `Cash` >0"; $res=mysql_query($sql) or die ('error query'); while ($row = mysql_fetch_array($res)) { $ip=trim($row['IP']); $mac=shell_exec("arp -an|grep ".$ip."\)|cut -d \"(\" -f2 |cut -d \" \" -f3"); if ($row['Cash']>0) if (trim($mac) !="<incomplete>") $data.=$ip."@!".$mac."\n"; else $data.="!".$ip."\n"; } } } file_put_contents("/var/lib/ip-sentinel/ips.cfg",$data); ?> Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now