Welcome to Geeklog, Anonymous Friday, December 27 2024 @ 11:37 am EST
Geeklog Forums
4Images Integration Rating Problem
Anonymous
Anonymous
I installed 4images integration and everything is working great except for the rating system for images. I get the following error when I try to rate the image:
Warning: Cannot modify header information - headers already sent by (output started at c:mywebsitelib-common.php(859) : eval()'d code:5) in C:mywebsitegalleryincludespage_header.php on line 248
I checked at line 248 in the page_header.php and it is trying to set the cookie to indicate that you rated the image.
Can anyone help with this?
Thanks
12
12
Quote
Anonymous
Anonymous
I had the same problem on mine and tried dozens of different things to try and get it to work (including a fresh install of GL with just 4images added on).
After researching some more I stumbled across a solution here for a different problem (with the same type of error) -- IIRC, the fix was to preface the line being complained about with an @ sign.
12
12
Quote
Anonymous
Anonymous
Yes that worked for me - Thank You.
What also worked was to set
output_bufferring = On in php.ini
but i like your solution better.
Thanks
11
11
Quote
Status: offline
aj_iamawitch
Forum User
Newbie
Registered: 11/26/04
Posts: 8
Location:California
I had this problem in my GL 1.3.9 rc2 site and the fix was a bit different, but on the same track as the last messge from the 6/27/03 post:
I added the "@" sign to the line
setcookie($cookie_name.'rated', serialize($cookie_rated),
to end up with
@setcookie($cookie_name.'rated', serialize($cookie_rated),
See the code fragment from the page_header.php template
The full example is given below for sake of clarity
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
if ($rating && $rating if (!isset($session_info['rated_imgs'])) {
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
}
$split_list = array();
if (!empty($session_info['rated_imgs'])) {
$split_list = explode(" ", $session_info['rated_imgs']);
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'] .= " ".$id;
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
$site_sess->set_session_var("rated_imgs", $session_info['rated_imgs']);
$cookie_rated[] = $id;
$cookie_expire = time() + 60 * 60 * 24 * 4;
@setcookie($cookie_name.'rated', serialize($cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
update_image_rating($id, $rating);
$msg = $lang['voting_success'];
}
else {
$msg = $lang['already_voted'];
}
}
else {
$msg = $lang['voting_error'];
}
}
AJ
I added the "@" sign to the line
setcookie($cookie_name.'rated', serialize($cookie_rated),
to end up with
@setcookie($cookie_name.'rated', serialize($cookie_rated),
See the code fragment from the page_header.php template
The full example is given below for sake of clarity
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
if ($rating && $rating if (!isset($session_info['rated_imgs'])) {
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
}
$split_list = array();
if (!empty($session_info['rated_imgs'])) {
$split_list = explode(" ", $session_info['rated_imgs']);
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'] .= " ".$id;
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
$site_sess->set_session_var("rated_imgs", $session_info['rated_imgs']);
$cookie_rated[] = $id;
$cookie_expire = time() + 60 * 60 * 24 * 4;
@setcookie($cookie_name.'rated', serialize($cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
update_image_rating($id, $rating);
$msg = $lang['voting_success'];
}
else {
$msg = $lang['already_voted'];
}
}
else {
$msg = $lang['voting_error'];
}
}
AJ
11
14
Quote
All times are EST. The time is now 11:37 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content