On 08/07/02 19:54 +0530, Kunal Shah wrote: > Hi, > I am in search of cyber cafe billing system for linux. > i searched sourceforge.net and google but cant work out for any. > can you please guide me about this ? AFAIK, there are no good ones out there. However, you can easily script one up using perl+iptables/ipchains+Apache+some database. Write a CGI that reads from a table of MAC addresses/IP addresses, and lets the operator add a rule using a point and click interface allowing that address to go through. With a default DENY stance, you can prevent everyone else from being allowed to surf except those that the operator has authorized. When the operator starts a session, insert a timestamp into the database, and when the user leaves, have the operator terminate the session, which calls the billing function(s), and presents a bill to the user. This is easy stuff.
##Following is rough and bad code off the top of my head to demonstrate ##my ideas. #!/usr/bin/perl -wT use strict; use CGI; use DBI; my $q = new CGI; my $mac_addr = $q->param(mac_addr); #Do some untainting here my $dbh = db_connect(); #This is a function that connects to a database. my $query = "INSERT INTO active_machines(starttime) VALUES (now()) WHERE mac = $mac_addr"; my $sth = $dbh->prepare($query); $sth->execute; `Create a new iptables rule here`; ##Disconnect call #!/usr/bin/perl -wT use strict; use CGI; ... similar stuff, insert a stoptime entry instead of a starttime for the mac address ... Delete the iptables rule. Run a age(stoptime-starttime)*rate, and print. Hope this helps somewhat. Devdas Bhagat ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Oh, it's good to be a geek. http://thinkgeek.com/sf _______________________________________________ linux-india-help mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/linux-india-help
