Added the checknonusedpasswords.php script
This script checks for passwords that were not accessed for a while.
This commit is contained in:
parent
1ceaae308f
commit
a850066271
@ -410,6 +410,14 @@ if (!class_exists('PWSdb'))
|
|||||||
|
|
||||||
return $sth->fetchAll();
|
return $sth->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getInactivePasswords($inactiveInterval)
|
||||||
|
{
|
||||||
|
$sth = $this->prepare('SELECT id, short, long, username, groups, lastaccess FROM passwords WHERE datetime(lastaccess, ?) < datetime(\'now\')');
|
||||||
|
$sth->execute(array($inactiveInterval));
|
||||||
|
|
||||||
|
return $sth->fetchAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
scripts/checknonusedpasswords.php
Normal file
24
scripts/checknonusedpasswords.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
// Check for inactive users
|
||||||
|
|
||||||
|
|
||||||
|
// OPTIONS
|
||||||
|
$webDir = '/var/www/localhost/htdocs/passwordstore';
|
||||||
|
|
||||||
|
require_once $webDir . '/config.php';
|
||||||
|
require_once $webDir . '/class.db.php';
|
||||||
|
|
||||||
|
$passwords = pwsdbh($dbDSN)->getInactivePasswords($passwordInactiveTime);
|
||||||
|
|
||||||
|
foreach ($passwords as $password)
|
||||||
|
{
|
||||||
|
if ($password['username'] == '')
|
||||||
|
{
|
||||||
|
printf("The password for %s (%s) was not accessed since %s\n", $password['short'], $password['long'], $password['lastaccess']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("The password for %s on %s (%s) was not accessed since %s\n", $password['username'], $password['short'], $password['long'], $password['lastaccess']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user