Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Ban users to vote for theiselves  (Read 7542 times)

0 Members and 1 Guest are viewing this topic.

wiren

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Ban users to vote for theiselves
« on: October 26, 2003, 12:43:06 pm »

Some users of mine use to vote their own pictures, of course they like them and even if the pic is bad they give it a generous five/five :D!

This is awful, for we have few votes too and it is enough to auto-vote for your pic to jump on the top-rated... a real shame :D

So, it there a way to ban users to vote their own photos? I know cmine identify the one who votes, for if you try to vote a second time a pic you are not able to, coppermine tells you you already voted the pic...

How can we hack this to ban the same user to vote?


Thank you and have anice sunday.

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Ban users to vote for theiselves
« Reply #1 on: October 26, 2003, 12:56:53 pm »

Even if they can vote - they can vote only once....
Logged
SANIsoft PHP applications for E Biz

jdbaranger

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 169
    • Accro-Photo
Ban users to vote for theiselves
« Reply #2 on: November 29, 2003, 06:00:05 pm »

Hello,

Excuse-me but they can vote every keep_votes_time days.

This suggestion is a very good idea.

Jean-Denis
Logged
Jean-Denis

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Ban users to vote for theiselves
« Reply #3 on: November 29, 2003, 07:00:49 pm »

why let people vote 2 times on same pic ?
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

jdbaranger

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 169
    • Accro-Photo
Ban users to vote for theiselves
« Reply #4 on: November 29, 2003, 07:12:49 pm »

So here the way of prohibiting the vote for its own pictures :

In Language File ( ex : French.php )

Search for
Code: [Select]
'rate_ok' => 'Your vote was accepted',

Add After
Code: [Select]
'forbidden' => 'You cannot rate your own pictures.',

In ratepic.php

Search for
Code: [Select]
$sql = "SELECT a.votes as votes_allowed, p.votes as votes, pic_rating " . "FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_ALBUMS']} AS a " . "WHERE p.aid = a.aid AND pid = '$pic' LIMIT 1";

Replace with
Code: [Select]
$sql = "SELECT a.votes as votes_allowed, p.votes as votes, pic_rating, owner_id " . "FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_ALBUMS']} AS a " . "WHERE p.aid = a.aid AND pid = '$pic' LIMIT 1";

Search for
Code: [Select]
// Update picture rating
$new_rating = round(($row['votes'] * $row['pic_rating'] + $rate * 2000) / ($row['votes'] + 1));


Add Before
Code: [Select]
//Test for Self-Rating
$user=USER_ID;
$owner=$row['owner_id'];
if ($user==$owner) cpg_die(ERROR, $lang_rate_pic_php['forbidden'], __FILE__, __LINE__);


Jean-Denis
Logged
Jean-Denis

jdbaranger

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 169
    • Accro-Photo
Ban users to vote for theiselves
« Reply #5 on: November 29, 2003, 07:29:40 pm »

Quote from: "DJMaze"
why let people vote 2 times on same pic ?


By default, you can vote every 30 days for the same picture.
I made a MOD to allow this value be editable.
Search in forums for "Allow multiple vote - Define Votes Time-To-Live"

Jean-Denis
Logged
Jean-Denis
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 14 queries.