--- /dev/null
+Kostas Kalevras: kkalev@noc.ntua.gr
+Main developper
+
+Vasilis Pappas: vpappas@noc.ntua.gr
+parts of user_edit and user_admin
+
+Thanasis Duitsis: aduitsis@noc.ntua.gr
+Part of accounting report generator
+
+Panagiotis Christias: christia@noc.ntua.gr
+HTML pages layout designer
+
+Dragan Milivojevic: galileo@MICROSKY.NET
+A number of bug reports and a lot of crash testing
--- /dev/null
+Ver 1.28:
+* Make user_delete.php3 print something when a user is deleted
+* Cache nas hostname lookups in user_accounting
+Ver 1.27:
+* Allow for variable expansion in the configuration file. Something like:
+ general_base_dir: /usr/local/dialup_admin
+ general_default_file: %{general_base_dir}/conf/default.vals
+* Small changes in the README file
+* A few corrections in the sql drivers
+* Enlarged the textboxes in the user_edit page
+* Created a folder help
+* Added a help page for:
+ o Login-Time
+ o Simultaneous-Use
+ o Dialup-Access
+ o Framed-Compression
+ o Port-Limit
+ o Lock Message
+ o Framed-IP-Address
+Ver 1.26:
+* A few bugfixes for the general sql code (typo mistakes mostly)
+Ver 1.25:
+* Deleted a mysql_close from lib/mysql/create_user since we now have persistent sql connections
+* Removed the select_db() from accounting.php3 since it is not needed
+* A lot of html changes in accounting.php3
+* Changed the sql code to be modular. Now under lib we don't have a mysql directory but a sql directory
+ with a directory drivers which contains the database specific functions. As a result all calls to mysql*
+ functions where changed to call da_sql* functions. Right now mysql should work and postgresql *may* work
+ It is not tested though. Hopefully things will come back to being stable in a few days.
+* Added sql_port and sql_type configuration file directives
+Ver 1.20:
+* Fixed a bug in lib/ldap/change_attrs. When we modify an attribute do an ldap_mod_del($mod) and then a
+ ldap_mod_add($add_r)
+* In accounting.php3 show the attribute description instead of the attribute name.
+Ver 1.19:
+* In lib/ldap/check_password.php3 don't do a user search but use the already available user DN
+* Remove the language support from the get_user_info() functions. They are only used in the user_finger page
+* In user_state show weekly usage for the week starting from sunday 00:00, not for the last 7 days
+* Show upload/download when connected or for the last time the user connected
+* Fixed a few minor problems with the help and about pages
+Ver 1.18:
+* Fixed a small problem with total upload,download numbers in user_admin
+* Fixed a major problem in the accounting report generator when adding an attribute check. Now it
+ should be all OK.
+* Fixed a small bug in lib/mysql/functions.php3. Bug found be galileo@microsky.net
+Ver 1.17:
+* Fixed a few more problems in the mysql code
+* Updated README
+* the help page now prints the README file. It also has a common layout with the other pages
+* Changed the about page to have a common look with the other pages.
+Ver 1.16:
+* Fixed a few typing mistakes in mysql.attrmap
+* If the corresponding attribute name (in ldap or mysql) is 'none' then do not
+ edit/add it. Based on a bug report by galileo@microsky.net
+* Fixed a few errors in lib/attrshow.php3
+Ver 1.15:
+* Added user test page. It will use radclient to send a radius access-request
+ to the radius server and check the response. This page is also used to check
+ that the radius server is working fine. Added user_test.php3 and a few config
+ file parameters.
+* Support for multi valued attributes.
+* Changed cleartext encryption name from none to clear
+* Renamed the general_sql_row_limit configuration directive to sql_row_limit
+Ver 1.12:
+* Added an FAQ
+* Small changes in html code
+* Small changes in the README file
+* Fixed a small problem in delete_user from ldap
+* Removed the Base64 encode since it was causing problems
+Ver 1.11:
+* Changed all ldap_bind() to use the ldap bind DN and password. Should have been
+ the default behaviour
+* Do a Base64 encode in ldap/change_password.php3 before sending the password to
+ the ldap server
+* Added support for module messages in log_badlogins and user_accounting
+* Updated documentation
+Ver 1.10:
+* Added support for users in mysql database. All bugs are welcome. To activate
+ just use mysql as library_type
+* Added support for salt in crypt.php3
+* Added userinfo table to keep information for users (Name,Phone etc). Added two
+ corresponding values in admin.conf
+* Added mysql.attrmap for mysql support
+* Added TODO
+* Added persistent connections for mysql (mysql_pconnect())
+Ver 1.00:
+* Added password change facility in user_edit. Support for multiple
+ password encryption methods
+* Added user deletion page user_delete.php3 with corresponding ldap lib code
+* Moved the second user_info.php3 include in user_edit to the correct location. Also
+ used isset instead of == ''
+* Moved the action toolbar (show,edit,accounting...) into a separate html file
+* Added the nas model in user_finger.php3
+Ver 0.99.8:
+* Added the caller id in the finger facility
+* Changed the start date in the badusers file to 0000
+* Added the out of quota message in user_admin
+* fixed a few problems with the html code in user_admin.php3
+* calculate account status in user_admin for the last week only
+* Change font color to red if used time > corresponding limit (weekly or daily)
+* Added the user_stats.php3. It can be used by outside pages to get a quick
+ overview of the status of the user. It will return the following fields
+ separated by new lines:
+ account_status(active or inactive),lock message,weekly limit,daily limit,
+ weekly used,weekly connections,daily used,daily connections
+* fixed a bug in the subscription analysis in user_admin.php3
+* calculate weekly used from sunday 00:00:00 when the counters reset
+* added clean_radacct which will clean radacct entries which have been open
+ for more than a day. It will not do any harm even if it is incorrect since
+ when rlm_sql runs if the update operation fails then it will fall back to
+ insert (see sql.conf)
+* added log_badlogins. It will continuously read the radius.log file and log
+ to the radacct table all login incorrect and multiple logins with a
+ corresponding acctterminatecause. user_accounting.php3 is already prepared
+ for this (it will show those entries in red)
+* fix a small bug with null values in change_vals.php3 of the ldap lib
+Ver 0.99:
+* Added the badusers table
+* Added the default and regular profile from ldap for user_edit
+* Added the snmpfinger in the finger facility so that it will not
+ relly on the sql database.
+* Added the new user facility
+* Added support for the Lock Message facility
+* Various bug fixes and enhancements
+
+Ver 0.31:
+* Added the @ sign in the {mysql,ldap}_{open,close} functions so that
+ they don't show error messages
+* Changed double quotes with single quotes where applicable for performance
+ reasons
--- /dev/null
+> I was wondering if there is any more documentation about howto setup this
+> software other than what comes in the README?
+
+No, there isn't. It's easier for me to write code than to document it :-)
+Anyway, I always try to make better documentation.
+There's also this FAQ :-)
+
+>
+> What tables do I need to create in the MySQL database?
+
+It depends.
+If you are using ldap for user authentication/information then you only need
+to create the freeradius sql tables (in order to create the radacct table,
+the other tables will just sit around doing nothing) which can be created from a
+sql script in the freeradius distribution. If you are runing mysql it is in
+src/modules/rlm_sql/drivers/rlm_sql_mysql/db_mysql.sql
+
+If you are using mysql for user authentication/information then you will again
+need to create the freeradius sql tables and if you want you could also create
+the userinfo table to store user information (name,telephone etc)
+
+You could also create the badusers table if you want the functionality it provides.
+
+sql scripts to create the badusers and userinfo tables can be found in the
+directory sql (of dialup_admin distribution).
+
+--
+kkalev
--- /dev/null
+dialup_admin is a web based administration interface for the freeradius radius server.
+It is modular and right now it assumes that user information is stored in an ldap server
+or an sql database and accounting in an sql server.
+
+There are also a few more things included:
+
+* sql/badusers.sql: It will create a table named badusers which can be used to hold the
+ history for badusers (date,action)
+* sql/userinfo.sql: It will create a table named userinfo which contains personal information
+ for users stored in the sql database. This can be used if a sql database is used to store user profiles
+ (not ldap).
+* bin/log_badlogins: It will constantly check the radiusd.log file and add all login-incorrect,
+ invalid-user, outside of allowed login time and multiple-login cases to the radacct table with
+ acctstarttime=acctstoptime, acctsessiontime=0 and acctterminatecause containing the reason.
+ If the failing module sent back a module message then it will also appear in the terminate cause.
+* bin/clean_radacct: It will delete all entries in the radacct table with a starttime > 1 day and
+ stoptime = 0. It will not do an harm even if it deletes valid entries since radiusd will fall
+ back to insert if update fails.
+
+The structure of the tree is:
+
+conf:: Contains various configuration files.
+conf::admin.conf=>
+ The main configuration file. The directives used should be easily
+ understood
+conf::config.php3=>
+ Just a helper php4 for reading the admin.conf file. Just make sure that it
+ opens the correct admin.conf file
+conf::default.vals=>
+ Contains the default values for check and reply items. If you also use the users
+ file except for the ldap/sql databases fill in the default values you have inserted
+ for the users.Else comment them out.
+conf::sql.attrs=>
+ Contains inmformation about the sql attributes. This is used by the accounting
+ report generator (accounting.php3).
+conf::user_edit.attrs=>
+ Contains the attributes that user_edit.php3 will show. Just uncomment those
+ which you want to be displayed.
+conf::extra.ldap-attrmap=>
+ Contains a few items not included in ldap.attrmap which are used only by dialup_admin
+ Things like User-Password and Dialup-Lock-Msg. Use none for attributes that are not known
+ by the radius or ldap server.
+conf::sql.attrmap=>
+ Contains the Attribute map for the sql database. Use none for attributes that are not known by
+ the radius server.
+conf::auth.request=>
+ Contains value pairs sent in the test packets which are sent from the test user/server pages.
+
+htdocs:: Contains the basic php files
+htdocs::index.html=>
+ The main index file. Just contains the frames tags
+htdocs::content.html=>
+ Change this file to include the greeting of your choise
+htdocs::buttons.html=>
+ The buttons html page
+htdocs::style.css=>
+ CSS style file. Change it to match your preferences
+htdocs:: user_state.php3 =>
+ It can be used by outside pages to get a quick
+ overview of the status of a user. It will return the following fields
+ separated by new lines:
+ account_status(active or inactive),lock message,weekly limit,daily limit,
+ weekly used,weekly connections,daily used,daily connections
+
+html:: Contains the html code for a few pages
+html::user_admin.html.php3 =>
+ html code for the user_admin page
+html::stats.html.php3 =>
+ html code for the stats page
+html::user_toolbar.html.php3 =>
+ the user toolbar (show,edit,accounting...) which appears in almost all pages
+
+lib:: Contains the library items
+lib::ldap=>
+ The ldap files
+lib::lang=>
+ Allow for multiple languages to be supported
+lib::crypt=>
+ Allow for multiple encryption schemes (for user passwords)
+lib::sql=>
+ Contains the sql library files. There is also a directory drivers
+ which contains functions for various sql databases (mysql and
+ postgresql for the time being).
+
+The rest: The rest are the php4 files. Normally, you should not need to change anything in them.
--- /dev/null
+* Minimize database (ldap,mysql) connections.
+* Clean up html code to make it smaller
+* More messages
+* Skins
+* Other languages in html
+* Multilanguage support for ldap attributes
+* Add language attributes in user_new.php3
+* Finger facility. Should find a way to make it work with all nases. That will
+ mean that it should be made modular and fall back to simple queries to the
+ sql db if it cannot get user info from the nas server
+* Check out dbx library. It seems very promising for database independent code.
+ We 'll see where it goes.
--- /dev/null
+#!/usr/bin/perl
+use DBI;
+use POSIX;
+
+$conf=shift||'/usr/local/dialup_admin/conf/admin.conf';
+
+open CONF, "<$conf"
+ or die "Could not open configuration file\n";
+while(<CONF>){
+ chomp;
+ ($key,$val)=(split /:\s*/,$_);
+ $sql_server = $val if ($key eq 'sql_server');
+ $sql_username = $val if ($key eq 'sql_username');
+ $sql_password = $val if ($key eq 'sql_password');
+ $sql_database = $val if ($key eq 'sql_database');
+ $sql_accounting_table = $val if ($key eq 'sql_accounting_table');
+}
+close CONF;
+
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
+$date = POSIX::strftime("%Y-%m-%d %T",$sec,$min,$hour,($mday - 1),$mon,$year,$wday,$yday,$isdst);
+print "$date\n";
+
+$dbh = DBI->connect("DBI:mysql:$sql_database:$sql_server","$sql_username","$sql_password");
+$dbh->do("DELETE FROM $sql_accounting_table WHERE AcctStopTime = '0' AND AcctStartTime < '$date';");
+$dbh->disconnect();
--- /dev/null
+#!/usr/bin/perl
+use DBI;
+
+use Date::Manip qw(ParseDate UnixDate);
+$|=1;
+
+$file=shift||'none';
+$conf=shift||'/usr/local/dialup_admin/conf/admin.conf';
+
+open CONF, "<$conf"
+ or die "Could not open configuration file\n";
+while(<CONF>){
+ chomp;
+ ($key,$val)=(split /:\s*/,$_);
+ $sql_server = $val if ($key eq 'sql_server');
+ $sql_username = $val if ($key eq 'sql_username');
+ $sql_password = $val if ($key eq 'sql_password');
+ $sql_database = $val if ($key eq 'sql_database');
+ $sql_accounting_table = $val if ($key eq 'sql_accounting_table');
+}
+close CONF;
+
+$dbh = DBI->connect("DBI:mysql:$sql_database:$sql_server","$sql_username","$sql_password")
+ or die "Could not connect to SQL database: $DBI::errtstr\n";
+open LOG, "<$file"
+ or die "Could not open file $file\n";
+seek LOG, 0, 2;
+for(;;){
+ while(<LOG>){
+ $do=0;
+ chomp;
+ if ($_ ne ''){
+ $user = $nas = $port = $caller = '-';
+ if (/Login incorrect/){
+ if (/Login incorrect \((.+?)\):/){
+ $cause = 'Login-Incorrect ($1)';
+ }else{
+ $cause='Login-Incorrect';
+ }
+ $do=1;
+ }
+ elsif (/Invalid user/){
+ if (/Invalid user \((.+?)\):/){
+ $cause = 'Invalid-User ($1)';
+ }else{
+ $cause='Invalid-User';
+ }
+ $do=1;
+ }
+ elsif (/Multiple logins/){
+ $cause='Multiple-Logins';
+ $do=1;
+ }
+ elsif (/(Outside allowed timespan \(.+?\)):/){
+ $cause = '$1';
+ $do=1;
+ }
+ if ($do){
+ $date = (split / : /,$_)[0];
+ $date2 = ParseDate($date);
+ if ($date2){
+ ($year,$mon,$mday,$hour,$min,$sec)=UnixDate($date2,'%Y','%m','%d','%H','%M','%S');
+ }
+ $time = "$year-$mon-$mday $hour:$min:$sec";
+ if (/\[(\w+?)\]\s+\(from (.+?)\)/){
+ $user = $1;
+ ($nas,$port,$caller) = (split /\s+/,$2)[1,3,5];
+ }
+ $caller='' if (!defined($caller));
+ $user =~s/[^\w]//g;
+ $nas =~s/[^\w]//g;
+ if ($nas !~ /\.noc\.ntua\.gr$/){
+ $nas .= '.noc.ntua.gr';
+ }
+ $port =~s/[^\d]//g;
+ $caller =~s/[^\d]//g;
+ $addr = gethostbyname $nas;
+ ($a,$b,$c,$d)=unpack('C4',$addr);
+ $addr = "$a.$b.$c.$d";
+$dbh->do("INSERT INTO $sql_accounting_table (UserName,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$addr','$port','$time','$time','0','0','0','$caller','$cause');");
+ }
+ }
+ }
+ sleep 2;
+ seek LOG,0,1;
+}
+$dbh->disconnect();
--- /dev/null
+#!/usr/bin/perl
+
+$snmpget="/usr/local/bin/snmpget";
+$snmpwalk="/usr/local/bin/snmpwalk";
+$nas=shift;
+$user=shift;
+$com=shift || "public";
+$type=shift|| "xml";
+
+@ModulationScheme = (
+ "error",
+ "unknown",
+ "bell103a",
+ "bell212a",
+ "v21",
+ "v22",
+ "v22bis",
+ "v32",
+ "v32bis",
+ "vfc",
+ "v34",
+ "v17",
+ "v29",
+ "v33",
+ "k56flex",
+ "v23",
+ "v32terbo",
+ "v34plus",
+ "v90",
+ "v27ter",
+);
+
+@Protocol = (
+ "error",
+ "normal",
+ "direct",
+ "reliableMNP",
+ "reliableLAPM",
+ "syncMode",
+ "asyncMode",
+ "ara10",
+ "ara20",
+ "unknown",
+);
+
+$modem=`$snmpwalk $nas $com enterprises.9.2.9.2.1.18 | grep $user`;
+if($modem=~/enterprises\.9\.2\.9\.2\.1\.18\.(\d+) =/){
+ $modem=$1;
+ $slot=(1+int($modem/120));
+ $port=$modem%120-1;
+ $modem="$slot.$port";
+
+
+ $duration=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.9.$modem` or die "No MIB\n";
+ $duration=~/\) (.*)\./;
+ $duration=$1;
+
+ $modulation=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.12.$modem` or die "No MIB\n";
+ $modulation=~/ \= (\d+)/;
+ $modulation=$ModulationScheme[$1];
+
+ $protocol=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.13.$modem` or die "No MIB\n";
+ $protocol=~/ \= (\d+)/;
+ $protocol=$Protocol[$1];
+
+ $txrate=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.14.$modem` or die "No MIB\n";
+ $txrate=~/Gauge32\: (\d+)/;
+ $txrate=$1;
+
+ $rxrate=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.15.$modem` or die "No MIB\n";
+ $rxrate=~/Gauge32\: (\d+)/;
+ $rxrate=$1;
+
+ $rxsignal=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.17.$modem` or die "No MIB\n";
+ $rxsignal=~/ \= (.*)\n/;
+ $rxsignal=$1;
+
+ if($type eq "xml"){
+ print"<Modulation>$modulation</Modulation><Protocol>$protocol</Protocol><TxRate>$txrate</TxRate><RxRate>$rxrate</RxRate><RxSignal>$rxsignal</RxSignal>\n";
+
+ }else{
+ print "Duration>\t$duration\n";
+ print "Modulation>\t$modulation\n";
+ print "Protocol>\t$protocol\n";
+ print "TxRate>\t\t$txrate\n";
+ print "RxRate>\t\t$rxrate\n";
+ print "RxSignal>\t$rxsignal dbm\n";
+ }
+}
--- /dev/null
+#!/usr/bin/perl
+
+$SNMPWALK="/usr/bin/snmpwalk";
+
+$walk =`$SNMPWALK $ARGV[0] public .iso.org.dod.internet.private.enterprises.9.2.9.2.1.18`;
+$walk.=`$SNMPWALK $ARGV[0] public .iso.org.dod.internet.private.enterprises.9.9.27.1.1.3.1.7`;
+
+while($walk=~/\"(\w+?)\"/g){
+ $user=lc($1);
+ if($out) {
+ $out=$out.",'$user'";
+ }else{
+ $out="'$user'";
+ }
+}
+print "$out\n";
--- /dev/null
+#
+# it can be el (greek) or default
+#
+general_prefered_lang: el
+general_prefered_lang_name: Greek
+#
+general_base_dir: /usr/local/dialup_admin
+general_radiusd_base_dir: /usr/local/radiusd
+general_domain: company.com
+#
+general_ldap_attrmap: %{general_radiusd_base_dir}/etc/raddb/ldap.attrmap
+general_sql_attrmap: %{general_base_dir}/conf/sql.attrmap
+general_extra_ldap_attrmap: %{general_base_dir}/conf/extra.ldap-attrmap
+#
+# it can be either ldap or sql
+#
+general_lib_type: ldap
+general_user_edit_attrs_file: %{general_base_dir}/conf/user_edit.attrs
+general_sql_attrs_file: %{general_base_dir}/conf/sql.attrs
+general_default_file: %{general_base_dir}/conf/default.vals
+general_snmpfinger_bin: %{general_base_dir}/bin/snmpfinger
+general_radclient_bin: %{general_radiusd_base_dir}/bin/radclient
+#
+# this information is used from the server check page
+#
+general_test_account_login: test
+general_test_account_password: testpass
+#
+# These are used as default values for the user test page
+#
+general_radius_server: localhost
+general_radius_server_port: 1812
+#
+# sorry, single valued for now. Should become something like
+# password[server-name]: xxxxx
+#
+general_radius_server_secret: XXXXXX
+general_auth_request_file: %{general_base_dir}/conf/auth.request
+#
+# can be one of crypt,md5,clear
+#
+general_encryption_method: crypt
+
+nas1_name: nas1.%{general_domain}
+nas1_model: Cisco 2511 access server
+nas1_ip: 147.122.122.121
+nas1_port_num: 16
+nas1_community: public
+nas2_name: nas2.%{general_domain}
+nas2_model: Cisco 2511 access server
+nas2_ip: 147.122.122.123
+nas2_port_num: 16
+nas2_community: public
+nas3_name: nas3.%{general_domain}
+nas3_model: Cisco 5300 access server
+nas3_ip: 147.122.122.124
+nas3_port_num: 210
+nas3_community: public
+
+ldap_server: ldap.%{general_domain}
+ldap_base: dc=company,dc=com
+ldap_binddn: cn=Directory Manager
+ldap_bindpw: XXXXXXX
+ldap_default_new_entry_suffix: ou=dialup,ou=guests,%{ldap_base}
+ldap_default_dn: uid=default-dialup,%{ldap_base}
+ldap_regular_profile_attr: dialupregularprofile
+
+#
+# can be one of mysql,pg where:
+# mysq: MySQL database (port 3306)
+# pg: PostgreSQL database (port 5432)
+#
+sql_type: mysql
+sql_server: localhost
+sql_port: 3306
+sql_username: dialup_admin
+sql_password: XXXXXX
+sql_database: radius
+sql_accounting_table: radacct
+sql_badusers_table: badusers
+sql_check_table: radcheck
+sql_reply_table: radreply
+sql_user_info_table: userinfo
+#
+# true or false
+#
+sql_use_user_info_table: true
+sql_password_attribute: Crypt-Password
+sql_date_format: Y-m-d
+sql_full_date_format: Y-m-d H:i:s
+#
+# Used in the accounting report generator so that we
+# don't return too many results
+#
+sql_row_limit: 40
+
+counter_default_daily: 14400
+counter_default_weekly: 72000
+counter_default_monthly: none
--- /dev/null
+Service-Type = Framed-User
--- /dev/null
+<?php
+$ARR=file("/usr/local/dialup_admin/conf/admin.conf");
+foreach($ARR as $val) {
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list($key,$v)=split(":[[:space:]]*",$val);
+ if (preg_match("/%\{(.+)\}/",$v,$matches)){
+ $val=$config[$matches[1]];
+ $v=preg_replace("/%\{$matches[1]\}/",$val,$v);
+ }
+ $config["$key"]="$v";
+}
+?>
--- /dev/null
+#
+# Uncomment these lines if you add default values in the users file
+#
+#Simultaneous-Use: 1
+#Framed-IP-Address: 255.255.255.254
+#Framed-IP-Netmask: 255.255.255.255
+#Framed-MTU: 1500
+#Framed-Protocol: PPP
+#Framed-Compression: Van-Jacobson-TCP-IP
+#Session-Timeout: 14400
+#Idle-Timeout: 600
+#Port-Limit: 1
+#Max-Weekly-Session: 72000
+#Max-Daily-Session: 14400
+#Login-Time:
+#Auth-Type: LDAP
--- /dev/null
+checkItem Dialup-Lock-Msg radiuslockmsg
+checkItem User-Password userpassword
+replyItem Reply-Item radiusReplyItem
--- /dev/null
+checkItem Auth-Type Auth-Type
+checkItem Simultaneous-Use Simultaneous-Use
+checkItem Called-Station-Id Called-Station-Id
+checkItem Calling-Station-Id Calling-Station-Id
+checkItem Dialup-Access none
+checkItem Max-Daily-Session none
+checkItem Max-Weekly-Session none
+checkItem Login-Time Login-Time
+
+replyItem Service-Type Service-Type
+replyItem Framed-Protocol Framed-Protocol
+replyItem Framed-IP-Address Framed-IP-Address
+replyItem Framed-IP-Netmask Framed-IP-Netmask
+replyItem Framed-Route Framed-Route
+replyItem Framed-Routing Framed-Routing
+replyItem Filter-Id Filter-Id
+replyItem Framed-MTU Framed-MTU
+replyItem Framed-Compression Framed-Compression
+replyItem Login-IP-Host Login-IP-Host
+replyItem Login-Service Login-Service
+replyItem Login-TCP-Port Login-TCP-Port
+replyItem Callback-Number Callback-Number
+replyItem Callback-Id Callback-Id
+replyItem Framed-IPX-Network Framed-IPX-Network
+replyItem Class Class
+replyItem Session-Timeout Session-Timeout
+replyItem Idle-Timeout Idle-Timeout
+replyItem Termination-Action Termination-Action
+replyItem Login-LAT-Service Login-LAT-Service
+replyItem Login-LAT-Node Login-LAT-Node
+replyItem Login-LAT-Group Login-LAT-Group
+replyItem Framed-AppleTalk-Link Framed-AppleTalk-Link
+replyItem Framed-AppleTalk-Network Framed-AppleTalk-Network
+replyItem Framed-AppleTalk-Zone Framed-AppleTalk-Zone
+replyItem Port-Limit Port-Limit
+replyItem Login-LAT-Port Login-LAT-Port
+replyitem Reply-Message Reply-Message
+replyItem Dialup-Lock-Msg Reply-Message
+replyItem User-Password Password
--- /dev/null
+#
+# Mysql attributes Description Show Use function
+#
+RadAcctId Accounting Id no
+AcctSessionId Session Id no
+AcctUniqueId Unique Id no
+UserName User Name yes
+Realm Realm no
+NASIPAddress NAS IP Address yes
+NASPortId NAS Port yes
+NASPortType NAS Port Type no
+AcctStartTime Login Time yes
+AcctStopTime Logout Time yes
+AcctSessionTime Session Time yes time2str
+AcctAuthentic AcctAuthentic no
+ConnectInfo_start Start Connect Info no
+ConnectInfo_stop Stop Connect Info no
+AcctInputOctets Upload yes bytes2str
+AcctOutputOctets Download yes bytes2str
+CalledStationId CalledStationId no
+CallingStationId Caller Id no
+AcctTerminateCause Terminate Cause no
+ServiceType Service Type no
+FramedProtocol Protocol no
+FramedIPAddress Client IP Address yes
+AcctStartDelay Accounting Start Delay no time2str
+AcctStopDelay Accounting Stop Delay no time2str
--- /dev/null
+#Auth-Type Auth Type
+#Simultaneous-Use <a href="help/simultaneous_use_help.html" target=su_help onclick=window.open("help/simultaneous_use_help.html","su_help","width=560,height=170,toolbar=no,scrollbars=no,resizable=yes") title="Simultaneous Use Help Page"><font color="blue">Simultaneous Use</font></a>
+Framed-Protocol Protocol
+Framed-IP-Address <a href="help/framed_ip_address_help.html" target=fia_help onclick=window.open("help/framed_ip_address_help.html","fia_help","width=560,height=230,toolbar=no,scrollbars=no,resizable=yes") title="Framed-IP-Address Help Page"><font color="blue">IP Address</font></a>
+Framed-IP-Netmask IP Netmask
+#Framed-Route Route
+#Framed-Routing
+#Filter-Id
+Framed-MTU MTU
+Framed-Compression <a href="help/framed_compression_help.html" target=fc_help onclick=window.open("help/framed_compression_help.html","fc_help","width=600,height=210,toolbar=no,scrollbars=no,resizable=yes") title="Framed Compression Help Page"><font color="blue">Compression Used</font></a>
+#Login-IP-Host
+#Login-Service
+#Login-TCP-Port
+#Callback-Number
+#Callback-Id
+#Framed-IPX-Network
+#Class
+Session-Timeout Session Timeout
+Idle-Timeout Idle Timeout
+#Termination-Action
+#Login-LAT-Service
+#Login-LAT-Node
+#Login-LAT-Group
+#Framed-AppleTalk-Link
+#Framed-AppleTalk-Network
+#Framed-AppleTalk-Zone
+Port-Limit <a href="help/port_limit_help.html" target=pl_help onclick=window.open("help/port_limit_help.html","pl_help","width=600,height=170,toolbar=no,scrollbars=no,resizable=yes") title="Port Limit Help Page"><font color="blue">Port Limit</font></a>
+#Login-LAT-Port
+#Dialup-Access <a href="help/dialup_access_help.html" target=da_help onclick=window.open("help/dialup_access_help.html","da_help","width=560,height=200,toolbar=no,scrollbars=no,resizable=yes") title="Dialup Access Help Page"><font color="blue">Dialup Access (use FALSE to lock)</font></a>
+Dialup-Lock-Msg <a href="help/lock_message_help.html" target=lm_help onclick=window.open("help/lock_message_help.html","lm_help","width=600,height=210,toolbar=no,scrollbars=no,resizable=yes") title="Lock Message Help Page"><font color="blue">Lock Message</font></a>
+#Max-Daily-Session Daily Limit (secs)
+#Max-Weekly-Session Weekly Limit (secs)
+#Login-Time User Login Period <a href="help/login_time_help.html" target=lt_help onclick=window.open("help/login_time_help.html","lt_help","width=600,height=370,toolbar=no,scrollbars=no,resizable=yes") title="Login-Time Help Page"><font color="blue">(UUCP Format)</font></a>
--- /dev/null
+<html>
+<head>
+<title>About page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+<table border=0 width=400 cellpadding=0 cellspacing=2></table>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">dialup_admin About Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<br>
+<b>A web based administration interface for the freeradius radius server<br>
+written in PHP4</b>
+<br><br>
+Copyright (C) 2001,2002 Kostas Kalevras
+<br><br><br>
+<pre>
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version
+2 of the License, or (at your option) any later version.
+</pre>
+<br>
+<i>Authors:<br>Kostas Kalevras (kkalev at noc.ntua.gr)<br>
+Basilis Pappas (vpappas at noc.ntua.gr)<br>
+Panagiotis Christias (christia at noc.ntua.gr)<br>
+Thanasis Duitsis (aduitsis at noc.ntua.gr)</i></font>
+</center>
+<br>
+</td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?php
+
+require('../conf/config.php3');
+require('../lib/functions.php3');
+require('../lib/acctshow.php3');
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo <<<EOM
+<html>
+<head>
+<title>Accounting Report Generator</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>Could not include SQL library functions. Aborting</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+$operators=array( '<', '>', '=', '>=', '<=' );
+
+$link = @da_sql_pconnect ($config) or die('cannot connect to sql databse');
+$fields = @da_sql_list_fields($config[sql_accounting_table],$link,$config);
+$no_fields = @da_sql_num_fields($fields,$config);
+
+for($i=0;$i<$no_fields;$i++){
+ $key = @da_sql_field_name($fields,$i,$config);
+ $val = $sql_attrs[$key][desc];
+ $show = $sql_attrs[$key][show];
+ $selected[$key] = ($show == 'yes') ? 'selected' : '';
+ $items[$key] = "$val";
+}
+asort($items);
+
+class Qi {
+ var $name;
+ var $item;
+ var $_item;
+ var $operator;
+ var $type;
+ var $typestr;
+ var $value;
+ function Qi($name,$item,$operator) {
+ $this->name=$name;
+ $this->item=$item;
+ $this->operator=$operator;
+ }
+
+ function show() { global $operators;
+ global $items;
+ $nam = $this->item;
+ echo <<<EOM
+ <tr><td>
+ <i>$items[$nam]</i>
+ <input type=hidden name="item_of_$this->name" value="$this->item">
+ <select name=operator_of_$this->name>
+EOM;
+ foreach($operators as $operator){
+ if($this->operator == $operator)
+ $selected=" selected ";
+ else
+ $selected='';
+ print("<option value=\"$operator\" $selected>$operator</option>\n");
+ }
+ echo <<<EOM
+ </select>
+ <input name="value_of_$this->name" type=text value="$this->value">
+ <input type=hidden name="delete_$this->name" value=0>
+ <input type=submit class=button size=5 value=del onclick="this.form.delete_$this->name.value=1">
+ </td></tr>
+EOM;
+ }
+
+ function get($designator) { global ${"item_of_$designator"};
+ global ${"value_of_$designator"};
+ global ${"operator_of_$designator"};
+ if(${"item_of_$designator"}){
+ $this->value= ${"value_of_$designator"};
+ $this->operator=${"operator_of_$designator"};
+ $this->item=${"item_of_$designator"};
+ }
+ }
+ function query(){
+ global $operators;
+ global $items;
+ return $items[$this->item]." $this->operator '$this->value'";
+ }
+}
+
+?>
+<html>
+<head>
+<title>
+Accounting Report Generator
+</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+
+<?
+if(!$queryflag) {
+ echo <<<EOM
+<form method=post>
+<table border=0 width=740 cellpadding=1 cellspacing=1>
+<tr>
+<td>
+<b>Show the following attributes:</b><br>
+<select name="show_attrs[]" size=5 multiple>
+EOM;
+foreach($items as $key => $val)
+ echo <<<EOM
+<option $selected[$key] value="$key">$val</option>
+EOM;
+
+echo <<<EOM
+</select>
+<br><br>
+<b>Order by:</b><br>
+<select name="order_by">
+EOM;
+
+foreach($items as $key => $val)
+ if ($val == 'UserName')
+ echo <<<EOM
+ <option selected value="$key">$val</option>
+EOM;
+ else
+ echo <<<EOM
+<option value="$key">$val</option>
+EOM;
+
+echo <<<EOM
+</select>
+<br>
+</td>
+<td valign=top>
+<input type=hidden name=add value=0>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr><td>
+<b>Selection criteria:</b>
+</td></tr>
+<tr><td>
+<select name=item_name onchange="this.form.add.value=1;this.form.submit()">
+<option>--Attribute--</option>
+EOM;
+
+foreach($items as $key => $val)
+ print("<option value=\"$key\">$val</option>");
+
+echo <<<EOM
+</select>
+</td></tr>
+EOM;
+
+$number=1;
+$offset=0;
+while (${"item_of_w$number"}) {
+ if(${"delete_w$number"}==1) {$offset=1;$number++;}
+ else {
+ $designator=$number-$offset;
+ ${"w$designator"} = new Qi("w$designator","","");
+ ${"w$designator"}->get("w$number");
+ ${"w$designator"}->show();
+ $number++;
+ }
+ }
+if($add==1) {
+ ${"w$number"} = new Qi("w$number","$item_name","$operators[0]");
+ ${"w$number"}->show();
+ }
+echo <<<EOM
+</table>
+</td>
+<tr>
+<td>
+<input type=hidden name=queryflag value=0>
+<br><input type=submit class=button onclick="this.form.queryflag.value=1">
+</td>
+</tr>
+</table>
+</form>
+</body>
+</html>
+EOM;
+
+}
+
+if ($queryflag == 1){
+$i = 1;
+while (${"item_of_w$i"}){
+ $where .= ($i == 1) ? ' WHERE ' . ${"item_of_w$i"} . ${"operator_of_w$i"} . "'" . ${"value_of_w$i"} . "'" :
+ ' AND ' . ${"item_of_w$i"} . ${"operator_of_w$i"} . "'" . ${"value_of_w$i"} . "'" ;
+ $i++;
+}
+
+$order = ($order_by != '') ? "$order_by" : 'UserName';
+
+foreach ($show_attrs as $val)
+ $query_view .= $val . ',';
+$query_view = ereg_replace(',$','',$query_view);
+$query="SELECT $query_view FROM $config[sql_accounting_table] $where ORDER BY $order LIMIT $config[sql_row_limit]";
+
+echo <<<EOM
+<html>
+<head>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<br>
+<table border=0 width=940 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=740></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Accounting Report Generator</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<p>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ </tr>
+EOM;
+foreach($show_attrs as $val){
+ $desc = $sql_attrs[$val][desc];
+ echo "<th>$desc</th>\n";
+}
+echo "</tr>\n";
+
+ $search = @da_sql_query($link,$config,"$query");
+ if ($search){
+ while( $row = @da_sql_fetch_array($search,$config) ){
+ $num++;
+ echo "<tr align=center>\n";
+ foreach($show_attrs as $val){
+ $info = $row[$val];
+ if ($info == '')
+ $info = '-';
+ $info = $sql_attrs[$val][func]($info);
+ if ($val == 'UserName')
+ $info = "<a href=\"user_admin.php3?login=$info\" title=\"Edit user $info\">$info<a/>";
+ echo <<<EOM
+ <td>$info</td>
+EOM;
+ }
+ echo "</tr>\n";
+ }
+ }
+echo <<<EOM
+ </table>
+ </td></tr>
+ </table>
+</td></tr>
+</table>
+</body>
+</html>
+EOM;
+}
+?>
--- /dev/null
+<html>
+<?php
+require('../conf/config.php3');
+require('../lib/functions.php3');
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo <<<EOM
+<title>Unauthorized Service Usage History for $login</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>Could not include SQL library functions. Aborting</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+$now = time();
+$now_str = ($now_str != '') ? "$now_str" : date($config[sql_date_format],$now + 86400);
+$prev_str = ($prev_str != '') ? "$prev_str" : "0000-00-00 00:00:00";
+$num = 0;
+$pagesize = ($pagesize) ? $pagesize : 10;
+$limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize";
+$selected[$pagesize] = 'selected';
+$login = ($login != '') ? $login : 'anyone';
+$usercheck = ($login == 'anyone') ? "LIKE '%'" : "= '$login'";
+
+echo <<<EOM
+<head>
+<title>Unauthorized Service Usage History for $login</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+EOM;
+
+if ($login != 'anyone'){
+ echo <<<EOM
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+EOM;
+
+include("../html/user_toolbar.html.php3");
+
+print <<<EOM
+</table>
+EOM;
+}
+
+echo <<<EOM
+<br><br>
+<table border=0 width=740 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=55%></td>
+<td bgcolor="black" width=45%>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Unauthorized Service Usage History for $login</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<b>$prev_str</b> up to <b>$now_str</b>
+EOM;
+?>
+
+<p>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ <th>#</th><th>user</th><th>date</th><th>reason</th>
+ </tr>
+
+<?php
+$link = @da_sql_pconnect($config);
+if ($link){
+ $search = @da_sql_query($link,$config,
+ "SELECT * FROM $config[sql_badusers_table]
+ WHERE UserName $usercheck AND Date <= '$now_str'
+ AND Date >= '$prev_str' ORDER BY Date ASC $limit;");
+ if ($search){
+ while( $row = @da_sql_fetch_array($search,$config) ){
+ $num++;
+ $user = "$row[UserName]";
+ $date = "$row[Date]";
+ $reason = "$row[Reason]";
+ if ($reason == '')
+ $reason = '-';
+ echo <<<EOM
+ <tr align=center>
+ <td>$num</td>
+ <td><a href="user_admin.php3?login=$user" title="Edit user $user">$user</a></td>
+ <td>$date</td>
+ <td>$reason</td>
+ </tr>
+EOM;
+ }
+ }
+}
+echo <<<EOM
+ </table>
+<tr><td>
+<hr>
+<tr><td align="center">
+ <form action="badusers.php3" method="get" name="master">
+ <table border=0>
+ <tr><td colspan=5></td>
+ <td rowspan=3 valign="bottom">
+ <small>
+ the <b>from</b> date matches any login after the 00:00 that day,
+ and the <b>to</b> date any login before the 23:59 that day.
+ the default values shown are the <b>current week</b>.
+ </td>
+ </tr>
+ <tr valign="bottom">
+ <td><small><b>user</td><td><small><b>from date</td><td><small><b>to date</td><td><small><b>pagesize</td><td>
+ </td>
+ <tr valign="middle"><td>
+<input type="text" name="login" size="11" value="$login"></td>
+<td><input type="text" name="prev_str" size="11" value="$prev_str"></td>
+<td><input type="text" name="now_str" size="11" value="$now_str"></td>
+<td><select name="pagesize">
+<option $selected[5] value="5" >05
+<option $selected[10] value="10">10
+<option $selected[15] value="15">15
+<option $selected[20] value="20">20
+<option $selected[40] value="40">40
+<option $selected[80] value="80">80
+<option $selected[all] value="all">all
+</select>
+</td>
+EOM;
+?>
+
+<td><input type="submit" class=button value="show"></td></tr>
+</table></td></tr></form>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<link rel="stylesheet" href="style.css">
+<script>
+function myin(a) {
+ eval ( "document.all.menu" + a + ".style.backgroundColor='#cac060';" );
+ eval ( "document.all.a" + a + ".style.color='#ffffff';" );
+}
+function myout(a) {
+ eval ( "document.all.menu" + a + ".style.backgroundColor='#ffffd0';" );
+ eval ( "document.all.a" + a + ".style.color='#000000';" );
+}
+</script>
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<form action="user_admin.php3" method=get target="content">
+<table border=0 width=100 cellpadding=1 cellspacing=1>
+<tr><td align=center>
+<img src="images/logo2.gif" vspace=2>
+</td></tr>
+<tr bgcolor="black" valign=top><td>
+<table border=0 width=100% cellpadding=2 cellspacing=0>
+<tr bgcolor="#907030" align=center valign=top><th>
+<font color="white">Main Menu</font>
+</th></tr>
+</table>
+</td></tr>
+<tr bgcolor="black" valign=top><td>
+<table border=0 width=100% height=100% cellpadding=0 cellspacing=0>
+<tr bgcolor="#ffffd0" valign=top><td>
+ <table border=0 width=100% height=100% cellpadding=4 cellspacing=2>
+ <tr align=left><td id="menu0" onmouseover='myin("0");' onmouseout='myout("0");'>
+ <a id="a0" href="content.html" target="content">Home</a>
+ </td></tr>
+ <tr align=left><td id="menu1" onmouseover='myin("1");' onmouseout='myout("1");'>
+ <a id="a1" href="accounting.php3" target="content" title="Accounting Report Generator">Accounting</a>
+ </td></tr>
+ <tr align=left><td id="menu2" onmouseover='myin("2");' onmouseout='myout("2");'>
+ <a id="a2" href="stats.php3" target="content" title="Dialup Statistics">Statistics</a>
+ </td></tr>
+ <tr align=left><td id="menu3" onmouseover='myin("3");' onmouseout='myout("3");'>
+ <a id="a3" href="user_finger.php3" target="content" title="Show Online Users">Online Users</a>
+ </td></tr>
+ <tr align=left><td id="menu7" onmouseover='myin("7");' onmouseout='myout("7");'>
+ <a id="a7" href="badusers.php3?login=anyone" target="content" title="Show Bad Users">Bad Users</a>
+ </td></tr>
+ <tr align=left><td id="menu4" onmouseover='myin("4");' onmouseout='myout("4");'>
+ <a id="a4" href="user_admin.php3" target="content" title="User Account Administration">Edit User</a>
+ <img align=top src="images/black.gif" vspace=7 hspace=0 width=1 height=1><br>
+ <input type="text" size=11 name="login" target="content">
+ </td></tr>
+ <tr align=left><td id="menu9" onmouseover='myin("9");' onmouseout='myout("9");'>
+ <a id="a9" href="user_new.php3" target="content" title="Create New User">New User</a>
+ </td></tr>
+ <tr align=left><td><img src="images/black.gif" vspace=2 hspace=0 width=80 height=1></td></tr>
+ <tr align=left><td id="menu10" onmouseover='myin("10");' onmouseout='myout("10");'>
+ <a id="a10" href="user_test.php3?login=da_server_test&test_user=1" target="content" title="Check Server Response">Check Server</a>
+ </td></tr>
+ <tr align=left><td><img src="images/black.gif" vspace=2 hspace=0 width=80 height=1></td></tr>
+ <tr align=left><td id="menu5" onmouseover='myin("5");' onmouseout='myout("5");' nowrap>
+ <a id="a5" href="help/help.php3" target="content" title="Show Help">Help</a>
+ </td></tr>
+ <tr align=left><td id="menu6" onmouseover='myin("6");' onmouseout='myout("6");'>
+ <a id="a6" href="about.html" target="content" title="About dialup_admin">About</a>
+ </td></tr>
+ </table>
+</td></tr>
+<tr bgcolor="#ffffd0" align=right valign=bottom><td><img vspace=0 hspace=0 src="images/bg.gif"></td></tr>
+</table>
+</td></tr>
+</table>
+</form>
+</html>
--- /dev/null
+<html>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center><img src="images/title2.gif">
+<br><font size=+1><br>
+<b>A web based administration interface for the freeradius radius server</b>
+<br><br>
+</font></center>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Dialup Access Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Dialup Access Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ If the Dialup-Access attribute is specified, the ldap module
+ checks for its existance in user object. If it exists and is
+ set to FALSE, user is denied remote access. Otherwise, the user
+ is allowed remote access.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Framed Compression Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Framed Compression Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ Framed-Compression indicates a compression protocol to be used for the link.
+ Possible values are:
+</pre>
+ <i>None</i><br>
+ <i>Van-Jacobson-TCP-IP</i><br>
+ <i>IPX-Header-Compression</i><br>
+ <i>Stac-LZS</i><br>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Framed-IP-Address Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Framed-IP-Address Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ Framed-IP-Address can be used to specify the IP address that
+ a dialup user will use. There are two special values:
+</pre>
+<i>255.255.255.255: Assign the user requested IP</i><br>
+<i>255.255.255.254: Assign an IP from the NAS IP pool</i><br>
+<pre>
+ All other values will be assigned as they are to the user dialup
+ interface
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Help page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="../images/title2.gif"></td>
+</tr>
+</table>
+
+<table border=0 width=400 cellpadding=0 cellspacing=2></table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=540></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">dialup_admin help page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<pre>
+
+<b>For now we just include the README file</b><br>
+
+<?php
+readfile('../../README');
+?>
+
+</pre>
+<br>
+</td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Lock Message Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Lock Message Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ The Lock Message will be included as a Reply-Item in all radius server responses for
+ the user. It will also appear in the Usefull User Description in the user admin page.
+ It is intended to be used as a hint to the user and to the administrator for the reason
+ of the user lock out.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Login-Time Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Login-Time Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ Login-Time defines the time span a user may login to the system. The
+ format of a so-called time string is like the format used by UUCP.
+ A time string may be a list of simple time strings separated by "|" or ",".
+
+ Each simple time string must begin with a day definition. That can be just
+ one day, multiple days, or a range of days separated by a hyphen. A
+ day is Mo, Tu, We, Th, Fr, Sa or Su, or Wk for Mo-Fr. "Any" or "Al"
+ means all days.
+
+ After that a range of hours follows in hhmm-hhmm format.
+
+ For example, "Wk2305-0855,Sa,Su2305-1655".
+
+ Radiusd calculates the number of seconds left in the time span, and
+ sets the Session-Timeout to that number of seconds. So if someones
+ Login-Time is "Al0800-1800" and he logs in at 17:30, Session-Timeout
+ is set to 1800 seconds so that he is kicked off at 18:00.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Port Limit Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Port Limit Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ Port-Limit is intended for use in conjuction with Multilink PPP or similar uses.
+ It defines the maximum number of channels the user is allowed to open during
+ a multilink dialup session.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Simultaneous Use Help Page</title>
+<link rel="stylesheet" href="../style.css">
+</head>
+<body bgcolor="#80a040" background="../images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=400>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th><font color="white">Simultaneous Use Help Page</font> </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<br>
+<center>
+<pre>
+ This attribute defines the maximum number of concurrent logins
+ for a user. It is independent from the number of ports the user
+ is allowed to open in a multilink session.
+</pre>
+</td></tr>
+<tr><td align=center>
+<a href="javascript:window.close();"><b>Close Window</b></a>
+</td></tr>
+</center>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>
+dialup administration</title>
+</head>
+ <frameset cols="122,*" border="0" frameborder="0" framespacing="0">
+ <frame name="buttons" src="buttons.html" marginwidth="8"
+ marginheight="8" noresize >
+ <frame name="content" src="content.html" marginwidth="8"
+ marginheight="8" >
+ </frameset>
+ <noframes>
+ <body bgcolor=yellow>
+ <p><font color="darkblue"><h1>this page can only be seen by a frames capable browser. sorry...</h1></font>
+ </p></body>
+ </noframes>
+</html>
--- /dev/null
+<form name="master" action="user_admin.php3#pass" method="post">
+<input type=hidden name=login value=<?php echo $login ?>>
+<input type=hidden name=action value=checkpass>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Check Password</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr><td align=center bgcolor="#d0ddb0">Password</td><td><input type="password" name="passwd" value=""><input type="submit" class=button value="check"></td></tr>
+ </table>
+ </table>
+</table>
--- /dev/null
+<html>
+<head>
+<title>account analysis</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+
+<?php
+require('../conf/config.php3');
+require('../lib/functions.php3');
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo <<<EOM
+<b>Could not include SQL library functions. Aborting</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+
+$date = strftime('%A, %e %B %Y, %T %Z');
+$now = time();
+if ($before == '')
+ $before = date($config[sql_date_format], $now + 86400);
+$after = ($after != '') ? "$after" : date($config[sql_date_format], $now - 604800 );
+
+$after_time = date2time($after);
+$before_time = date2time($before);
+$days[0] = $after;
+$counter = $after_time + 86400;
+$i = 1;
+while($counter < $before_time){
+ $days[$i++] = date($config[sql_date_format],$counter);
+ $counter += 86400;
+}
+$days[$i] = $before;
+$num_days = $i;
+
+$column1 = ($column1 != '') ? "$column1" : 'sessions';
+$column2 = ($column2 != '') ? "$column2" : 'usage';
+$column3 = ($column3 != '') ? "$column3" : 'download';
+$column[1] = "$column1";
+$column[2] = "$column2";
+$column[3] = "$column3";
+$selected1["$column1"] = 'selected';
+$selected2["$column2"] = 'selected';
+$selected3["$column3"] = 'selected';
+
+$message['sessions'] = 'sessions';
+$message['usage'] = 'total usage time';
+$message['upload'] = 'uploads';
+$message['download'] = 'downloads';
+$sql_val['usage'] = 'AcctSessionTime';
+$sql_val['upload'] = 'AcctInputOctets';
+$sql_val['download'] = 'AcctOutputOctets';
+$fun['sessions'] = nothing;
+$fun['usage'] = time2strclock;
+$fun['upload'] = bytes2str;
+$fun['download'] = bytes2str;
+$sql_val['user'] = ($login == '') ? "WHERE UserName LIKE '%'" : "WHERE UserName = '$login'";
+for ($j = 1; $j <= 3; $j++){
+ $tmp = "{$sql_val[$column[$j]]}";
+ $res[$j] = ($tmp == "") ? 'COUNT(RadAcctId)' : "sum($tmp)";
+}
+$i = 1;
+$servers[all] = 'all';
+while(1){
+ $nas = 'nas' . $i;
+ $ip = $nas . '_ip';
+ $name = $nas . '_name';
+ if ($config[$ip] == '')
+ break;
+ $name = $config[$name];
+ $servers[$name] = $config[$ip];
+ $i++;
+}
+if ($server != 'all')
+ $s = "AND NASIPAddress = '$server'";
+
+$link = @da_sql_pconnect($config);
+if ($link){
+ for ($i = $num_days;$i > -1; $i--){
+ $day = "$days[$i]";
+ $search = @da_sql_query($link,$config,
+ "SELECT $res[1],$res[2],$res[3] FROM $config[sql_accounting_table]
+ $sql_val[user] AND AcctStopTime LIKE '$day%' $s;");
+ if ($search){
+ $row = @da_sql_fetch_array($search,$config);
+ $data[$day][1] = $row["$res[1]"];
+ $data[sum][1] += $row["$res[1]"];
+ $num[1] = ($data[$day][1]) ? $num[1] + 1 : $num[1];
+ $data[$day][2] = $row["$res[2]"];
+ $data[sum][2] += $row["$res[2]"];
+ $num[2] = ($data[$day][2]) ? $num[2] + 1 : $num[2];
+ $data[$day][3] = $row["$res[3]"];
+ $data[sum][3] += $row["$res[3]"];
+ $num[3] = ($data[$day][3]) ? $num[3] + 1 : $num[3];
+ }
+ }
+}
+
+$num[1] = ($num[1]) ? $num[1] : 1;
+$num[2] = ($num[2]) ? $num[2] : 1;
+$num[3] = ($num[3]) ? $num[3] : 1;
+
+$data['avg'][1] = ceil($data['sum'][1] / $num[1]);
+$data['avg'][2] = ceil($data['sum'][2] / $num[2]);
+$data['avg'][3] = ceil($data['sum'][3] / $num[3]);
+
+$data['avg'][1] = $fun[$column[1]]($data['avg'][1]);
+$data['avg'][2] = $fun[$column[2]]($data['avg'][2]);
+$data['avg'][3] = $fun[$column[3]]($data['avg'][3]);
+
+$data['sum'][1] = $fun[$column[1]]($data['sum'][1]);
+$data['sum'][2] = $fun[$column[2]]($data['sum'][2]);
+$data['sum'][3] = $fun[$column[3]]($data['sum'][3]);
+
+for ($i = 0; $i <= $num_days; $i++){
+ $day = "$days[$i]";
+ $max[1] = ($max[1] > $data[$day][1] ) ? $max[1] : $data[$day][1];
+ $max[2] = ($max[2] > $data[$day][2] ) ? $max[2] : $data[$day][2];
+ $max[3] = ($max[3] > $data[$day][3] ) ? $max[3] : $data[$day][3];
+
+}
+for ($i = 0; $i <= $num_days; $i++){
+ $day = "$days[$i]";
+ for ($j = 1; $j <= 3; $j++){
+ $tmp = $data[$day][$j];
+ if (!$max[$j])
+ $p = $w = $c = 0;
+ else{
+ $p = floor(100 * ($tmp / $max[$j]));
+ $w = floor(70 * ($tmp / $max[$j]));
+ $c = hexdec('f0e9e2') - (258 * $p);
+ $c = dechex($c);
+ }
+ if (!$w)
+ $w++;
+ $perc[$day][$j] = $p . "%";
+ $width[$day][$j] = $w;
+ $color[$day][$j] = $c;
+ }
+
+ $data[$day][1] = $fun[$column[1]]($data[$day][1]);
+ $data[$day][2] = $fun[$column[2]]($data[$day][2]);
+ $data[$day][3] = $fun[$column[3]]($data[$day][3]);
+}
+
+$data[max][1] = $fun[$column[1]]($max[1]);
+$data[max][2] = $fun[$column[2]]($max[2]);
+$data[max][3] = $fun[$column[3]]($max[3]);
+
+require('../html/stats.html.php3');
+?>
--- /dev/null
+td {font-family:verdana,sans-serif;text-decoration:none;font-size:11px}
+th {font-family:verdana,sans-serif;text-decoration:none;font-size:11px}
+A {FONT-FAMILY: verdana,sans-serif; FONT-SIZE: 11px; TEXT-DECORATION: none}
+H1 {FONT-FAMILY: lucida,sans-serif; FONT-SIZE: 24px; TEXT-DECORATION: none}
+INPUT{
+ BACKGROUND-COLOR: #FFFFFF;
+ BORDER-BOTTOM: #3333CC 1px solid;
+ BORDER-LEFT: #3333CC 1px solid;
+ BORDER-RIGHT: #3333CC 1px solid;
+ BORDER-TOP: #3333CC 1px solid;
+ COLOR: #000000;
+ FONT-FAMILY: Verdana
+}
+INPUT.button{
+ BACKGROUND-COLOR: #999999;
+ BORDER-BOTTOM: #3333CC 1px solid;
+ BORDER-LEFT: #3333CC 1px solid;
+ BORDER-RIGHT: #3333CC 1px solid;
+ BORDER-TOP: #3333CC 1px solid;
+ COLOR: #000000;
+ FONT-FAMILY: Verdana
+}
+body
+{
+ scrollbar-track-color:#b0bd90;
+ scrollbar-arrow-color:#000000;
+ scrollbar-face-color:#d0ddb0;
+ scrollbar-shadow-color:#909d70;
+ scrollbar-highlight-color:#fffff0;
+ scrollbar-3dlight-color:#000000;
+ scrollbar-darkshadow-color:#000000;
+}
--- /dev/null
+<html>
+<?php
+require('../conf/config.php3');
+require('../lib/functions.php3');
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo <<<EOM
+<title>subscription analysis for $login ($cn)</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>Could not include SQL library functions. Aborting</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+$now = time();
+$now_str = ($now_str != '') ? "$now_str" : date($config[sql_date_format],$now + 86400);
+$prev_str = ($prev_str != '') ? "$prev_str" : date($config[sql_date_format], $now - 604800 );
+$num = 0;
+$pagesize = ($pagesize) ? $pagesize : 10;
+$limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize";
+$selected[$pagesize] = 'selected';
+
+echo <<<EOM
+<head>
+<title>subscription analysis for $login ($cn)</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+EOM;
+
+include("../html/user_toolbar.html.php3");
+
+print <<<EOM
+</table>
+<br>
+<table border=0 width=840 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=65%></td>
+<td bgcolor="black" width=35%>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Subscription Analysis for $login</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<b>$prev_str</b> up to <b>$now_str</b>
+EOM;
+?>
+
+<p>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ <th>#</th><th>type</th><th>logged in</th><th>session time</th><th>ip address</th>
+ <th>upload</th><th>download</th><th>server</th><th>terminate cause</th><th>callerid</th>
+ </tr>
+
+<?php
+$link = @da_sql_pconnect($config);
+if ($link){
+ $search = @da_sql_query($link,$config,
+ "SELECT * FROM $config[sql_accounting_table]
+ WHERE UserName = '$login' AND AcctStartTime <= '$now_str'
+ AND AcctStartTime >= '$prev_str' ORDER BY AcctStartTime ASC $limit;");
+ if ($search){
+ while( $row = @da_sql_fetch_array($search,$config) ){
+ $tr_color='white';
+ $num++;
+ $acct_type = "$row[FramedProtocol]/$row[NASPortType]";
+ $acct_logedin = $row[AcctStartTime];
+ $acct_sessiontime = $row[AcctSessionTime];
+ $acct_sessiontime_sum += $acct_sessiontime;
+ $acct_sessiontime = time2str($acct_sessiontime);
+ $acct_ip = $row[FramedIPAddress];
+ if ($acct_ip == '')
+ $acct_ip = '-';
+ $acct_upload = $row[AcctInputOctets];
+ $acct_upload_sum += $acct_upload;
+ $acct_upload = bytes2str($acct_upload);
+ $acct_download = $row[AcctOutputOctets];
+ $acct_download_sum += $acct_download;
+ $acct_download = bytes2str($acct_download);
+ $acct_server = $da_name_cache[$row[NASIPAddress]];
+ if (!isset($acct_server)){
+ $acct_server = gethostbyaddr($row[NASIPAddress]);
+ $da_name_cache[$row[NASIPAddress]] = $acct_server;
+ }
+ $acct_server = "$acct_server:$row[NASPortId]";
+ $acct_terminate_cause = "$row[AcctTerminateCause]";
+ if ($acct_terminate_cause == '')
+ $acct_terminate_cause = '-';
+ if (ereg('Login-Incorrect',$acct_terminate_cause) ||
+ ereg('Multiple-Logins', $acct_terminate_cause) || ereg('Invalid-User',$acct_terminate_cause))
+ $tr_color='#ffe8e0';
+ $acct_callerid = "$row[CallingStationId]";
+ if ($acct_callerid == '')
+ $acct_callerid = '-';
+ echo <<<EOM
+ <tr align=center bgcolor="$tr_color">
+ <td>$num</td>
+ <td>$acct_type</td>
+ <td>$acct_logedin</td>
+ <td>$acct_sessiontime</td>
+ <td>$acct_ip</td>
+ <td>$acct_upload</td>
+ <td>$acct_download</td>
+ <td>$acct_server</td>
+ <td>$acct_terminate_cause</td>
+ <td>$acct_callerid</td>
+ </tr>
+EOM;
+ }
+ $acct_sessiontime_sum = time2str($acct_sessiontime_sum);
+ $acct_upload_sum = bytes2str($acct_upload_sum);
+ $acct_download_sum = bytes2str($acct_download_sum);
+ }
+}
+echo <<<EOM
+ <tr bgcolor="lightyellow">
+ <td colspan=3 align="right">Page Total</td>
+ <td align="center"><b>$acct_sessiontime_sum</td>
+ <td> </td>
+ <td align="right" nowrap><b>$acct_upload_sum</td>
+ <td align="right" nowrap><b>$acct_download_sum</td>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ </table>
+<tr><td>
+<hr>
+<tr><td align="center">
+ <form action="user_accounting.php3" method="get" name="master">
+ <table border=0>
+ <tr><td colspan=5></td>
+ <td rowspan=3 valign="bottom">
+ <small>
+ the <b>from</b> date matches any login after the 00:00 that day,
+ and the <b>to</b> date any login before the 23:59 that day.
+ the default values shown are the <b>current week</b>.
+ </td>
+ </tr>
+ <tr valign="bottom">
+ <td><small><b>user</td><td><small><b>from date</td><td><small><b>to date</td><td><small><b>pagesize</td><td>
+ </td>
+ <tr valign="middle"><td>
+<input type="text" name="login" size="11" value="$login"></td>
+<td><input type="text" name="prev_str" size="11" value="$prev_str"></td>
+<td><input type="text" name="now_str" size="11" value="$now_str"></td>
+<td><select name="pagesize">
+<option $selected[5] value="5" >05
+<option $selected[10] value="10">10
+<option $selected[15] value="15">15
+<option $selected[20] value="20">20
+<option $selected[40] value="40">40
+<option $selected[80] value="80">80
+<option $selected[all] value="all">all
+</select>
+</td>
+EOM;
+?>
+
+<td><input type="submit" class=button value="show"></td></tr>
+</table></td></tr></form>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<?php
+require('../conf/config.php3');
+require('../lib/functions.php3');
+require('../lib/defaults.php3');
+
+$date = strftime('%A, %e %B %Y, %T %Z');
+
+if (is_file("../lib/$config[general_lib_type]/user_info.php3")){
+ include("../lib/$config[general_lib_type]/user_info.php3");
+ $user_info = 1;
+ if ($user_exists == 'no'){
+ echo <<<EOM
+<title>user information page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<form action="user_admin.php3" method=get>
+<b>User Name </b>
+<input type="text" size=10 name="login" value="$login">
+<b> does not exist</b><br>
+<input type=submit class=button value="Show User">
+</body>
+</html>
+EOM;
+ exit();
+ }
+}
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo <<<EOM
+<title>user information page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>Could not include SQL library functions. Aborting</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+$weekly_limit = ($item_vals['Max-Weekly-Session'][0] != '') ? $item_vals['Max-Weekly-Session'][0] : $default_vals['Max-Weekly-Session'];
+$weekly_limit = ($weekly_limit) ? $weekly_limit : $config[counter_default_weekly];
+$daily_limit = ($item_vals['Max-Daily-Session'][0] != '') ? $item_vals['Max-Daily-Session'][0] : $default_vals['Max-Daily-Session'];
+$daily_limit = ($daily_limit) ? $daily_limit : $config[counter_default_daily];
+$session_limit = ($item_vals['Session-Timeout'][0] != '') ? $item_vals['Session-Timeout'][0] : $default_vals['Session-Timeout'];
+$session_limit = ($session_limit) ? $session_limit : 'none';
+
+$now = time();
+$week = $now - 604800;
+$now_str = date("$config[sql_date_format]",$now + 86400);
+$week_str = date("$config[sql_date_format]",$week);
+$day = date('w');
+$week_start = date($config[sql_date_format],$now - ($day)*86400);
+$today = $day;
+$now_tmp = $now;
+for ($i = $day; $i >-1; $i--){
+ $days[$i] = date($config[sql_date_format],$now_tmp);
+ $now_tmp -= 86400;
+}
+$day++;
+//$now -= ($day * 86400);
+$now -= 604800;
+$now += 86400;
+for ($i = $day; $i <= 6; $i++){
+ $days[$i] = date($config[sql_date_format],$now);
+// $now -= 86400;
+ $now += 86400;
+}
+
+$daily_used = $weekly_used = $monthly_used = $lastlog_session_time = '-';
+$extra_msg = '';
+$used = array('-','-','-','-','-','-','-');
+
+$link = @da_sql_pconnect($config);
+if ($link){
+ $search = @da_sql_query($link,$config,
+ "SELECT sum(AcctSessionTime),sum(AcctInputOctets),sum(AcctOutputOctets),
+ avg(AcctSessionTime),avg(AcctInputOctets),avg(AcctOutputOctets),COUNT(*) FROM
+ $config[sql_accounting_table] WHERE UserName = '$login'
+ AND AcctStopTime >= '$week_str' AND AcctStopTime <= '$now_str';");
+ if ($search){
+ $row = @da_sql_fetch_array($search,$config);
+ $tot_time = time2str($row['sum(AcctSessionTime)']);
+ $tot_input = bytes2str($row['sum(AcctInputOctets)']);
+ $tot_output = bytes2str($row['sum(AcctOutputOctets)']);
+ $avg_time = time2str($row['avg(AcctSessionTime)']);
+ $avg_input = bytes2str($row['avg(AcctInputOctets)']);
+ $avg_output = bytes2str($row['avg(AcctOutputOctets)']);
+ $tot_conns = $row['COUNT(*)'];
+ }
+ for($i = 0; $i <=6; $i++){
+ if ($days[$i] == '')
+ continue;
+ $search = @da_sql_query($link,$config,
+ "SELECT sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE
+ UserName = '$login' AND AcctStopTime LIKE '$days[$i]%';");
+ if ($search){
+ $row = @da_sql_fetch_array($search,$config);
+ $used[$i] = $row['sum(AcctSessionTime)'];
+ if ($used[$i] > $daily_limit)
+ $used[$i] = "<font color=red>" . time2str($used[$i]) . "</font>";
+ else
+ $used[$i] = time2str($used[$i]);
+ if ($today == $i){
+ $daily_used = $row['sum(AcctSessionTime)'];
+ $remaining = $daily_limit - $daily_used;
+ if ($remaining <=0)
+ $remaining = 0;
+ $log_color = ($remaining) ? 'green' : 'red';
+ if (!$remaining)
+ $extra_msg = '(Out of daily quota)';
+ $daily_used = time2str($daily_used);
+ if (!$remaining)
+ $daily_used = "<font color=red>$daily_used</font>";
+ }
+ }
+ }
+ $search = @da_sql_query($link,$config,
+ "SELECT sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE
+ UserName = '$login' AND AcctStopTime >= '$week_start' AND
+ AcctStopTime <= '$now_str';");
+ if ($search){
+ $row = @da_sql_fetch_array($search,$config);
+ $weekly_used = $row['sum(AcctSessionTime)'];
+ $tmp = $weekly_limit - $weekly_used;
+ if ($tmp <=0){
+ $tmp = 0;
+ $extra_msg .= '(Out of weekly quota)';
+ }
+ if ($remaining > $tmp)
+ $remaining = $tmp;
+ $log_color = ($remaining) ? 'green' : 'red';
+ $weekly_used = time2str($weekly_used);
+ if (!$tmp)
+ $weekly_used = "<font color=red>$weekly_used</font>";
+ }
+ $search = @da_sql_query($link,$config,
+ "SELECT * FROM $config[sql_accounting_table]
+ WHERE UserName = '$login' AND AcctStopTime = '0'
+ ORDER BY AcctStartTime DESC LIMIT 1;");
+ if ($search){
+ if (@da_sql_num_rows($search,$config)){
+ $logged_now = 1;
+ $row = @da_sql_fetch_array($search,$config);
+ $lastlog_time = $row['AcctStartTime'];
+ $lastlog_server_ip = $row['NASIPAddress'];
+ $lastlog_server_port = $row['NASPortId'];
+ $lastlog_session_time = date2timediv($lastlog_time);
+ $remaining = $daily_limit - $lastlog_session_time;
+ if ($remaining < 0)
+ $remaining = 0;
+ $log_color = ($remaining) ? 'green' : 'red';
+ $lastlog_session_time_jvs = 1000 * $lastlog_session_time;
+ $lastlog_session_time = time2strclock($lastlog_session_time);
+ $lastlog_client_ip = $row['FramedIPAddress'];
+ $lastlog_server_name = gethostbyaddr($lastlog_server_ip);
+ $lastlog_client_name = gethostbyaddr($lastlog_client_ip);
+ $lastlog_input = $row['AcctInputOctets'];
+ if ($lastlog_input)
+ $lastlog_input = bytes2str($lastlog_input);
+ else
+ $lastlog_input = 'not available';
+ $lastlog_output = $row['AcctOutputOctets'];
+ if ($lastlog_output)
+ $lastlog_input = bytes2str($lastlog_output);
+ else
+ $lastlog_output = 'not available';
+ }
+ }
+ if (! $logged_now){
+ $search = @da_sql_query($link,$config,
+ "SELECT * FROM $config[sql_accounting_table]
+ WHERE UserName = '$login' AND AcctSessionTime != '0'
+ ORDER BY AcctStopTime DESC LIMIT 1;");
+ if ($search){
+ if (@da_sql_num_rows($search,$config)){
+ $row = @da_sql_fetch_array($search,$config);
+ $lastlog_time = $row['AcctStartTime'];
+ $lastlog_server_ip = $row['NASIPAddress'];
+ $lastlog_server_port = $row['NASPortId'];
+ $lastlog_session_time = time2str($row['AcctSessionTime']);
+ $lastlog_client_ip = $row['FramedIPAddress'];
+ $lastlog_server_name = gethostbyaddr($lastlog_server_ip);
+ $lastlog_client_name = gethostbyaddr($lastlog_client_ip);
+ $lastlog_input = $row['AcctInputOctets'];
+ $lastlog_input = bytes2str($lastlog_input);
+ $lastlog_output = $row['AcctOutputOctets'];
+ $lastlog_output = bytes2str($lastlog_output);
+ }
+ else
+ $not_known = 1;
+ }
+ }
+}
+
+$monthly_limit = time2str($monthly_limit);
+$weekly_limit = time2str($weekly_limit);
+$daily_limit = time2str($daily_limit);
+$session_limit = time2str($session_limit);
+$remaining = time2str($remaining);
+
+if ($item_vals['Dialup-Access'][0] == 'FALSE')
+ $msg =<<<EON
+<font color=red><b> The user account is locked </b></font>
+EON;
+else
+ $msg =<<<EON
+user can login for <font color="$log_color"> <b>$remaining $extra_msg</font>
+EON;
+$lock_msg = $item_vals['Dialup-Lock-Msg'][0];
+if ($lock_msg != '')
+ $descr =<<<EON
+<font color=red><b>$lock_msg </b</font>
+EON;
+else
+ $descr = '-';
+
+require('../html/user_admin.html.php3');
--- /dev/null
+<?php
+require('../conf/config.php3');
+if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+
+echo <<<EOM
+<html>
+<head>
+<title>delete user $login ($cn)</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+EOM;
+
+include("../html/user_toolbar.html.php3");
+
+print <<<EOM
+</table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">User $login Deletion</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+EOM;
+
+if ($delete_user == 1){
+ if (is_file("../lib/$config[general_lib_type]/delete_user.php3"))
+ include("../lib/$config[general_lib_type]/delete_user.php3");
+ echo <<<EOM
+</td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
+EOM;
+ exit();
+}
+?>
+ <form method=post>
+ <input type=hidden name=login value=<?php print $login ?>>
+ <input type=hidden name=delete_user value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<tr>
+<td align=center>
+Are you sure you want to delete user <?php echo $login; ?> ?
+</td>
+</tr>
+ </table>
+<br>
+<input type=submit class=button value="Yes Delete" OnClick="this.form.delete_user.value=1">
+</form>
+</td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?php
+require('../conf/config.php3');
+require('../lib/attrshow.php3');
+require('../lib/defaults.php3');
+if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+
+echo <<<EOM
+<html>
+<head>
+<title>subscription configuration for $login ($cn)</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+EOM;
+
+include("../html/user_toolbar.html.php3");
+
+print <<<EOM
+</table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">User Preferences for $login ($cn)</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+EOM;
+
+if ($change == 1){
+ if (is_file("../lib/$config[general_lib_type]/change_attrs.php3"))
+ include("../lib/$config[general_lib_type]/change_attrs.php3");
+ if ($passwd != '' && is_file("../lib/$config[general_lib_type]/change_passwd.php3"))
+ include("../lib/$config[general_lib_type]/change_passwd.php3");
+ if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+}
+else if ($badusers == 1){
+ if (is_file("../lib/add_badusers.php3"))
+ include("../lib/add_badusers.php3");
+}
+
+?>
+ <form method=post>
+ <input type=hidden name=login value=<?php print $login ?>>
+ <input type=hidden name=change value="0">
+ <input type=hidden name=add value="0">
+ <input type=hidden name=badusers value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+User Password (changes only)
+</td>
+<td>
+<input type=password name=passwd value="" size=40>
+</td>
+</tr>
+<?php
+ foreach($show_attrs as $key => $desc){
+ $name = $attrmap["$key"];
+ if ($name == 'none')
+ continue;
+ unset($vals);
+ if (count($item_vals["$key"])){
+ for($i=0;$i<$item_vals["$key"][count];$i++)
+ $vals[] = $item_vals["$key"][$i];
+ }
+ else
+ $vals[] = $default_vals["$key"];
+ if ($add && $name == $add_attr)
+ array_push($vals, $default_vals["$key"]);
+
+ $i = 0;
+ foreach($vals as $val){
+ $name1 = $name . $i;
+ $i++;
+ print <<<EOM
+<tr>
+<td align=right bgcolor="#d0ddb0">
+$desc
+</td>
+<td>
+<input type=text name="$name1" value="$val" size=40>
+</td>
+</tr>
+EOM;
+ }
+ }
+?>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Add Attribute
+</td>
+<td>
+<select name="add_attr" OnChange="this.form.add.value=1;this.form.submit()">
+<?php
+foreach ($show_attrs as $key => $desc){
+ $name = $attrmap["$key"];
+ print <<<EOM
+<option value="$name">$desc
+EOM;
+}
+?>
+</select>
+</td>
+</tr>
+ </table>
+<br>
+<input type=submit class=button value=Change OnClick="this.form.change.value=1">
+<br><br>
+<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
+</form>
+ </td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>
+User Finger Facility
+</title>
+<link rel="stylesheet" href="style.css">
+</head>
+
+<?php
+require('../conf/config.php3');
+require('../lib/functions.php3');
+require("../lib/$config[general_lib_type]/functions.php3");
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo <<<EOM
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>Could not include SQL library functions. Aborting</b>
+</body>
+</html>
+EOM;
+ exit();
+}
+
+$date = strftime('%A, %e %B %Y, %T %Z');
+
+$link = @da_sql_pconnect($config);
+$link2 = connect2db($config);
+if ($link){
+ $h = 21;
+ while(1){
+ $i++;
+ $num = 0;
+ $nas = 'nas' . $i;
+ $name = $nas . '_name';
+ $model = $nas . '_model';
+ $community = $nas . '_community';
+ $ip = $nas . '_ip';
+ $portnum = $nas . '_port_num';
+
+ if ($config[$name] == ''){
+ $i--;
+ break;
+ }
+ $name_data = $config[$ip];
+ $community_data = $config[$community];
+ $server_name[$i] = $config[$name];
+ $server_model[$i] = $config[$model];
+ $users=exec("$config[general_snmpfinger_bin] $name_data $community_data");
+ if (strlen($users))
+ $extra = "AND UserName IN ($users)";
+ else
+ $extra = "";
+ $search = @da_sql_query($link,$config,
+ "SELECT DISTINCT UserName,AcctStartTime,FramedIPAddress,CallingStationId
+ FROM $config[sql_accounting_table] WHERE
+ AcctStopTime = '0' AND NASIPAddress = '$name_data' $extra
+ GROUP BY UserName ORDER BY AcctStartTime;");
+ if ($search){
+ while($row = @da_sql_fetch_array($search,$config)){
+ $num++;
+ $h += 21;
+ $user = $row['UserName'];
+ $finger_info[$i][$num]['ip'] = $row['FramedIPAddress'];
+ if ($finger_info[$i][$num]['ip'] == '')
+ $finger_info[$i][$num]['ip'] = '-';
+ $session_time = $row['AcctStartTime'];
+ $session_time = date2timediv($session_time);
+ $finger_info[$i][$num]['session_time'] = time2strclock($session_time);
+ $finger_info[$i][$num]['user'] = $user;
+ $finger_info[$i][$num]['callerid'] = $row['CallingStationId'];
+ if ($finger_info[$i][$num]['callerid'] == '')
+ $finger_info[$i][$num]['callerid'] = '-';
+ if ($user_info["$user"] == ''){
+ $user_info["$user"] = get_user_info($link2,$user,$config);
+ if ($user_info["$user"] == '' || $user_info["$user"] == ' ')
+ $user_info["$user"] = 'Unknown User';
+ }
+ }
+ $height[$i] = $h;
+ }
+ $server_loggedin[$i] = $num;
+ $server_rem[$i] = ($config[$portnum]) ? ($config[$portnum] - $num) : 'unknown';
+ }
+}
+?>
+
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Online Users</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<?php
+echo <<<EOM
+ <b>$date</b>
+EOM;
+ for($j = 1; $j <= $i; $j++){
+ echo <<<EOM
+<p>
+ <table width=100% cellpadding=0 height=30><tr>
+ <th align=left>$server_name[$j]<br><font color="green">$server_model[$j]</font></th><th align=right><font color="red">$server_loggedin[$j] users connected</font></th><th><font color="green">$server_rem[$j] free lines</font></th>
+ </tr>
+ </table>
+ <div height="$height[$j]" style="height:$height[$j];overflow:auto;">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ <th>#</th><th>user</th><th>ip address</th><th>caller id</th><th>name</th><th>duration</th>
+ </tr>
+EOM;
+ for( $k = 1; $k <= $server_loggedin[$j]; $k++){
+ $user = $finger_info[$j][$k][user];
+ $time = $finger_info[$j][$k][session_time];
+ $ip = $finger_info[$j][$k][ip];
+ $cid = $finger_info[$j][$k][callerid];
+ $inf = $user_info[$user];
+ echo <<<EOM
+ <tr align=center>
+ <td>$k</td><td><a href="user_admin.php3?login=$user" title="Edit User $user">$user</a></td><td>$ip</td><td>$cid</td><td>$inf</td><td>$time</td>
+ </tr>
+EOM;
+ }
+
+ echo <<<EOM
+ </table>
+ </div>
+EOM;
+}
+?>
+ </td></tr>
+ </table>
+</td></tr>
+</table>
+<p>
+</html>
--- /dev/null
+<?php
+if ($show == 1){
+ header("Location: user_admin.php3?login=$login");
+ exit;
+}
+require('../conf/config.php3');
+require('../lib/attrshow.php3');
+require('../lib/defaults.php3');
+?>
+
+<html>
+<head>
+<title>New user creation page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">User Preferences for new user</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+
+<?php
+if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+if ($create == 1){
+ if ($user_exists != "no"){
+ echo <<<EOM
+<b>The username <i>$login</i> already exists in the user database</b>
+EOM;
+ }
+ else{
+ if (is_file("../lib/$config[general_lib_type]/create_user.php3"))
+ include("../lib/$config[general_lib_type]/create_user.php3");
+ }
+}
+?>
+ <form method=post>
+ <input type=hidden name=create value="0">
+ <input type=hidden name=show value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<?php
+ echo <<<EOM
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Username
+ </td><td>
+ <input type=text name="login" value="$login" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Password
+ </td><td>
+ <input type=text name="passwd" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Name (First Name Surname)
+ </td><td>
+ <input type=text name="cn" value="$cn" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Mail
+ </td><td>
+ <input type=text name="mail" value="$mail" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Departement
+ </td><td>
+ <input type=text name="ou" value="$ou" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Home Phone
+ </td><td>
+ <input type=text name="homephone" value="$homephone" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Work Phone
+ </td><td>
+ <input type=text name="telephonenumber" value="$telephonenumber" size=35>
+ </td>
+ </tr>
+ <tr>
+ <td align=right bgcolor="#d0ddb0">
+ Mobile Phone
+ </td><td>
+ <input type=text name="mobile" value="$mobile" size=35>
+ </td>
+ </tr>
+EOM;
+ foreach($show_attrs as $key => $desc){
+ $name = $attrmap["$key"];
+ if ($name == 'none')
+ continue;
+ $val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"];
+ print <<<EOM
+<tr>
+<td align=right bgcolor="#d0ddb0">
+$desc
+</td>
+<td>
+<input type=text name="$name" value="$val" size=35>
+</td>
+</tr>
+EOM;
+ }
+?>
+ </table>
+<br>
+<input type=submit class=button value="Create" OnClick="this.form.create.value=1">
+<br><br>
+<input type=submit class=button value="Show User" OnClick="this.form.show.value=1">
+</form>
+ </td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?php
+require('../conf/config.php3');
+require('../lib/functions.php3');
+require('../lib/defaults.php3');
+if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else
+ exit();
+
+$vars = array( 'Dialup-Access' => 'TRUE','Dialup-Lock-Msg' => '-',
+ 'Max-Weekly-Session' => 0,'Max-Daily-Session' => 0);
+foreach($vars as $key => $val){
+ $val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"];
+ $vars["$key"]=$val;
+}
+$vars['Dialup-Access'] = ($vars['Dialup-Access'] == 'FALSE') ? 'inactive' : 'active';
+$vars['Max-Daily-Session'] = time2strclock($vars['Max-Daily-Session']);
+$vars['Max-Weekly-Session'] = time2strclock($vars['Max-Weekly-Session']);
+
+$now = time();
+$week = $now - date('w') * 86400;
+$now_str = date("$config[sql_date_format]",$now + 86400);
+$week_str = date("$config[sql_date_format]",$week);
+$today = date("$config[sql_date_format]",$now);
+
+$link = @da_sql_pconnect($config);
+if ($link){
+ $search = @da_sql_query($link,$config,
+ "SELECT COUNT(*), sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE
+ UserName = '$login' AND AcctStopTime >= '$week_str' AND
+ AcctStopTime <= '$now_str';");
+ if ($search){
+ $row = @da_sql_fetch_array($search,$config);
+ $weekly_used = time2strclock($row['sum(AcctSessionTime)']);
+ $weekly_conns = $row['COUNT(*)'];
+ }
+ $search = @da_sql_query($link,$config,
+ "SELECT COUNT(*),sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE
+ UserName = '$login' AND AcctStopTime LIKE '$today%';");
+ if ($search){
+ $row = @da_sql_fetch_array($search,$config);
+ $daily_used = time2strclock($row['sum(AcctSessionTime)']);
+ $daily_conns = $row['COUNT(*)'];
+ }
+}
+
+
+foreach($vars as $val){
+ echo "$val\n";
+}
+echo "$weekly_used\n$weekly_conns\n$daily_used\n$daily_conns";
+?>
--- /dev/null
+<?php
+require('../conf/config.php3');
+if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
+ include("../lib/$config[general_lib_type]/user_info.php3");
+
+if ($login == 'da_server_test'){
+ $login = $config[general_test_account_login];
+ $test_login=1;
+}
+
+echo <<<EOM
+<html>
+<head>
+<title>test user $login ($cn)</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+EOM;
+
+if (!$test_login)
+ include("../html/user_toolbar.html.php3");
+
+print <<<EOM
+</table>
+
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+EOM;
+
+if ($test_login){
+ print <<<EOM
+ <font color="white">Radius Server Test Page</font>
+EOM;
+}else{
+ print <<<EOM
+ <font color="white">User $login Test Page</font>
+EOM;
+}
+?>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+
+<?php
+if ($test_user == 1){
+ if ($server == '')
+ $server = $config[general_radius_server];
+ if ($port == 0)
+ $port = $config[general_radius_server_port];
+ $tmp_file = tempnam("$config[general_tmp_dir]",'DA');
+ $req=file($config[general_auth_request_file]);
+ $comm = $config[general_radclient_bin] . " $server:$port" . ' auth ' . $config[general_radius_server_secret]
+ . ' >' . $tmp_file;
+ $fp = popen("$comm","w");
+ if ($fp){
+ foreach ($req as $val){
+ fwrite($fp,$val);
+ }
+ if ($test_login){
+ $test=1;
+ fwrite($fp, "User-Name = \"$config[general_test_account_login]\"\n");
+ fwrite($fp, "Password = \"$config[general_test_account_password]\"\n");
+ pclose($fp);
+ }
+ else{
+ fwrite($fp, "User-Name = \"$login\"\n");
+ if ($auth_proto == 'pap')
+ fwrite($fp, "Password = \"$passwd\"\n");
+ else if ($auth_proto == 'chap')
+ fwrite($fp, "CHAP-Password = \"$passwd\"\n");
+ pclose($fp);
+ }
+ $reply = file($tmp_file);
+ unlink($tmp_file);
+ if (ereg('code 2', $reply[0]))
+ $msg = "<b>Authentication was <font color=green>successful</font>";
+ else if (ereg('code 3',$reply[0]))
+ $msg = "<b>Authentication <font color=red>failed</font>";
+ else if (ereg('no response from server', $reply[0]))
+ $msg = "<b><font color=red>No response from server</font>";
+ else if (ereg('Connection refused',$reply[0]))
+ $msg = "<b><font color=red>Connection was refused</font>";
+ if ($test_login)
+ $msg .= "</b><i> (test user $login)</i><br>\n";
+ else
+ $msg .= "</b><br>\n";
+ array_shift($reply);
+ if (count($reply)){
+ $msg .= "<br><b>Server response:</b><br>\n";
+ foreach ($reply as $val){
+ $msg .= "<i>$val</i><br>\n";
+ }
+ }
+ if ($test_login){
+ print <<<EOM
+$msg
+<br>
+</td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
+EOM;
+ exit();
+ }
+
+ }
+}
+?>
+ <form method=post>
+ <input type=hidden name=login value=<?php print $login ?>>
+ <input type=hidden name=test_user value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+User Password
+</td>
+<td>
+<input type=password name=passwd value="" size=25>
+</td>
+</tr>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Radius Server
+</td>
+<td>
+<input type=text name=server value="<?php print $config[general_radius_server] ?>" size=25>
+</td>
+</tr>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Radius Server Port
+</td>
+<td>
+<input type=text name=port value="<?php print $config[general_radius_server_port] ?>" size=25>
+</td>
+</tr>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Authentication Protocol
+</td>
+<td>
+<select name="auth_proto" editable>
+<option selected value="pap">PAP
+<option value="chap">CHAP
+</select>
+</td>
+</tr>
+
+ </table>
+<br>
+<input type=submit class=button value="Run Test" OnClick="this.form.test_user.value=1">
+</form>
+<?php
+if ($test_user == 1){
+ echo <<<EOM
+<br>
+$msg
+EOM;
+}
+?>
+ </td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<form action="stats.php3" method="get">
+<table border=0 width=600 cellpadding=2 cellspacing=0>
+<tr>
+ <td align=left>
+ <table border=0 cellspacing=0 cellpadding=2>
+ <tr valign=bottom>
+ <td><small><b>from date</td>
+ <td><small><b>to date</td>
+ <td><small><b>user</td>
+ <td><small><b>on server</td>
+ <td> </td>
+ </tr>
+ <tr background="images/greenlines1.gif" valign=middle>
+<?php
+echo <<<EOM
+ <td valign=middle><input type="text" name="after" size="12" value="$after" ></td>
+ <td valign=middle><input type="text" name="before" size="12" value="$before"></td>
+ <td valign=middle><input type="text" name="login" size="12" value="$login" ></td>
+ <td valign=middle><select name="server" size=1>
+EOM;
+foreach($servers as $key => $val)
+ echo <<<EOM
+ <option value="$val">$key
+EOM;
+?>
+ </select></td>
+ <td valign=middle><input type="submit" class=button value="Go"></td>
+ </tr>
+ </table>
+ </td>
+</tr>
+<tr>
+<td><hr size=1 noshade></td>
+</tr>
+<tr>
+ <td valign=top>
+ <table border=0 width="100%">
+ <tr> <td align=center valign=top width="45%">
+ <small>
+ <font color="darkblue"><b><?php echo $date ?></b></font>
+ </td>
+ <td align=center valign=top width="10%"> </td>
+ <td align=center valign=top width="45%"><small>
+ statistics period:<br>
+<?php
+echo <<<EOM
+ <b>$after</b> up to <b>$before</b>
+EOM;
+?>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+<tr>
+ <td align=center><h1><b>access statistics</td>
+</tr>
+<tr>
+ <td valign=top>
+ <table border=0 width="100%">
+ <tr>
+ <td colspan=2>
+ <center>
+ statistics for
+<?php
+if ($login == '')
+ echo <<<EOM
+<b><font color="darkblue">all</font></b> users
+EOM;
+else
+ echo <<<EOM
+user <b><font color="darkblue">$login</font></b>
+EOM;
+?>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <table border=0 cellpadding=0 cellspacing=0 width="100%">
+ <tr> <td colspan=2><hr size=1 noshade>
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+<tr>
+ <td align="center">
+ <table border=0 cellpadding=0 cellspacing=1 width="100%">
+<?php
+echo <<<EOM
+ <tr>
+ <td colspan=10 align=center nowrap><select name="column1">
+ <option $selected1[sessions] value="sessions">sessions
+ <option $selected1[usage] value="usage">total usage time
+ <option value="upload">------------------
+ <option $selected1[upload] value="upload">uploads
+ <option $selected1[download] value="download">downloads
+ </select> <select name="column2">
+ <option $selected2[sessions] value="sessions">sessions
+ <option $selected2[usage] value="usage">total usage time
+ <option value="upload">------------------
+ <option $selected2[upload] value="upload">uploads
+ <option $selected2[download] value="download">downloads
+ </select> <select name="column3">
+ <option $selected3[sessions] value="sessions">sessions
+ <option $selected3[usage] value="usage">total usage time
+ <option value="upload">------------------
+ <option $selected3[upload] value="upload">uploads
+ <option $selected3[download] value="download">downloads
+EOM;
+?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=10 background="images/greenlines1.gif" align=center valign=middle>
+ <table border=0 width="100%">
+ <tr>
+ <td width=50% align=left>
+ <table border=0 cellpadding=0 cellspacing=0>
+ <tr>
+ <td align=right><input type="submit" class=button value="Refresh"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <tr>
+ <td colspan=10 height=20><img src="images/pixel.gif"></td>
+ </tr>
+ <tr>
+ <td colspan=10 height=20 align=center>
+ <table border=0 width=640 cellpadding=1 cellspacing=1>
+ <tr valign=top>
+ <td width=440></td>
+ <td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Daily Analysis</font>
+ </th></tr>
+ </table>
+ </td></tr>
+ <tr valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+ <p>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ <th>date</th>
+<?php
+echo <<<EOM
+ <th colspan=3>$message[$column1]</th>
+ <th colspan=3>$message[$column2]</th>
+ <th colspan=3>$message[$column3]</th>
+EOM;
+?>
+ </tr>
+<?php
+ for($i = 0; $i <= $num_days; $i++){
+ $day = $days[$i];
+ $trcolor = ($i % 2) ? "#f7f7e4" : "#efefe4";
+ echo <<<EOM
+ <tr align=center bgcolor="$trcolor">
+ <td>$day</td>
+ <td>{$data[$day][1]}</td>
+ <td>{$perc[$day][1]}</td>
+ <td align=left height=14>
+ <table border=0 cellpadding=0>
+ <tr>
+ <td bgcolor="{$color[$day][1]}" width={$width[$day][1]}><img border=0 height=14 width={$width[$day][1]} src="images/pixel.gif" alt="the $message[$column1] for $day is {$data[$day][1]}"></td>
+ </tr>
+ </table>
+ </td>
+ <td>{$data[$day][2]}</td>
+ <td>{$perc[$day][2]}</td>
+ <td align=left height=14>
+ <table border=0 cellpadding=0>
+ <tr>
+ <td bgcolor="{$color[$day][2]}" width={$width[$day][2]}><img border=0 height=14 width={$width[$day][2]} src="images/pixel.gif" alt="the $message[$column3] for $day is {$data[$day][2]}"></td>
+ </tr>
+ </table>
+ </td>
+ <td>{$data[$day][3]}</td>
+ <td>{$perc[$day][3]}</td>
+ <td align=left height=14>
+ <table border=0 cellpadding=0>
+ <tr>
+ <td bgcolor="{$color[$day][3]}" width={$width[$day][3]}><img border=0 height=14 width={$width[$day][3]} src="images/pixel.gif" alt="the $message[$column3] for $day is {$data[$day][3]}"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+EOM;
+}
+?>
+</table>
+</td></tr>
+</table>
+</td></tr>
+</table>
+</td></tr>
+</table>
+<p>
+<table border=0 width=640 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=440></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Daily Summary</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+<p>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ff
+ffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ <th> </th>
+<?php
+echo <<<EOM
+ <th>$message[$column1]</th>
+ <th>$message[$column2]</th>
+ <th>$message[$column3]</th>
+EOM;
+?>
+ </tr>
+<?php
+echo <<<EOM
+ <tr align=center bgcolor="#efefe4">
+ <td>maximum</td>
+ <td>{$data[max][1]}</td>
+ <td>{$data[max][2]}</td>
+ <td>{$data[max][3]}</td>
+ </tr>
+ <tr align=center bgcolor="#f7f7e4">
+ <td>average</td>
+ <td>{$data[avg][1]}</td>
+ <td>{$data[avg][2]}</td>
+ <td>{$data[avg][3]}</td>
+ </tr>
+ <tr align=center bgcolor="#efefe4">
+ <td>sum</td>
+ <td>{$data[sum][1]}</td>
+ <td>{$data[sum][2]}</td>
+ <td>{$data[sum][3]}</td>
+ </tr>
+EOM;
+?>
+</table>
+ </table>
+ </td></tr>
+ </table>
+ </td></tr>
+</table>
+</form>
+</center>
+</body>
+</html>
--- /dev/null
+<?php
+
+echo <<<EOM
+<title>user information for $cn</title>
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<link rel="stylesheet" href="style.css">
+EOM;
+if ($logged_now)
+ print <<<EOM
+<script Language="JavaScript">
+<!--
+ var start;
+ var our_time;
+
+ function startcounter()
+ {
+ var start_date = new Date();
+ start = start_date.getTime();
+ our_time = $lastlog_session_time_jvs;
+ showcounter();
+ }
+
+ function showcounter ()
+ {
+ var now_date = new Date();
+ var diff = now_date.getTime() - start + our_time;
+
+ var hours = parseInt(diff / 3600000);
+ if(isNaN(hours)) hours = 0;
+
+ var minutes = parseInt((diff % 3600000) / 60000);
+ if(isNaN(minutes)) minutes = 0;
+
+ var seconds = parseInt(((diff % 3600000) % 60000) / 1000);
+ if(isNaN(seconds)) seconds = 0;
+
+ var timeValue = " " ;
+ timeValue += ((hours < 10) ? "0" : "") + hours;
+ timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
+ timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
+
+ document.online.status.value = timeValue;
+ setTimeout("showcounter()", 1000);
+ }
+ //-->
+</script>
+EOM;
+
+print <<<EOM
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+EOM;
+
+include("../html/user_toolbar.html.php3");
+
+print <<<EOM
+</table>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=250>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Connection Status for $login ($cn)</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+
+EOM;
+if ($logged_now){
+ print <<<EOM
+ <form name="online" onSubmit="return(false);">
+ <tr><td align=center bgcolor="#d0ddb0">
+ User is <b>online</b> since
+ </td><td>
+ $lastlog_time
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Connection Duration
+ </td><td>
+ <input type="text" name="status" size=10 value="$lastlog_session_time">
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ User IP Address
+ </td><td>
+ <font color=darkblue><b>$lastlog_client_name</b></font> ($lastlog_client_ip)
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ NAS Server
+ </td><td>
+ <b>$lastlog_server_name</b> ($lastlog_server_ip)
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ NAS Port
+ </td><td>
+ $lastlog_server_port
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Upload
+ </td><td>
+ $lastlog_input
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Download
+ </td><td>
+ $lastlog_output
+ </td></tr>
+ </form>
+EOM;
+}else if ($not_known) print <<<EOM
+ <tr><td align=center bgcolor="#d0ddb0">
+ This user has <b>never</b> connected
+ </td><td>-
+ </td></tr>
+EOM;
+else print <<<EOM
+ <tr><td align=center bgcolor="#d0ddb0">
+ User is <b>not online</b> now<br>
+ </td><td>-
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Last Connection Time
+ </td><td>
+ $lastlog_time
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ IP Address
+ </td><td>
+ <font color=darkblue><b>$lastlog_client_name</b></font> ($lastlog_client_ip)
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Online Time
+ </td><td>
+ $lastlog_session_time
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ NAS Server
+ </td><td>
+ <b>$lastlog_server_name</b> ($lastlog_server_ip)
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ NAS Port
+ </td><td>
+ $lastlog_server_port
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Upload
+ </td><td>
+ $lastlog_input
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Download
+ </td><td>
+ $lastlog_output
+ </td></tr>
+EOM;
+
+print <<<EOM
+ <tr><td align=center bgcolor="#d0ddb0">
+ Allowed Session
+ </td><td>
+ $msg
+ </td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">
+ Usefull User Description
+ </td><td>
+ $descr
+ </td></tr>
+ </table>
+ </table>
+</table>
+
+EOM;
+
+if (is_file("../lib/$config[general_lib_type]/password_check.php3"))
+ include("../lib/$config[general_lib_type]/password_check.php3");
+
+echo <<<EOM
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Account Status For The Last 7 Days</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr><td align=center bgcolor="#d0ddb0">Connections</td><td>
+ <b><font color="darkblue">$tot_conns</font></b></td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">Online time</td><td>
+ <b><font color="darkblue">$tot_time</td></tr></td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">Upload</td><td>
+ $tot_input</td></tr></td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">Download</td><td>
+ $tot_output</td></tr></td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">Average Time</td><td>
+ $avg_time</td></tr></td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">Average Upload</td><td>
+ $avg_input</td></tr></td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">Average Download</td><td>
+ $avg_output</td></tr></td></tr>
+ </table>
+ </table>
+</table>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=250>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Subscription Analysis</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr><td align=center bgcolor="#d0ddb0">-</td><td align=center bgcolor="#d0ddb0">monthly</td><td align=center bgcolor="#d0ddb0">weekly</td><td align=center bgcolor="#d0ddb0">daily</td><td align=center bgcolor="#d0ddb0">per session</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">limit</td><td>$monthly_limit</td><td>$weekly_limit</td><td>$daily_limit</td><td>$session_limit</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">used</td><td>$monthly_used</td><td>$weekly_used</td><td>$daily_used</td><td>$lastlog_session_time</td></tr>
+ </table>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" va
+lign=top>
+ <tr><td align=center bgcolor="#d0ddb0"><b>day</b></td><td align=center bgcolor="#d0ddb0"><b>daily limit</b></td><td align=center bgcolor="#d0ddb0"><b>used</b></td><tr>
+ <tr><td align=center bgcolor="#d0ddb0">sunday</td><td>$daily_limit</td><td>$used[0]</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">monday</td><td>$daily_limit</td><td>$used[1]</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">tuesday</td><td>$daily_limit</td><td>$used[2]</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">wednesday</td><td>$daily_limit</td><td>$used[3]</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">thursday</td><td>$daily_limit</td><td>$used[4]</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">friday</td><td>$daily_limit</td><td>$used[5]</td></tr>
+ <tr><td align=center bgcolor="#d0ddb0">saturday</td><td>$daily_limit</td><td>$used[6]</td></tr>
+ </table></table>
+</table>
+<br>
+EOM;
+
+if ($user_info) print <<<EOM
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=250>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Personal Information</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>name</b>
+ </td>
+ <td>
+ $cn
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>name ($config[general_prefered_lang_name])</b>
+ </td>
+ <td>
+ $cn_lang
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>departement</b>
+ </td>
+ <td>
+ $ou
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>departement ($config[general_prefered_lang_name])</b>
+ </td>
+ <td>
+ $ou_lang
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>title</b>
+ </td>
+ <td>
+ $title
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>title ($config[general_prefered_lang_name])</b>
+ </td>
+ <td>
+ $title_lang
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>address</b>
+ </td>
+ <td>
+ $homeaddress
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>address ($config[general_prefered_lang_name])</b>
+ </td>
+ <td>
+ $homeaddress_lang
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>phone</b>
+ </td>
+ <td>
+ $telephonenumber
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>home phone</b>
+ </td>
+ <td>
+ $homephone
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>mobile</b>
+ </td>
+ <td>
+ $mobile
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>fax</b>
+ </td>
+ <td>
+ $fax
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>home page</b>
+ </td>
+ <td>
+ <a href="$url" target=userpage onclick=window.open("$url","userpage","width=1000,height=550,toolbar=no,scrollbars=yes,resizable=yes") title="Go to user's homepage">$url</a>
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>e-mail</b>
+ </td>
+ <td>
+ <a href="mailto: $mail" title="Send E-Mail">$mail</a>
+ </td>
+ </tr>
+ <tr>
+ <td align=center bgcolor="#d0ddb0">
+ <b>e-mail alias</b>
+ </td>
+ <td>
+ <a href="mailto: $mailalt" title="Send E-Mail">$mailalt</a>
+ </td>
+ </tr>
+ </table>
+ </table>
+</table>
+
+EOM;
+?>
+ <tr> <td colspan=3 height=1></td></tr>
+ <tr> <td colspan=3>
+ </table>
+<?php
+if ($logged_now)
+ print <<<EOM
+<script Language="JavaScript">
+ startcounter();
+</script>
+EOM;
+?>
+
+</body>
+</html>
--- /dev/null
+<?php
+print <<<EOM
+<tr valign=top>
+<td align=center bgcolor="black" width=100>
+<a href="user_admin.php3?login=$login" title="Show User Information"><font color="white"><b>SHOW</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="user_edit.php3?login=$login" title="Change User Dialup Settings"><font color="white"><b>EDIT</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="user_accounting.php3?login=$login" title="Show User Accounting Information"><font color="white"><b>ACCOUNTING</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="badusers.php3?login=$login" title="Show User Unauthorized Actions"><font color="white"><b>BADUSERS</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="user_delete.php3?login=$login" title="Delete User"><font color="white"><b>DELETE</b></font></a></td>
+<td align=center bgcolor="black" width=100>
+<a href="user_test.php3?login=$login" title="Test User"><font color="white"><b>TEST</b></font></a></td>
+</tr>
+EOM;
+?>
--- /dev/null
+<?php
+#Read sql attribute map
+$ARR = file($config[general_sql_attrs_file]);
+foreach($ARR as $val){
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list($key,$desc,$show,$func)=split("\t+",$val);
+ $sql_attrs["$key"][desc] = "$desc";
+ $sql_attrs["$key"][show] = "$show";
+ $sql_attrs["$key"][func] = ($func == "") ? "nothing" : "$func";
+}
+?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+
+$date=date($config[sql_full_date_format]);
+$msg = $$attrmap['Dialup-Lock-Msg'];
+if ($msg == '')
+ echo "<b>Lock Message should not be empty</b><br>\n";
+else{
+ $link = @da_sql_pconnect($config);
+ if ($link){
+ $r = da_sql_query($link,$config,
+ "INSERT INTO $config[sql_badusers_table] (UserName,Date,Reason)
+ VALUES ('$login','$date','$msg');");
+ if (!$r)
+ echo "<b>SQL Error:" . da_sql_error($link) . "</b><br>\n";
+ }
+ else
+ echo "<b>SQL Error: Could not connect to sql server(" . da_sql_error($link) . ")</b><br>\n";
+}
+?>
--- /dev/null
+<?php
+#Read user_edit attribute map
+$ARR = file($config[general_user_edit_attrs_file]);
+foreach($ARR as $val){
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list($key,$v)=split("\t+",$val);
+ $show_attrs["$key"]=($v != '') ? "$v" : "$key";
+}
+?>
--- /dev/null
+<?php
+function da_encrypt($passwd)
+{
+ return $passwd;
+}
+?>
--- /dev/null
+<?php
+function da_encrypt()
+{
+ $numargs=func_num_args();
+ $passwd=func_get_arg(0);
+ if ($numargs == 2){
+ $salt=func_get_arg(1);
+ return crypt($passwd,$salt);
+ }
+ return crypt($passwd);
+}
+?>
--- /dev/null
+<?php
+function da_encrypt($passwd)
+{
+ return md5($passwd);
+}
+?>
--- /dev/null
+<?php
+$ARR=file("$config[general_default_file]");
+foreach($ARR as $val) {
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list($key,$v)=split(":[[:space:]]*",$val);
+ $default_vals["$key"]="$v";
+}
+if (is_file("../lib/$config[general_lib_type]/defaults.php3"))
+ include("../lib/$config[general_lib_type]/defaults.php3");
--- /dev/null
+<?php
+function time2str($time)
+{
+ $time = floor($time);
+ if (!$time)
+ return "0 seconds";
+ $d = $time/86400;
+ $d = floor($d);
+ if ($d){
+ $str .= "$d days, ";
+ $time = $time % 86400;
+ }
+ $h = $time/3600;
+ $h = floor($h);
+ if ($h){
+ $str .= "$h hours, ";
+ $time = $time % 3600;
+ }
+ $m = $time/60;
+ $m = floor($m);
+ if ($m){
+ $str .= "$m minutes, ";
+ $time = $time % 60;
+ }
+ if ($time)
+ $str .= "$time seconds, ";
+ $str = ereg_replace(', $','',$str);
+
+ return $str;
+}
+
+function time2strclock($time)
+{
+ $time = floor($time);
+ if (!$time)
+ return "00:00:00";
+
+ $str["hour"] = $str["min"] = $str["sec"] = "00";
+ $h = $time/3600;
+ $h = floor($h);
+ if ($h){
+ if ($h < 10)
+ $h = "0" . $h;
+ $str["hour"] = "$h";
+ $time = $time % 3600;
+ }
+ $m = $time/60;
+ $m = floor($m);
+ if ($m){
+ if ($m < 10)
+ $m = "0" . $m;
+ $str["min"] = "$m";
+ $time = $time % 60;
+ }
+ if ($time)
+ if ($time < 10)
+ $time = "0" . $time;
+ else
+ $time = "00";
+ $str["sec"] = "$time";
+ $ret = "$str[hour]:$str[min]:$str[sec]";
+
+ return $ret;
+}
+
+function date2timediv($date)
+{
+ list($day,$time)=explode(' ',$date);
+ $day = explode('-',$day);
+ $time = explode(':',$time);
+ $timest = mktime($time[0],$time[1],$time[2],$day[1],$day[2],$day[0]);
+ $now = time();
+ return ($now - $timest);
+}
+
+function date2time($date)
+{
+ list($day,$time)=explode(' ',$date);
+ $day = explode('-',$day);
+ $time = explode(':',$time);
+ $timest = mktime($time[0],$time[1],$time[2],$day[1],$day[2],$day[0]);
+ return $timest;
+}
+
+function bytes2str($bytes)
+{
+ $bytes=floor($bytes);
+ if ($bytes > 524288)
+ $str = sprintf("%5.2f MBs", $bytes/1048576);
+ else
+ $str = sprintf("%5.2f KBs", $bytes/1024);
+
+ return $str;
+}
+
+function nothing($ret)
+{
+ return $ret;
+}
+?>
--- /dev/null
+<?php
+function init_decoder()
+{
+ return 0;
+}
+
+function decode_string($line,$k)
+{
+ return $line;
+}
+?>
--- /dev/null
+<?php
+function init_decoder()
+{
+ $k = array(
+ "\80"=>"~@", "\81"=>"~A", "\82"=>"~B", "\83"=>"~C", "\84"=>"~D", "\85"=>"~E",
+ "\86"=>"~F", "\87"=>"~G", "\88"=>"~H", "\89"=>"~I", "\8a"=>"~J", "\8b"=>"~K",
+ "\8c"=>"~L", "\8d"=>"~M", "\8e"=>"~N", "\8f"=>"~O", "\90"=>"~P", "\91"=>"~Q",
+ "\92"=>"~R", "\93"=>"~S", "\94"=>"~T", "\95"=>"~U", "\96"=>"~V", "\97"=>"~W",
+ "Â\9e"=>"~^", "Â\9f"=>"~_", " "=>"| ", "ʽ"=>"¡", "ʼ"=>"¢", "£"=>"£",
+ "�"=>"¤", "�"=>"¥", "¦"=>"¦", "§"=>"§", "¨"=>"¨", "©"=>"©",
+ "�"=>"ª", "«"=>"«", "¬"=>"¬", "Â"=>"", "�"=>"®", "â\80\95"=>"¯",
+ "°"=>"°", "±"=>"±", "²"=>"²", "³"=>"³", "Î\84"=>"´", "Î\85"=>"µ",
+ "Î\86"=>"¶", "·"=>"·", "Î\88"=>"¸", "Î\89"=>"¹", "Î\8a"=>"º", "»"=>"»",
+ "Î\8c"=>"¼", "½"=>"½", "Î\8e"=>"¾", "Î\8f"=>"¿", "Î\90"=>"À", "Î\91"=>"Á",
+ "Î\92"=>"Â", "Î\93"=>"Ã", "Î\94"=>"Ä", "Î\95"=>"Å", "Î\96"=>"Æ", "Î\97"=>"Ç",
+ "Î\98"=>"È", "Î\99"=>"É", "Î\9a"=>"Ê", "Î\9b"=>"Ë", "Î\9c"=>"Ì", "Î\9d"=>"Í",
+ "Î\9e"=>"Î", "Î\9f"=>"Ï", "Î "=>"Ð", "Ρ"=>"Ñ", "�"=>"Ò", "Σ"=>"Ó",
+ "Τ"=>"Ô", "Î¥"=>"Õ", "Φ"=>"Ö", "Χ"=>"×", "Ψ"=>"Ø", "Ω"=>"Ù",
+ "Ϊ"=>"Ú", "Ϋ"=>"Û", "ά"=>"Ü", "Î"=>"Ý", "ή"=>"Þ", "ί"=>"ß",
+ "ΰ"=>"à", "α"=>"á", "β"=>"â", "γ"=>"ã", "δ"=>"ä", "ε"=>"å",
+ "ζ"=>"æ", "η"=>"ç", "θ"=>"è", "ι"=>"é", "κ"=>"ê", "λ"=>"ë",
+ "μ"=>"ì", "ν"=>"í", "ξ"=>"î", "ο"=>"ï", "Ï\80"=>"ð", "Ï\81"=>"ñ",
+ "Ï\82"=>"ò", "Ï\83"=>"ó", "Ï\84"=>"ô", "Ï\85"=>"õ", "Ï\86"=>"ö", "Ï\87"=>"÷",
+ "Ï\88"=>"ø", "Ï\89"=>"ù", "Ï\8a"=>"ú", "Ï\8b"=>"û", "Ï\8c"=>"ü", "Ï\8d"=>"ý",
+ "Ï\8e"=>"þ", "Â\98"=>"~X", "Â\99"=>"~Y", "Â\9a"=>"~Z", "Â\9b"=>"~[", "Â\9d"=>"~]"
+ );
+
+ return $k;
+}
+
+function decode_string($line,$k)
+{
+ $line = ereg_replace("&","&&",$line);
+ $line = ereg_replace("([,+0-9./() -])", "%\\1", $line);
+ $mline = chunk_split($line, 2, " ");
+ $chars = explode(" ", $mline);
+ foreach ($chars as $c){
+ $val = $k["$c"];
+ $c = ($val != "") ? "$val" : "$c";
+ $new_line .= $c;
+ }
+ $new_line = ereg_replace("%%", " ", $new_line);
+ $new_line = ereg_replace("%([,+0-9./() -])", "\\1", $new_line);
+ $new_line = ereg_replace("%", " ",$new_line);
+ $new_line = ereg_replace("&&","&",$new_line);
+
+ return $new_line;
+}
+?>
--- /dev/null
+<?php
+#Read ldap attribute map
+$ARR = file("$config[general_ldap_attrmap]");
+foreach($ARR as $val){
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list(,$key,$v)=split('[[:space:]]+',$val);
+ $v = strtolower($v);
+ $attrmap["$key"]=$v;
+}
+$ARR = file("$config[general_extra_ldap_attrmap]");
+foreach($ARR as $val){
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list(,$key,$v)=split('[[:space:]]+',$val);
+ $v = strtolower($v);
+ $attrmap["$key"]=$v;
+}
+?>
--- /dev/null
+<?php
+ $ds = @ldap_connect($config[ldap_server]);
+ if ($ds){
+ $r = @ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ if ($r){
+
+ foreach($show_attrs as $key => $attr){
+ if ($attrmap["$key"] == 'none')
+ continue;
+ $i = $j = 0;
+ $name = $attrmap["$key"] . $i;
+
+ while (isset($$name)){
+ $val = $$name;
+ $i++;
+ $name = $attrmap["$key"] . $i;
+//
+// if value is the same as the default and the corresponding attribute in ldap does not exist or
+// the value is the same as that in ldap then continue
+//
+ if ( ($val == $default_vals["$key"] && !isset($item_vals["$key"][$j])) ||
+ $val == $item_vals["$key"][$j])
+ continue;
+//
+// if value is null and ldap attribute does not exist then continue
+//
+ if ($val == '' && !isset($item_vals["$key"][$j]))
+ continue;
+//
+// if values is the same as the default or if the value is null and the ldap attribute exists
+// then delete them
+//
+ if (($val == $default_vals["$key"] || $val == '') &&
+ isset($item_vals["$key"][$j]))
+ $del[$attrmap["$key"]] = $item_vals["$key"][$j];
+//
+// else modify the ldap attribute
+//
+ else{
+ if (isset($item_vals["$key"][$j])){
+ $mod[$attrmap["$key"]] = $item_vals["$key"][$j];
+ $add_r[$attrmap["$key"]] = $val;
+ }
+ else{
+ $add_r[$attrmap["$key"]] = $val;
+ }
+ }
+ $j++;
+ }
+ }
+ if (isset($mod)){
+ @ldap_mod_del($ds,$dn,$mod);
+ }
+ if (isset($add_r)){
+ @ldap_mod_add($ds,$dn,$add_r);
+ }
+ if (isset($del)){
+ @ldap_mod_del($ds,$dn,$del);
+ }
+ }
+ if (@ldap_error($ds) == 'Success')
+ echo "<b>The changes were successfully commited to the directory</b><br>\n";
+ else
+ echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
+ @ldap_close($ds);
+ }
+?>
--- /dev/null
+<?php
+ $ds = @ldap_connect($config[ldap_server]);
+ if ($ds){
+ $r = @ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ if ($r){
+ if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
+ include("../lib/crypt/$config[general_encryption_method].php3");
+ $passwd = da_encrypt($passwd);
+ $passwd = '{' . $config[general_encryption_method] . '}' . $passwd;
+ $mod[$attrmap['User-Password']] = $passwd;
+ @ldap_mod_replace($ds,$dn,$mod);
+ if (@ldap_error($ds) != 'Success')
+ echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
+ }
+ else
+ echo "<b>Could not open encryption library file.</b><br>\n";
+ }
+ @ldap_close($ds);
+ }
+?>
--- /dev/null
+<?php
+ $ds = @ldap_connect($config[ldap_server]);
+ if ($ds){
+ $r = @ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ if ($r){
+ list ($givenname,$sn) = split(' ',$cn,3);
+ $dn = 'uid=' . $login . ',' . $config[ldap_default_new_entry_suffix];
+ $new_user_entry["objectclass"][0]="top";
+ $new_user_entry["objectclass"][1]="person";
+ $new_user_entry["objectclass"][2]="organizationalPerson";
+ $new_user_entry["objectclass"][3]="inetOrgPerson";
+ $new_user_entry["objectclass"][4]="radiusprofile";
+ $new_user_entry["cn"]="$cn";
+ $new_user_entry["sn"]="$sn";
+ $new_user_entry["givenname"]="$givenname";
+ $new_user_entry["mail"]="$mail";
+ $new_user_entry["telephonenumber"]="$telephonenumber";
+ $new_user_entry["homephone"]="$homephone";
+ $new_user_entry["mobile"]="$mobile";
+ $new_user_entry["ou"]="$ou";
+ $new_user_entry["uid"]="$login";
+ if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
+ include("../lib/crypt/$config[general_encryption_method].php3");
+ $passwd = da_encrypt($passwd);
+ $new_user_entry[$attrmap['User-Password']] = '{' . "$config[general_encryption_method]" . '}' . $passwd;
+ }
+ else{
+ echo "<b>Could not open encryption library file.Password will be clear text.</b><br>\n";
+ $new_user_entry[$attrmap['User-Password']]="{clear}" . $passwd;
+ }
+
+ print_r($new_user_entry);
+
+ @ldap_add($ds,$dn,$new_user_entry);
+
+ foreach($show_attrs as $key => $attr){
+ if ($attrmap["$key"] == 'none')
+ continue;
+//
+// if value is the same as the default and the corresponding attribute in ldap does not exist or
+// the value is the same as that in ldap then continue
+//
+ if ( $$attrmap["$key"] == $default_vals["$key"])
+ continue;
+ if ( $$attrmap["$key"] == '')
+ continue;
+ $mod[$attrmap["$key"]] = $$attrmap["$key"];
+
+ @ldap_mod_add($ds,$dn,$mod);
+ }
+ }
+ if (@ldap_error($ds) == 'Success')
+ echo "<b>User was added in user database</b><br>\n";
+ else
+ echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
+ @ldap_close($ds);
+ }
+?>
--- /dev/null
+<?php
+if ($config[ldap_default_dn] != ''){
+ include('../lib/ldap/attrmap.php3');
+ $regular_profile_attr = $config[ldap_regular_profile_attr];
+ $ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
+ if ($ds) {
+ $r=@ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ $sr=@ldap_search($ds,"$config[ldap_default_dn]", 'objectclass=*');
+ if ($info = @ldap_get_entries($ds, $sr)){
+ $dn = $info[0]['dn'];
+ if ($dn != ''){
+ foreach($attrmap as $key => $val){
+ if ($info[0]["$val"][0] != '')
+ $default_vals["$key"] = $info[0]["$val"][0];
+ }
+ }
+ }
+ if ($regular_profile_attr != ''){
+ $get_attrs = array("$regular_profile_attr");
+ $sr=@ldap_search($ds,"$config[ldap_base]","uid=" . $login,$get_attrs);
+ if ($info = @ldap_get_entries($ds,$sr)){
+ $dn2 = $info[0][$regular_profile_attr][0];
+ if ($dn2 != ''){
+ $sr2=@ldap_search($ds,"$dn2",'objectclass=*');
+ if ($info2 = @ldap_get_entries($ds,$sr2)){
+ $dn3 = $info2[0]['dn'];
+ if ($dn3 != ''){
+ foreach($attrmap as $key => $val){
+ if ($info2[0]["$val"][0] != '')
+ $default_vals["$key"] = $info2[0]["$val"][0];
+ }
+ }
+ }
+ }
+ }
+ }
+ @ldap_close($ds);
+ }
+}
+
+?>
--- /dev/null
+<?php
+$ds = @ldap_connect($config[ldap_server]);
+if ($ds){
+ $r = @ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ if ($r){
+ @ldap_delete($ds,$dn);
+ if (@ldap_error($ds) == 'Success')
+ echo "<b>User Deleted successfully</b><br>\n";
+ else
+ echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
+ @ldap_close($ds);
+ }
+}
+?>
--- /dev/null
+<?php
+function connect2db($config)
+{
+ $ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
+ if ($ds)
+ $r=@ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ return $ds;
+}
+
+function get_user_info($ds,$user,$config)
+{
+ if ($ds){
+ $sr=@ldap_search($ds,"$config[ldap_base]", "uid=" . $user);
+ $info = @ldap_get_entries($ds, $sr);
+ $cn = $info[0]["cn"][0];
+ if ($cn == '')
+ $cn = '-';
+ return $cn;
+ }
+}
+
+function closedb($ds,$config)
+{
+ if ($ds)
+ @ldap_close($ds);
+}
+?>
--- /dev/null
+<?php
+require('password.php3');
+
+if ($action == 'checkpass'){
+ $ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
+ if ($ds){
+ if ($dn != ''){
+ $r = @ldap_bind($ds,$dn,$passwd);
+ if ($r)
+ $msg = '<font color=blue><b>YES It is that</b></font>';
+ else
+ $msg = '<font color=red><b>NO It is wrong</b></font>';
+ }
+ else
+ $msg = 'User DN is not available. Check your configuration';
+ @ldap_close($ds);
+ }
+ else
+ $msg = '<font color=red><b>Could not connect to LDAP server</b></font>';
+ echo "<tr><td colspan=3 align=center>$msg</td></tr>\n";
+}
+?>
+</form>
--- /dev/null
+<?php
+#Read person attribute mapings
+$ARR = file($config[general_ldap_person_attrs_file]);
+foreach($ARR as $val){
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list($key,$desc)=split("\t+",$val);
+ $person_attrs["$key"] = "$desc";
+}
+?>
--- /dev/null
+<?php
+require('../lib/ldap/attrmap.php3');
+if (is_file("../lib/lang/$config[general_prefered_lang]/utf8.php3"))
+ include_once("../lib/lang/$config[general_prefered_lang]/utf8.php3");
+else
+ include_once('../lib/lang/default/utf8.php3');
+
+$ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
+if ($ds) {
+ $r=@ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ $sr=@ldap_search($ds,"$config[ldap_base]", 'uid=' . $login);
+ $info = @ldap_get_entries($ds, $sr);
+ $dn = $info[0]['dn'];
+ if ($dn == '')
+ $user_exists = 'no';
+ else{
+ $user_exists = 'yes';
+ $k = init_decoder();
+ $cn = ($info[0]['cn'][0]) ? $info[0]['cn'][0] : '-';
+ $cn_lang = $info[0]["cn;lang-$config[general_prefered_lang]"][0];
+ $cn_lang = decode_string("$cn_lang", $k);
+ $cn_lang = ($cn_lang) ? $cn_lang : '-';
+ $telephonenumber = ($info[0]['telephonenumber'][0]) ? $info[0]['telephonenumber'][0] : '-';
+ $homephone = ($info[0]['homephone'][0]) ? $info[0]['homephone'][0] : '-';
+ $homeaddress = ($info[0]['homepostaladdress'][0]) ? $info[0]['homepostaladdress'][0] : '-';
+ $homeaddress_lang = $info[0]["homepostaladdress;lang-$config[general_prefered_lang]"][0];
+ $homeaddress_lang = decode_string("$homeaddress_lang", $k);
+ $homeaddress_lang = ($homeaddress_lang) ? $homeaddress_lang : '-';
+ $mobile = ($info[0]['mobile'][0]) ? $info[0]['mobile'][0] : '-';
+ $fax = ($info[0]['facsimiletelephonenumber'][0]) ? $info[0]['facsimiletelephonenumber'][0] : '-';
+ $url = ($info[0]['labeleduri'][0]) ? $info[0]['labeleduri'][0] : '-';
+ $ou = $info[0]['ou'][0];
+ $ou_lang = $info[0]["ou;lang-$config[general_prefered_lang]"][0];
+ $ou_lang = decode_string("$ou_lang", $k);
+ $ou_lang = ($ou_lang) ? $ou_lang : '-';
+ $mail = ($info[0]['mail'][0]) ? $info[0]['mail'][0] : '-';
+ $title = ($info[0]['title'][0]) ? $info[0]['title'][0] : '-';
+ $title_lang = $info[0]["title;lang-$config[general_prefered_lang]"][0];
+ $title_lang = decode_string("$title_lang", $k);
+ $title_lang = ($title_lang) ? $title_lang : '-';
+ $mailalt = ($info[0]['mailalternateaddress'][0]) ? $info[0]['mailalternateaddress'][0] : '-';
+ foreach($attrmap as $key => $val){
+ $item_vals["$key"] = $info[0]["$val"];
+ }
+ }
+ @ldap_close($ds);
+}
+?>
--- /dev/null
+<?php
+#Read ldap attribute map
+$ARR = file("$config[general_sql_attrmap]");
+foreach($ARR as $val){
+ $val=chop($val);
+ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+ continue;
+ list($type,$key,$v)=split('[[:space:]]+',$val);
+ $attrmap["$key"]=$v;
+ $attr_type["$key"]=$type;
+}
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$link = @da_sql_pconnect($config);
+if ($link){
+ foreach($show_attrs as $key => $desc){
+ if ($attrmap["$key"] == 'none')
+ continue;
+ $i = $j = 0;
+ $name = $attrmap["$key"] . $i;
+
+ while(isset($$name)){
+ $val=$$name;
+ $i++;
+ $name = $attrmap["$key"] . $i;
+
+ $sql_attr=$attrmap["$key"];
+ if ($attr_type["$key"] == 'checkItem')
+ $table = $config[sql_check_table];
+ else if ($attr_type["$key"] == 'replyItem')
+ $table = $config[sql_reply_table];
+ // if value is the same as that in the sql database do nothing
+ if ($val == $item_vals["$key"][$j])
+ continue;
+ // if value is null and corresponding value exists then delete
+ else if (($val == $default_vals["$key"] || $val == '') && isset($item_vals["$key"][$j])){
+ $res = @da_sql_query($link,$config,
+ "DELETE FROM $table WHERE UserName = '$login' AND Attribute = '$sql_attr';");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Delete failed for attribute $key</b><br>\n";
+ }
+ // if value is null then don't add it
+ else if ($val == '')
+ continue;
+ // if value differs from the sql value then update
+ else{
+ if (isset($item_vals["$key"][$j]))
+ $res = @da_sql_query($link,$config,
+ "UPDATE $table SET Value = '$val' WHERE UserName = '$login' AND
+ Attribute = '$sql_attr';");
+ else
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $table (UserName,Attribute,Value)
+ VALUES ('$login','$sql_attr','$val');");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Change failed for attribute $key</b><br>\n";
+ }
+ $j++;
+ }
+ }
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$link = @da_sql_pconnect($config);
+if ($link){
+ if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
+ include("../lib/crypt/$config[general_encryption_method].php3");
+ $passwd = da_encrypt($passwd);
+ $res = @da_sql_query($link,$config,
+ "SELECT Value FROM $config[sql_check_table] WHERE UserName = '$login'
+ AND Attribute = '$config[sql_password_attribute]';");
+ if ($res){
+ $row = @da_sql_fetch_array($res,$config);
+ if ($row){
+ $res = @da_sql_query($link,$config,
+ "UPDATE $config[sql_check_table] SET Value = '$passwd' WHERE
+ Attribute = '$config[sql_password_attribute]' AND UserName = '$login';");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Error while changing password</b><br>\n";
+ }
+ else{
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $config[sql_check_table] (Attribute,Value,UserName)
+ VALUES ('$config[sql_password_attribute]','$passwd','$login');");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Error while changing password</b><br>\n";
+ }
+ }
+ else
+ echo "<b>Error while executing query</b><br>\n";
+ }
+ else
+ echo "<b>Could not open encryption library file</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$da_abort=0;
+$link = @da_sql_pconnect($config);
+if ($link){
+ if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
+ include("../lib/crypt/$config[general_encryption_method].php3");
+ $passwd = da_encrypt($passwd);
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $config[sql_check_table] (Attribute,Value,UserName)
+ VALUES ('$config[sql_password_attribute]','$passwd','$login');");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config)){
+ echo "<b>Unable to add user $login. SQL error</b><br>\n";
+ $da_abort=1;
+ }
+ if ($config[sql_use_user_info_table] == 'true' && !$da_abort){
+ $res = @da_sql_query($link,$config,
+ "SELECT UserName FROM $config[sql_user_info_table] WHERE
+ UserName = '$login';");
+ if ($res){
+ if (!@da_sql_num_rows($res,$config)){
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $config[sql_user_info_table]
+ (UserName,Name,Mail,Department,HomePhone,WorkPhone,Mobile) VALUES
+ ('$login','$cn','$mail','$ou','$telephonenumber','$homephone','$mobile');");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Could not add user information in user info table</b><br>\n";
+ }
+ else
+ echo "<b>User already exists in user info table.</b><br>\n";
+ }
+ }
+ if (!$da_abort){
+ foreach($show_attrs as $key => $attr){
+ if ($attrmap["$key"] == 'none')
+ continue;
+ if ($attr_type[$key] == 'checkItem')
+ $table = "$config[sql_check_table]";
+ else if ($attr_type[$key] == 'replyItem')
+ $table = "$config[sql_reply_table]";
+ $val = $$attrmap["$key"];
+ if ($val == '' || $val == $default_vals["$key"])
+ continue;
+ $res = @da_sql_query($link,$config,
+ "INSERT INTO $table (Attribute,Value,UserName)
+ VALUES ('$attrmap[$key]','$val','$login');");
+ if (!$res || !@da_sql_affected_rows($link,$res,$config))
+ echo "<b>Query failed for attribute $key</b><br>\n";
+ }
+ }
+ echo "<b>User created successfully</b><br>\n";
+ }
+ else
+ echo "<b>Could not open encryption library file</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$link = @da_sql_pconnect($config);
+if ($link){
+ $res = @da_sql_query($link,$config,
+ "DELETE FROM $config[sql_reply_table] WHERE UserName = '$login';");
+ if ($res){
+ $res = @da_sql_query($link,$config,
+ "DELETE FROM $config[sql_check_table] WHERE UserName = '$login';");
+ if ($res){
+ if ($config[sql_use_user_info_table] == 'true'){
+ $res = @da_sql_query($config[sql_database],
+ "DELETE FROM $config[sql_user_info_table] WHERE UserName = '$login';");
+ if ($res)
+ echo "<b>User $login deleted successfully</b><br>\n";
+ else
+ echo "<b>Error deleting user $login from user info table</b><br>\n";
+ }
+ }
+ else
+ echo "<b>Error deleting user $login from check table</b><br>\n";
+ }
+ else
+ echo "<b>Error deleting user $login from reply table</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+<?php
+function da_sql_connect($config)
+{
+ return @mysql_connect("$config[sql_server]:$config[sql_port]",$config[sql_username],
+ $config[sql_password]);
+}
+
+function da_sql_pconnect($config)
+{
+ return @mysql_pconnect("$config[sql_server]:$config[sql_port]",$config[sql_username],
+ $config[sql_password]);
+}
+
+function da_sql_close($link,$config)
+{
+ return @mysql_close($link);
+}
+
+function da_sql_query($link,$config,$query)
+{
+ return @mysql_db_query($config[sql_database],$query,$link);
+}
+
+function da_sql_num_rows($result,$config)
+{
+ return @mysql_num_rows($result);
+}
+
+function da_sql_fetch_array($result,$config)
+{
+ return @mysql_fetch_array($result);
+}
+
+function da_sql_affected_rows($link,$result,$config)
+{
+ return @mysql_affected_rows($link);
+}
+
+function da_sql_list_fields($table,$link,$config)
+{
+ return @mysql_list_fields($config[sql_database],$table);
+}
+
+function da_sql_num_fields($fields,$config)
+{
+ return @mysql_num_fields($fields);
+}
+
+function da_sql_field_name($fields,$num,$config)
+{
+ return @mysql_field_name($fields,$num);
+}
+
+function da_sql_error($link,$config)
+{
+ return @mysql_error($link);
+}
+?>
--- /dev/null
+<?php
+function da_sql_connect($config)
+{
+ return @pg_connect("host=$config[sql_server] port=$config[sql_port]
+ dbname=$config[sql_database] user=$config[sql_username]
+ password=$config[sql_password]");
+}
+
+function da_sql_pconnect($config)
+{
+ return @pg_pconnect("host=$config[sql_server] port=$config[sql_port]
+ dbname=$config[sql_database] user=$config[sql_username]
+ password=$config[sql_password]");
+}
+
+function da_sql_close($link,$config)
+{
+ @pg_close($link);
+}
+
+function da_sql_query($link,$config,$query)
+{
+ return @pg_exec($link,$query);
+}
+
+function da_sql_num_rows($result,$config)
+{
+ return @pg_numrows($result);
+}
+
+function da_sql_fetch_array($result,$config)
+{
+ $row = @pg_fetch_array($result,$config[tmp_pg_array_num][$result]++,PGSQL_ASSOC);
+ if (!$row)
+ $config[tmp_pg_array_num][$result] = 0;
+ return $row;
+}
+
+function da_sql_affected_rows($link,$result,$config)
+{
+ return @pg_cmdtuples($result);
+}
+
+function da_sql_list_fields($table,$link,$config)
+{
+ $res = @pg_exec($link,
+ "select count(*) from pg_attribute where attnum > '0' and
+ attrelid = (select oid from pg_class where relname='$table');");
+ if ($res){
+ $row = @pg_fetch_row($res,0);
+ if ($row){
+ if (!$row[0])
+ return NULL;
+ $fields[num] = $row[0];
+ }
+ }
+ $res = @pg_exec($link,
+ "select attname from pg_attribute where attnum > '0' and
+ attrelid = (select oid from pg_class where relname='$table');");
+ if ($res)
+ $fields[res]=$res;
+ else
+ return NULL;
+
+ return $fields;
+}
+
+function da_sql_num_fields($fields,$config)
+{
+ if ($fields)
+ return $fields[num];
+}
+
+function da_sql_field_name($fields,$num,$config)
+{
+ if ($fields){
+ $row = @pg_fetch_row($fields[res],$num);
+ if ($row)
+ return $row[0];
+ }
+}
+
+function da_sql_error($link,$config)
+{
+ return pg_errormessage($link);
+}
+?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+
+function connect2db($config)
+{
+ $link=@da_sql_pconnect($config);
+
+ return $link;
+}
+
+function get_user_info($link,$user,$config)
+{
+ if ($link && $config[sql_use_user_info_table] == 'true'){
+ $res=@da_sql_query($link,$config,
+ "SELECT Name FROM $config[sql_user_info_table] WHERE UserName = '$user';");
+ if ($res){
+ $row = @da_sql_fetch_array($res,$config);
+ if ($row)
+ return $row[Name];
+ }
+ }
+}
+
+function closedb($link,$config)
+{
+ return 1;
+}
+?>
--- /dev/null
+<?php
+require('password.php3');
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+
+if ($action == 'checkpass'){
+ $link = @da_sql_pconnect($config);
+ if ($link){
+ $res = @da_sql_query($link,$config,
+ "SELECT Value FROM $config[sql_check_table] WHERE UserName = '$login'
+ AND Attribute = '$config[sql_password_attribute]';");
+ if ($res){
+ $row = @da_sql_fetch_array($res,$config);
+ if (is_file("../lib/crypt/$config[general_encryption_method].php3")){
+ include("../lib/crypt/$config[general_encryption_method].php3");
+ $enc_passwd = $row[Value];
+ $salt=substr($enc_passwd,0,2);
+ $passwd = da_encrypt($passwd,$salt);
+ if ($passwd == $enc_passwd)
+ $msg = '<font color=blue><b>YES It is that</b></font>';
+ else
+ $msg = '<font color=red><b>NO It is wrong</b></font>';
+ }
+ else
+ echo "<b>Could not open encryption library file</b><br>\n";
+ }
+ }
+ echo "<tr><td colspan=3 align=center>$msg</td></tr>\n";
+}
+?>
+</form>
--- /dev/null
+<?php
+require('../lib/sql/attrmap.php3');
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+$user_exists = 'no';
+$link = @da_sql_pconnect($config);
+if ($link){
+ $res = @da_sql_query($link,$config,
+ "SELECT Attribute,Value FROM $config[sql_check_table] WHERE UserName = '$login';");
+ if ($res){
+ if (@da_sql_num_rows($res,$config))
+ $user_exists = 'yes';
+ while(($row = @da_sql_fetch_array($res,$config))){
+ $attr = $row[Attribute];
+ $val = $row[Value];
+ $tmp["$attr"][]="$val";
+ $tmp["$attr"][count]++;
+ }
+ $res = @da_sql_query($link,$config,
+ "SELECT Attribute,Value FROM $config[sql_reply_table] WHERE UserName = '$login';");
+ if ($res){
+ while(($row = @da_sql_fetch_array($res,$config))){
+ $attr = $row[Attribute];
+ $val = $row[Value];
+ $tmp["$attr"][] = "$val";
+ $tmp["$attr"][count]++;
+ }
+ if ($config[sql_use_user_info_table] == 'true'){
+ $res = @da_sql_query($link,$config,
+ "SELECT * FROM $config[sql_user_info_table] WHERE UserName = '$login';");
+ if ($res){
+ if (($row = @da_sql_fetch_array($res,$config))){
+ $cn = ($row[Name]) ? $row[Name] : '-';
+ $telephonenumber = ($row[WorkPhone]) ? $row[WorkPhone] : '-';
+ $homephone = ($row[HomePhone]) ? $row[HomePhone] : '-';
+ $ou = ($row[Depatment]) ? $row[Department] : '-';
+ $mail = ($row[Mail]) ? $row[Mail] : '-';
+ $mobile = ($row[Mobile]) ? $row[Mobile] : '-';
+ }
+ }
+ }
+ }
+ else
+ echo "<b>Database query failed partially</b><br>\n";
+ foreach($attrmap as $key => $val){
+ if (isset($tmp[$val])){
+ $item_vals["$key"] = $tmp[$val];
+ $item_vals["$key"][count] = $tmp[$val][count];
+ }
+ }
+
+ }
+ else
+ echo "<b>Database query failed</b><br>\n";
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>
--- /dev/null
+#
+# Table structure for table 'badusers'
+#
+CREATE TABLE badusers (
+ id int(10) DEFAULT '0' NOT NULL auto_increment,
+ UserName varchar(30),
+ Date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ Reason varchar(200),
+ PRIMARY KEY (id)
+);
--- /dev/null
+#
+# Table structure for table 'userinfo'
+#
+CREATE TABLE userinfo (
+ id int(10) DEFAULT '0' NOT NULL auto_increment,
+ UserName varchar(30),
+ Name varchar(200),
+ Mail varchar(200),
+ Department varchar(200),
+ WorkPhone varchar(200),
+ HomePhone varchar(200),
+ Mobile varchar(200),
+ PRIMARY KEY (id)
+);