Welcome to Geeklog Sunday, November 29 2020 @ 05:49 pm EST

Geeklog Forums

Rating System


Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
confused
Can someone help me
Since I upgraded to GL1.3.11 i have been getting the following error.
I am not good with sql errors and don't know why i might be getting this error with the rating system:

You have an error with you SQL syntax near ' ' at line 1. SQL in question: SELECT * FROM gl_rating WHERE id=

Regards

Kev Very Happy
Live everyday as if it was your last!
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
I have noticed that in GL1.3.11 that FUNCTION COM_article is no longer in the lib-common.php file, and the install of Rating System includes a mod to this file, could this be causing the problem I am having? Has anyone one else had a problem with this plugin and GL1.3.11?

Regards

Kev Banging your head
Live everyday as if it was your last!
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
apparently that function has been renamed to STORY_renderArticle and is in lib-story.php.

but if you hacked that function, you prolly need to apply your code to STORY_renderArticle now.
hth
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
cheerful
Its a deal - shaking hands Thanks for that Machinari, it works now that the code is in the right place.

Regards

Kev Very Happy
Live everyday as if it was your last!
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
curious
QUOTE: Authored by: kcrothers on Friday, November 19 2004 @ 07:10 PM EST
I've found two small errors with rating. Here are the fixes:

in rating.php change
$ratingnumber=$row[totalratings]/$row[totalvotes];
to
$ratingnumber=($row[totalratings]+$rate)/($row[totalvotes]+1);
this caused the rating to be very slightly inaccurate

Also change
GLOBAL $sid, $type, $rate, $rates, $_CONF, $_TABLES, $_USER;
to
GLOBAL $sid, $type, $rate, $rates, $_CONF, $_TABLES, $_USER, $REMOTE_ADDR;
This caused everyone to be treated as if they came from the same ip address
END QUOTE

Question
I was wondering if it is possible to recognise the user id instead of the ip address to prevent users rating an article twice?

Regards

Kev Very Happy


Live everyday as if it was your last!
 Quote

Ok

Anonymous
Anonymous users have the same user id
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
Quote by k74: QUOTE:

Question
I was wondering if it is possible to recognise the user id instead of the ip address to prevent users rating an article twice?

Regards

Kev Very Happy




I should of been clearer in my last post. The trouble I am having is if two separate registered users log in off the same ip address, the first person to rate a story is the only one that can, as the second, at present is recognised by the same ip address as the first person, and not by their registered user id as well.

Can anyone suggest how to mod the script to achieve this?

Regards

Kev Very Happy

PS: This poses a problem with users on a network system all being recognised as the one ip address.

Live everyday as if it was your last!
 Quote

Status: offline

jnordquist

Forum User
Full Member
Registered: 14/03/03
Posts: 129
Location:Kenosha
I am having a problem with the rating system and comments.

When no comments are on a story, the rating works. First comment left, and this happens:

1 commentsCurrent Rating:
Rate Story: [1] [2] [3] [4] [5]
Most Recent Post: 02/22 06:46PM by Admin
all in one link and the link only goes to comment.

Can't see it well here, but go to KenoshaOnline.net and see what I mean.
John Nordquist, Applications Specialist, medical Technologies
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
Quote by jnordquist: I am having a problem with the rating system and comments.

When no comments are on a story, the rating works. First comment left, and this happens:

1 commentsCurrent Rating:
Rate Story: [1] [2] [3] [4] [5]
Most Recent Post: 02/22 06:46PM by Admin
all in one link and the link only goes to comment.

Can't see it well here, but go to KenoshaOnline.net and see what I mean.


I had alook at your site but could not see what you are talking about, it looked alright. But you could try
before the rating script in your featuredstorybodytext and storybodytext to separate the comment and ratings.
I tried to rate a story on your site and got a sql error message? You might need to address this.

Question Where did you obtain the games for your site? They are a nice addition.
Hope this was helpful

Regards

Kev Very Happy
Live everyday as if it was your last!
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
Quote by k74:I was wondering if it is possible to recognise the user id instead of the ip address to prevent users rating an article twice?


try using $_USER['uid'] in place of whatever is getting the ip. of course the script will have to gain access to that info ( global $_USER; ) if it doesn't already have access.

hope that helps
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
Thanks Machinari I will give it a try.
Live everyday as if it was your last!
 Quote

Status: offline

k74

Forum User
Full Member
Registered: 19/09/04
Posts: 128
Location:Australia
determined
Quote by machinari:
Quote by k74:I was wondering if it is possible to recognise the user id instead of the ip address to prevent users rating an article twice?


try using $_USER['uid'] in place of whatever is getting the ip. of course the script will have to gain access to that info ( global $_USER; ) if it doesn't already have access.

hope that helps


