Welcome to Geeklog, Anonymous Thursday, December 26 2024 @ 08:51 am EST
Geeklog Forums
Rating System
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
Live everyday as if it was your last!
14
12
Quote
Status: offline
k74
Forum User
Full Member
Registered: 09/19/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
Live everyday as if it was your last!
Regards
Kev
Live everyday as if it was your last!
13
16
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/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
but if you hacked that function, you prolly need to apply your code to STORY_renderArticle now.
hth
13
13
Quote
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
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
Live everyday as if it was your last!
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
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
Live everyday as if it was your last!
15
13
Quote
Ok
Anonymous
Anonymous users have the same user id
13
9
Quote
Status: offline
k74
Forum User
Full Member
Registered: 09/19/04
Posts: 128
Location:Australia
Quote by k74: QUOTE:
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
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
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
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!
15
13
Quote
Status: offline
jnordquist
Forum User
Full Member
Registered: 03/14/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:
Can't see it well here, but go to KenoshaOnline.net and see what I mean.
John Nordquist,
Applications Specialist, medical Technologies
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. Rate Story: [1] [2] [3] [4] [5]
Most Recent Post: 02/22 06:46PM by Admin
Can't see it well here, but go to KenoshaOnline.net and see what I mean.
John Nordquist,
Applications Specialist, medical Technologies
11
14
Quote
Status: offline
k74
Forum User
Full Member
Registered: 09/19/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:
Can't see it well here, but go to KenoshaOnline.net and see what I mean.
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. Rate Story: [1] [2] [3] [4] [5]
Most Recent Post: 02/22 06:46PM by Admin
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.
Where did you obtain the games for your site? They are a nice addition.
Hope this was helpful
Regards
Kev
Live everyday as if it was your last!
13
16
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/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
16
17
Quote
Quote by machinari:
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 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
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');
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
Live everyday as if it was your last!
11
17
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/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...
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...
14
12
Quote
Status: offline
GeeklogWorks
Forum User
Junior
Registered: 04/29/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
The only true Geeklog host with technical support! www.GeeklogWorks.com
14
12
Quote
Status: offline
newblogger
Forum User
Regular Poster
Registered: 08/22/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
Got Hot wheels? http://www.dcmotoring.com
13
12
Quote
Status: offline
emosmack
Forum User
Newbie
Registered: 06/07/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=
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=
11
12
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/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?
Look for the line
if( $index == 'n' )
Can anyone suggest anything?
That piece of code is in system/lib-story.php now.
bye, Dirk
14
18
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
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
14
17
Quote
All times are EST. The time is now 08:51 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