summaryrefslogtreecommitdiffstats
path: root/lib/class/vauth.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-01 01:06:46 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-01 01:06:46 +0000
commitb9a2603025483deefbf7636de3f6c0786e95d293 (patch)
tree5d2ece594fbed8a58874830c42d8182f025ef16b /lib/class/vauth.class.php
parent1891fd835cc3cd60d7c3a2ec8bf90b51ca261bf0 (diff)
downloadampache-b9a2603025483deefbf7636de3f6c0786e95d293.tar.gz
ampache-b9a2603025483deefbf7636de3f6c0786e95d293.tar.bz2
ampache-b9a2603025483deefbf7636de3f6c0786e95d293.zip
Finish IPv6 support
Diffstat (limited to 'lib/class/vauth.class.php')
-rw-r--r--lib/class/vauth.class.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php
index e9fa7f68..5f259760 100644
--- a/lib/class/vauth.class.php
+++ b/lib/class/vauth.class.php
@@ -267,7 +267,7 @@ class vauth {
} // end switch on data type
$username = Dba::escape($data['username']);
- $ip = $_SERVER['REMOTE_ADDR'] ? Dba::escape(sprintf("%u",ip2long($_SERVER['REMOTE_ADDR']))) : '0';
+ $ip = $_SERVER['REMOTE_ADDR'] ? Dba::escape(inet_pton($_SERVER['REMOTE_ADDR'])) : '0';
$type = Dba::escape($data['type']);
$value = Dba::escape($data['value']);
$agent = Dba::escape(substr($_SERVER['HTTP_USER_AGENT'],0,254));
@@ -361,7 +361,7 @@ class vauth {
break;
case 'stream':
$key = Dba::escape($key);
- $ip = sprintf("%u",ip2long($data['ip']));
+ $ip = Dba::escape(inet_pton($data['ip']));
$agent = Dba::escape($data['agent']);
$sql = "SELECT * FROM `session_stream` WHERE `id`='$key' AND `expire` > '$time' AND `ip`='$ip' AND `agent`='$agent'";
$db_results = Dba::query($sql);
@@ -545,7 +545,7 @@ class vauth {
if (Config::get('prevent_multiple_logins')) {
$client = new User($results['id']);
$current_ip = $client->is_logged_in();
- if ($current_ip AND $current_ip != sprintf("%u",ip2long($_SERVER['REMOTE_ADDR']))) {
+ if ($current_ip AND $current_ip != inet_pton($_SERVER['REMOTE_ADDR'])) {
debug_event('Login','Concurrent Login Failure, attempted to login from ' . $_SERVER['REMOTE_ADDR'] . ' and already logged in','1');
Error::add('general','User Already Logged in');
return false;