Banging your head I tried this but it made no difference. It kept recognising all users the same. I replaced the $REMOTE_ADDR; with $_USER['uid']: got a blank screen, replaced it with $_USER[username]:got SQL error, replaced it with '$_USER[uid]': it recognises all users the same as with $REMOTE_ADDR - from the following text line : Find if user already rated this item.
$exist = DB_query("SELECT * FROM $_TABLES[rating_records] WHERE id=$id AND ip='$REMOTE_ADDR'");


This is part of the code(that i think looks for previuos vote by users) that exists from the download file:
include('lib-common.php');
function submitrate($rfaction){
GLOBAL $id, $type, $rate, $rates, $_CONF, $_TABLES, $_USER; $REMOTE_ADDR;
$date = date("m-d-y");
if($rfaction == "update"){
//Find if user already rated this item.
$exist = DB_query("SELECT * FROM $_TABLES[rating_records] WHERE id=$id AND ip='$REMOTE_ADDR'");
if(DB_numRows($exist) > 0){
echo "Sorry, you have already voted.";
exit(0);
}else{
$date=date("y.m.d");
DB_query("UPDATE $_TABLES[ratings] SET type='$type',id=$id,totalvotes=totalvotes+1,totalratings=totalratings+$rate,rate=$rates WHERE id=$id");
DB_query("INSERT INTO $_TABLES[rating_records] (type,id,username,ip,rate,date) VALUES ('$type',$id,'$_USER[username]','$REMOTE_ADDR',$rate,'$date')");
}
}elseif($rfaction == "addnew"){
DB_query("INSERT INTO $_TABLES[ratings] (type,id,totalvotes,totalratings,rate) VALUES ('$type',$id,1,$rate,$rate)");
DB_query("INSERT INTO $_TABLES[rating_records] (type,id,username,ip,rate,date) VALUES ('$type',$id,'$_USER[username]','$REMOTE_ADDR',$rate,'$date')");
}else{
echo "Function not recognized.";
exit(0);
}
}
$ratingrecords2 = DB_query("SELECT * FROM $_TABLES[ratings] WHERE id=$id");
echo COM_siteHeader();
echo COM_startBlock('Rating Results');
Can someone help me
If any more suggestions on how to make it register user id instead of ip address, I would appreciate them. I know in Australian workplaces which my site will be used alot that most are on network systems which the way the rating system is set up at the moment I will be getting alot of error replies regarding users unable to rate an article. Thanks in advance for any suggestions.

Regards

Kev Very Happy
Live everyday as if it was your last!
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
you cant just replace remoteaddr with user... you have to query the proper table. you wont find a uid in the ip column of the ratings table, for example.


where does $id come from?
and is there any reason to keep remoteadder around at all if you are going to (are) working with the uid?

I don't know this script so I'm just shooting at the sky...
 Quote

Status: offline

GeeklogWorks

Forum User
Junior
Registered: 29/04/04
Posts: 24
I'll rework the rating system for 1.3.11. The updates came so fast that even I was caught offguard with the new issues for the rating system. I originally released so it could be built upon but now it needs some rewriting to keep up with the new versions. Please be paitent and I will get it up to snuff asap.
The only true Geeklog host with technical support! www.GeeklogWorks.com
 Quote

Status: offline

jbpaul17

Forum User
Chatty
Registered: 14/05/04
Posts: 49
Location:New York City
Any updates to the Rating System plugin as promised in February?
 Quote

Status: offline

newblogger

Forum User
Regular Poster
Registered: 22/08/04
Posts: 107
Location:Virginia Beach
I too, would like to see an updated version of the rating system
Got Hot wheels? http://www.dcmotoring.com
 Quote

Status: offline

emosmack

Forum User
Newbie
Registered: 07/06/06
Posts: 2
I've looked everywhere but I can't seem to find this
Install Read Me File:
7. Open your lib-common.php file in your public_html directory.
Look for the line
if( $index == 'n' )

Can anyone suggest anything? The rest seemed to work, when I click a rating I get:

"An SQL error has occurred. Please see error.log for details."

Log says:
Wed 07 Jun 2006 05:47:16 PDT - 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1. SQL in question: SELECT * FROM gl_ratings WHERE id=
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Quote by emosmack: 7. Open your lib-common.php file in your public_html directory.
Look for the line
if( $index == 'n' )

Can anyone suggest anything?

That piece of code is in system/lib-story.php now.

bye, Dirk
 Quote

Eddy

Anonymous
Hi guys

Think I've followed the instructions to a T, but am getting the following error :

Fatal error: Call to a member function on a non-object in /home/edwardtumath/public_html/sixhundred/system/lib-story.php on line 445

Wonder if anyone has a solution. Can't for one minute think what the problem could be.

Thanks
 Quote

All times are EST. The time is now 05:49 pm.

  • 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