SemanticScuttle/www/ajax/checkpassword.php
yohan 0600f02a13 Shoulder surfing protection with new default option. Enabled only
for logged users as we use logged user's tags to decide what
should be hidden. Tags linked to the tag defined in the
configuration, associated bookmarks, relevant links and
"last searches" block will be hidden. Hidden state is active
unless disabled by clicking on the top right button :
require user's password. This setting is remembered by
a session cookie.
2015-09-18 19:53:21 +02:00

34 lines
1.1 KiB
PHP

<?php
require_once '../www-header.php';
if(isset($_POST['password']) && $userservice->isLoggedOn()){
$password = $userservice->sanitisePassword($_POST['password']);
$username = $currentUser->getUsername();
$db = SemanticScuttle_Service_Factory::getDb();
$query = 'SELECT '. $userservice->getFieldName('primary') .' FROM '. $userservice->getTableName() .' WHERE '. $userservice->getFieldName('username') .' = "'. $db->sql_escape($username) .'" AND '. $userservice->getFieldName('password') .' = "'. $db->sql_escape($password) .'"';
if (!($dbresult = $db->sql_query($query))) {
message_die(
GENERAL_ERROR,
'Could not get user',
'', __LINE__, __FILE__, $query, $db
);
echo 'false';
}
else {
$row = $db->sql_fetchrow($dbresult);
$db->sql_freeresult($dbresult);
if ($row) {
echo 'true';
}
else {
echo 'false';
}
}
}
else {
echo 'false';
}
?>