2014-03-21 21:18:50 +01:00
|
|
|
#!/bin/bash
|
|
|
|
. /etc/openvpn/scripts/config.sh
|
2016-01-20 20:51:07 +01:00
|
|
|
. /etc/openvpn/scripts/functions.sh
|
|
|
|
|
|
|
|
common_name=$(echap "$common_name")
|
|
|
|
trusted_ip=$(echap "$trusted_ip")
|
|
|
|
trusted_port=$(echap "$trusted_port")
|
|
|
|
ifconfig_pool_remote_ip=$(echap "$ifconfig_pool_remote_ip")
|
|
|
|
remote_port_1=$(echap "$remote_port_1")
|
|
|
|
bytes_received=$(echap "$bytes_received")
|
|
|
|
bytes_sent=$(echap "$bytes_sent")
|
|
|
|
|
2014-03-21 21:18:50 +01:00
|
|
|
|
2015-07-31 19:02:08 +02:00
|
|
|
# We insert data in the log table
|
2014-03-21 21:18:50 +01:00
|
|
|
mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "INSERT INTO log (log_id, user_id, log_trusted_ip, log_trusted_port, log_remote_ip, log_remote_port, log_start_time, log_end_time, log_received, log_send) VALUES(NULL, '$common_name','$trusted_ip', '$trusted_port','$ifconfig_pool_remote_ip', '$remote_port_1', now(),'0000-00-00 00:00:00', '$bytes_received', '$bytes_sent')"
|
|
|
|
|
2015-07-31 19:02:08 +02:00
|
|
|
# We specify that the user is online
|
|
|
|
mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE user SET user_online=1 WHERE user_id='$common_name'"
|