V@no - this seems to "expire" after cookies are deleted - seems like there was another "disable rating after vote" thing I used before that just posted a message "Sorry, but you've already voted..."
here's my code from page_header.php:/* //-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
if ($user_info['user_level'] != GUEST) {
$voted_array = array();
if (!empty($user_info['user_voted'])) {
$voted_array = explode(" ", $user_info['user_voted']);
}
$list_rated = array();
foreach ($voted_array as $key) {
$split = explode(",", $key);
$list_rated[] = $split[0];
if ($id == $split[0]) {
$rating = $split[1];
}
}
$rated = in_array($id, $list_rated);
}else{
$rated = FALSE;
}
$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 <= MAX_RATING && $id) {
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) && !$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'];
}
} */
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
//----- Settings ------------
//change to $rate_suffix = ""; if u dont want remmber votes for different users on same computer
$rate_suffix = "_".$user_info['user_id'];
//--- End Settings ----------
if ($action == "rateimage" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated_array = isset($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'.$rate_suffix])) : array();
if ($rating && $rating <= MAX_RATING && $id) {
if (!isset($session_info['rated_imgs'.$rate_suffix])) {
$session_info['rated_imgs'.$rate_suffix] = $site_sess->get_session_var("rated_imgs".$rate_suffix);
}
$split_list_array = array();
if (!empty($session_info['rated_imgs'.$rate_suffix])) {
$split_list_array = explode(" ", $session_info['rated_imgs'.$rate_suffix]);
}
$split_list = array();
foreach ($split_list_array as $key) {
$key = explode(",", $key);
$split_list[] = $key[0];
}
$cookie_rated = array();
foreach ($cookie_rated_array as $key) {
$key = explode(",", $key);
$cookie_rated[] = $key[0];
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'.$rate_suffix] .= " ".$id.",".$rating;
$session_info['rated_imgs'.$rate_suffix] = trim($session_info['rated_imgs'.$rate_suffix]);
$site_sess->set_session_var("rated_imgs".$rate_suffix, $session_info['rated_imgs'.$rate_suffix]);
$cookie_rated_array[] = $id.",".$rating;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated'.$rate_suffix, serialize($cookie_rated_array), $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'];
}
}
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
I simply commented out what was already there and added this new code - - but users can still vote again the next day - - is this one based on cookies?
thx -