aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-10-16 00:35:30 +0000
committerrvelices <rv-github@modusoptimus.com>2008-10-16 00:35:30 +0000
commitf7f8c1688ef30ecb2f40fe279ba34d250d4ec8be (patch)
tree8d6fde76195c05586163fd33ed9df706367c30aa /include/ws_functions.inc.php
parent7807d6586a198c75e3d4f72c4b360bee061b817f (diff)
- security paranoia: protect session/remember me cookies from XSS attacks (works only if php>=5.2 and with IE/FF maybe others)
git-svn-id: http://piwigo.org/svn/branches/2.0@2756 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/ws_functions.inc.php22
1 files changed, 7 insertions, 15 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 4f75c8e49..e4470f6c4 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -1107,17 +1107,9 @@ function ws_session_login($params, &$service)
*/
function ws_session_logout($params, &$service)
{
- global $user, $conf;
if (!is_a_guest())
{
- $_SESSION = array();
- session_unset();
- session_destroy();
- setcookie(session_name(),'',0,
- ini_get('session.cookie_path'),
- ini_get('session.cookie_domain')
- );
- setcookie($conf['remember_me_name'], '', 0, cookie_path());
+ logout_user();
}
return true;
}
@@ -1355,7 +1347,7 @@ function ws_categories_add($params, &$service)
}
invalidate_user_cache();
-
+
return $creation_output;
}
@@ -1393,18 +1385,18 @@ function ws_images_exist($params, &$service)
-1,
PREG_SPLIT_NO_EMPTY
);
-
+
$query = '
SELECT
id,
md5sum
FROM '.IMAGES_TABLE.'
- WHERE md5sum IN (\''.implode("','", $md5sums).'\')
+ WHERE md5sum IN (\''.implode("','", $md5sums).'\')
;';
$id_of_md5 = simple_hash_from_query($query, 'md5sum', 'id');
$result = array();
-
+
foreach ($md5sums as $md5sum)
{
$result[$md5sum] = null;
@@ -1431,7 +1423,7 @@ function ws_images_setInfo($params, &$service)
// file_sum
// thumbnail_content
// thumbnail_sum
-
+
$params['image_id'] = (int)$params['image_id'];
if ($params['image_id'] <= 0)
{
@@ -1485,7 +1477,7 @@ SELECT *
array($update)
);
}
-
+
if (isset($params['categories']))
{
ws_add_image_category_relations(