Changeset a68d42f968bde01a20d55ffc7c9cd33656fbb900
- Timestamp:
- 05/06/09 10:43:45 (3 years ago)
- Author:
- Neutron Soutmun <neo.neutron@…>
- Children:
- a0fbd8081aad14716555b28cab27c19b76973eea
- Parents:
- 15110c771604f44d1b149a66b2d4f09f00fb585c
- git-committer:
- Neutron Soutmun <neo.neutron@…> (05/06/09 10:43:45)
- Message:
-
Handle the virtual server for squid helper
2009-05-06 Neutron Soutmun <neo.neutron@…>
- weblogin/squid_helper.php: Handle the virtual server for squid helper.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r15110c7
|
ra68d42f
|
|
| | 1 | 2009-05-06 Neutron Soutmun <neo.neutron@gmail.com> |
| | 2 | |
| | 3 | * weblogin/squid_helper.php: Handle the virtual server for squid helper. |
| | 4 | |
| 1 | 5 | 2009-05-04 Neutron Soutmun <neo.neutron@gmail.com> |
| 2 | 6 | |
-
|
r59f8607
|
ra68d42f
|
|
| 33 | 33 | include_once 'config.php'; |
| 34 | 34 | require_once 'rahu_xmlrpc.class.php'; |
| | 35 | require_once 'networkchk.php'; |
| 35 | 36 | |
| 36 | 37 | define(CACHE_TIME, 120); |
| … |
… |
|
| 46 | 47 | $srcip = rawurldecode($arg); |
| 47 | 48 | |
| | 49 | $config = get_config_by_network(trim($srcip), $config_list); |
| | 50 | $vserver_id = $config["VSERVER_ID"]; |
| | 51 | |
| 48 | 52 | // Check cache |
| 49 | | if (!empty($user_list[$srcip]['username']) && |
| 50 | | (time() - $user_list[$srcip]['timestamp']) < CACHE_TIME) { |
| 51 | | fwrite(STDOUT, "OK user=". $user_list[$srcip]['username'] ."\n"); |
| | 53 | if (!empty($user_list[$vserver_id][$srcip]['username']) && |
| | 54 | (time() - $user_list[$vserver_id][$srcip]['timestamp']) < CACHE_TIME) { |
| | 55 | fwrite(STDOUT, "OK user=". $user_list[$vserver_id][$srcip]['username'] ."\n"); |
| 52 | 56 | continue; |
| 53 | 57 | } |
| … |
… |
|
| 57 | 61 | $xmlrpc->port = $config["RAHUNAS_PORT"]; |
| 58 | 62 | try { |
| 59 | | $retinfo = $xmlrpc->do_getsessioninfo($srcip); |
| | 63 | $retinfo = $xmlrpc->do_getsessioninfo($vserver_id, $srcip); |
| 60 | 64 | if (is_array($retinfo) && !empty($retinfo['session_id'])) { |
| 61 | | $user_list[$srcip]['username'] = $retinfo['username']; |
| 62 | | $user_list[$srcip]['timestamp'] = time(); |
| | 65 | $user_list[$vserver_id][$srcip]['username'] = $retinfo['username']; |
| | 66 | $user_list[$vserver_id][$srcip]['timestamp'] = time(); |
| 63 | 67 | fwrite(STDOUT, "OK user=". $retinfo['username'] ."\n"); |
| 64 | 68 | } else { |