diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index bea388e43f..fe29de2fa3 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -380,9 +380,9 @@ function user_pass_ok($user_login,$user_pass) { } function get_currentuserinfo() { // a bit like get_userdata(), on steroids - global $HTTP_COOKIE_VARS, $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5; + global $HTTP_COOKIE_VARS, $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5, $cookiehash; // *** retrieving user's data from cookies and db - no spoofing - $user_login = $HTTP_COOKIE_VARS['wordpressuser']; + $user_login = $HTTP_COOKIE_VARS['wordpressuser_'.$cookiehash]; $userdata = get_userdatabylogin($user_login); $user_level = $userdata->user_level; $user_ID = $userdata->ID; diff --git a/b2-include/b2template.functions.php b/b2-include/b2template.functions.php index 35c6ea8956..8d4af5aca3 100644 --- a/b2-include/b2template.functions.php +++ b/b2-include/b2template.functions.php @@ -598,13 +598,13 @@ function the_content_unicode($more_link_text='(more...)', $stripteaser=0, $more_ function get_the_content($more_link_text='(more...)', $stripteaser=0, $more_file='') { global $id, $post, $more, $c, $withcomments, $page, $pages, $multipage, $numpages; - global $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $preview; + global $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $preview, $cookiehash; global $querystring_start, $querystring_equal, $querystring_separator; global $pagenow; $output = ''; if (!empty($post->post_password)) { // if there's a password - if ($HTTP_COOKIE_VARS['wp-postpass'] != $post->post_password) { // and it doesn't match the cookie + if ($HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie $output = get_the_password_form(); return $output; } @@ -692,11 +692,11 @@ function the_excerpt_unicode() { function get_the_excerpt($fakeit = false) { global $id, $post; - global $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $preview; + global $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $preview, $cookiehash; $output = ''; $output = stripslashes($post->post_excerpt); if (!empty($post->post_password)) { // if there's a password - if ($HTTP_COOKIE_VARS['wp-postpass'] != $post->post_password) { // and it doesn't match the cookie + if ($HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie $output = "There is no excerpt because this is a protected post."; return $output; } @@ -1173,7 +1173,7 @@ function comments_popup_script($width=400, $height=400, $file='b2commentspopup.p } function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { - global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS; + global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash; global $querystring_start, $querystring_equal, $querystring_separator, $siteurl; $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id"); if (0 == $number && 'closed' == $post->comment_status) { @@ -1181,7 +1181,7 @@ function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Com return; } else { if (!empty($post->post_password)) { // if there's a password - if ($HTTP_COOKIE_VARS['wp-postpass'] != $post->post_password) { // and it doesn't match the cookie + if ($HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie echo("Enter your password to view comments"); return; } diff --git a/b2comments.php b/b2comments.php index 319978261b..425540a672 100644 --- a/b2comments.php +++ b/b2comments.php @@ -4,15 +4,15 @@ if (($withcomments) or ($c)) { if (!empty($post->post_password)) { // if there's a password - if ($HTTP_COOKIE_VARS['wp-postpass'] != $post->post_password) { // and it doesn't match the cookie + if ($HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $post->post_password) { // and it doesn't match the cookie echo("
Enter your password to view comments.
"); return; } } - $comment_author = trim($HTTP_COOKIE_VARS["comment_author"]); - $comment_author_email = trim($HTTP_COOKIE_VARS["comment_author_email"]); - $comment_author_url = trim($HTTP_COOKIE_VARS["comment_author_url"]); + $comment_author = trim($HTTP_COOKIE_VARS["comment_author_".$cookiehash]); + $comment_author_email = trim($HTTP_COOKIE_VARS["comment_author_email_".$cookiehash]); + $comment_author_url = trim($HTTP_COOKIE_VARS["comment_author_url_".$cookiehash]); $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); ?> diff --git a/b2comments.post.php b/b2comments.post.php index f7a75f2e16..b37bb6cc1d 100644 --- a/b2comments.post.php +++ b/b2comments.post.php @@ -118,9 +118,9 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds if ($url == '') $url = ' '; // this to make sure a cookie is set for 'no url' - setcookie('comment_author', $author, time()+30000000); - setcookie('comment_author_email', $email, time()+30000000); - setcookie('comment_author_url', $url, time()+30000000); + setcookie('comment_author_'.$cookiehash, $author, time()+30000000); + setcookie('comment_author_email_'.$cookiehash, $email, time()+30000000); + setcookie('comment_author_url_'.$cookiehash, $url, time()+30000000); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); diff --git a/b2commentspopup.php b/b2commentspopup.php index a94a32c739..24b098cc71 100644 --- a/b2commentspopup.php +++ b/b2commentspopup.php @@ -31,7 +31,7 @@ foreach ($posts as $post) { start_b2(); get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); -if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) { // and it doesn't match the cookie +if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie echo("