???????. ????? 2: ??????? ? ?????? ?? ????? ? ??? ????? ???????. (?/? "????????? ????") ?? ?????, ?? ?????, ?? ????? ???????????? ???????, ????????? ?????????. ????????? ??? ??????????? ????????? ?... ?????? ????????? ?????? ??????? ????????. ????????. ???? ????? ? ?????? ?? ???????. ?? ??????????? ??????? ?? os2.in.ru. ??????????, ??? ????? ?? iptrace, ? ipstat ??? ????? ?????????? ?? ??????? ? ???????? ??????????. ?? ??? ???? ??? ?????. ????? ????????? ????? SFF ????? ?????????? ???????? ? ???? ?? ?????? ???????? - ipstat. ???????? ????-?? ??????, ??????? ??? ??????? ????? ???????? ??? ?????? Mysql (???? ?????? ?????? 4.? ???????? ??????-??????) ? php4, ??? ??????? ???????? ?????? ? Mysql ? "??? ????? ?? ??? ????????? ? ???????". I. ????????? ? ????????? ??????? ?????????? ?????: ????????? mysql, php4, apache ?? ?????, ??? ????? - phpmyadmin. ???? SFF ? ???????????? ipstat ????????? ??????. ?????? apache, php (?? ???????? ????????? php.exe, ????? php-??????? ???????? ?? ????????? ??????) ? mysql. ?????? sff. ????????????? ?????????? ipstat ? ???????? ?? ????????? ??? ?????????? ??????. ???? ???????, ???????? ?? ??? ?? ?????? ???????. ??????? ????????? ?? ????????????????? - ? ?????????? SFF ?????????? ????????? ??????: ... [filter] ; Packet filter enable = yes rule = 1 plugin 1 ... [plugins] plugin=1 C:\sff\bin\ipsfstat.dll ... ? IPSTAT ? ??????? ?? ???????? ?? ????????? ???????? ????????? ??????: ; Data mode: Short|Long. ; Default value = Long; Data = Short ; Plugin mode: Log|Pipe. ; Default value = Log. Mode = Pipe ????????? ???. ?, ???????? ???????: IPStat.exe stat lan0 ???? ????????? ?? ?????????? ? ????????? ???????. II. "?????... ?????... ????..." (?) ??? ??????????????? ?????? ????????????? ??? "??????????" ??????? ???????????? ??????. ??? ?????? ????, ??? ??? ????? ???? ????????. ????????, ??? ??????????? ??????? ????? ??????? ?????? ???? ??????? ????? ???????????, ???????????????? ? ???????????????????. ??? ??????????? ??????? ????????, ???? ??? ? ?? ?????????? ?? ??????? ?? PHP - ??? ?????????????? (? ?? ???????? ??????? ?????????????). ??? ?? ?????. 1. ???? ??????. ??????? ??????? ? Mysql (??? ??? ???????? ???????? ????? phpmyadmin, ?? ???????? ????? ?????? ?????????????? ???????, ??????? ????? ????????? ??????????? ??????????? ? ???????? ????) ??? ??????? ?????? ? ??????? ???? statYEARMN, ??? YEAR - ???, MN - ????? (stat200401 ? ??), ????????? ?????????: CREATE TABLE stat200402 ( date_time TIMESTAMP NOT NULL, from_ip INT NOT NULL DEFAULT '0', to_ip INT NOT NULL DEFAULT '0', size INT NOT NULL DEFAULT '0', KEY from_ip (from_ip), KEY to_ip (to_ip) ) ?? ???????? ??? ?????????????? ?? ????? from_ip ? to_ip. ???? ?????? ????? ?????????. ?????? ?????? php-??????? ?????? 15 ??? (????? ????? ??????????? ?? ????? ;) php.exe -q stat-mysql.php ? ??????? ?????????? ipstat.exe, ??? stdout ????????, ? ?????? ?????? ???????????? ? ?????? ??????? ???? ??????. 2. "???? ?????" (?) ?????? ????? ??????? ??????? ? ??????????????? ???????????: ?????? ?????, ?? ?????????????????? ????? ??????? (? ???? ?????? ???????????????? ??????), ?????? ?????????? ????? (?????????? ????????) ? ??????? ???????. ?????? ???????? ??? ????? ??????????? ? ???? ?????? ?? ~1600 ?????: 62.16.0.0/19 62.16.64.0/19 ... ??? ??. ??????? ??????? net01 ? net02 ????: CREATE TABLE net01 ( ip INT NOT NULL DEFAULT '0', mask INT NOT NULL DEFAULT '0', KEY ip (ip) ) ????? ??????????? ?????? ????? (????? ??? ????? ????? PHP - table2mysql.php) ? ????????? ??????? net01(?????? ?? ??????????) ? net02 (?????????? ????). ??? ???? ????? ???? /19 (???) ?????????? ? ????????? ????? (0xffffffff << (32 - net)). ??????, ?? ???????? ?????????, ??? ? ???? ???????? ???????? ??????? IP-????? (?.?. ? ??? ??? ????????? ???????? IP & MASK, mask=0xffffffff << (32 - net)). ?????????? ??????? ??????? - type (int) price (float) - ??????????? ??? ????????. ????? type=0 ????? ??????? ???? ?? ??????, type=1 - ????????, ? type=2 - ??????? (??? ?????????? ???????). 3. ? ?????? ??????? ?????????. ?????? get_traffic.php. ??? ????????? IP ???????? ???? ??????? ???????, ????? ???? ???????, ?? ??????? ?? ????????? ??????, ?, ???????, ?? ??????? ?? ??????????? ??????. ???????? ?????????? ?????? (??????? ?? ?????? ????????) ? ???????? ????? ?????. ???-?? ????? ??????: Traffik type 0, 189 Mbytes with price/meg: 0.100000 cost=18.917285 Traffik type 1, 1155 Mbytes with price/meg: 0.010000 cost=11.556534 Traffik type 2, 0 Mbytes with price/meg: 0.000000 cost=0.000000 Whole payment = 30.473819 $ III. ??? ?????????? ??????? ??????. ?????? ????? ???????????? ?????? ????????? ????????: 1. ?????????? ????????? ???????? ?????. ?????? ??????? (????? ??????????? ???????? ? ???? ??????) - ?????? ???????? ??????? ?? ????????? ? ??????, ?????????? ?????????? ?? ipstat-???????. ???, ??????, ???????? ?????????? ?????? ??? ???????????? ??? IP-???????. 2. ?? ??????? Mysqld ?????????? ????????? ???????? ??????????? ???? ??????, ??? ??? ????? ????????? ???????????? ??? ????? ???? ????????, ?, ??? ?????????, mysql ?????????????. 3. ??? ?????? ??????? ? mysqld, ? ?????? ????? ?????????? ????? ???????? ????????? ????? ????????. ?????????? ?????????? ?????? ? ????, ??????. 4. ?? ?, ???????, ????? ??????????? Web-????????? (? ?? ??? ??????, ????? PHP?), ??? ????????, ???????? ? ?.?. ?????????????: zuko, nickk - ?? ???? ??????? ;) banshee, nickk, samm - ????? ???? ??????? php ? sql. ? ????? #os2russian (?? ?????? ???????????) ?? ???????? ???????. PS. ?????????? ??????? ???????? ?? ftp://ftp.pilot-film.com/OS2/bill/ Alexey Gankov (Alex-G)