Author Topic: Not Vote for own Images  (Read 4439 times)

0 Members and 1 Guest are viewing this topic.

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Not Vote for own Images
« on: May 13, 2005, 07:13:07 PM »
Hi there,

is there a way that the User can´t vote for there own images???
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline beseech

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Not Vote for own Images
« Reply #1 on: October 16, 2005, 11:36:15 PM »
thats a good ideia , and makes sense ;)

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Not Vote for own Images
« Reply #2 on: October 17, 2005, 12:47:42 PM »
this is the part in the page_header.php

Quote
IF (USER_ID = CURRENT_USER_ID) {
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 <= 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)) {
      $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'];
  }
}
}ELSE {
   $msg = "YOU CAN´T VOTE YOUR OWN IMAGE"
}

the red is a method of resolution!

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Not Vote for own Images
« Reply #3 on: October 17, 2005, 01:21:19 PM »
When i do this i become a blank page wenn i load the index.php
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Not Vote for own Images
« Reply #4 on: October 17, 2005, 01:49:42 PM »
das ist nur ein Lösungsansatz, man muss das alles noch anpassen... (o: