Pages (2): 1 2   
Member
Member
thinkdreams   04-01-2007, 15:53
#1

Rating Hack Tutorial:

  1. Obtain zip file copied from original funbox.ro archive (which is no longer there, which is why I zipped the files up and supplied them here.)
    a. Read through the readme file included with the original archive. This is the original readme from the funbox.ro site.
  2. Expand zip file to a temporary directory.
  3. Edit the _config_rating.php file with your DB parameters to connect to your zenphoto DB
  4. About line 38 in the _drawrating.php file, you'll want to edit the path to be the absolute path to your zenphoto installation.
  5. Add these lines to your image.php file:

HEAD Section

Member
Member
jayray999   04-01-2007, 19:03
#2

Good work but it does not work for me.

  1. mySQl gave errors so I had to run this query instead of yours:
    CREATE TABLE ratings (
    id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    total_value INT( 11 ) NOT NULL DEFAULT '0',
    total_votes INT( 11 ) NOT NULL DEFAULT '0',
    used_ips LONGTEXT NOT NULL
    ) ENGINE = MYISAM ;

  2. Everything else was setup as you said except in image.php I had to specify the path of

Member
Member
thinkdreams   04-01-2007, 19:45
#3

@jay-

since it was a hack made by a zenphoto poster whose site was down for others, and I grabbed it, i figured i'd post it. but i can't guarantee it works in everyone's implementation, since I haven't tested it at all on anyone's install.

everyone else is welcome to post here and help us work out the bugs, as I'm sure there are some.

You may try initializing the SQL table with some data first, before voting. It does mention something about that in the readme file.

Member
Member
jayray999   04-01-2007, 20:29
#4

No problem, but I will post anyway if someone has an idea. I made some changes but no luck so far. I ran a new SQL query

'CREATE TABLE ratings (
id VARCHAR( 11 ) NOT NULL ,
total_value INT( 11 ) NOT NULL DEFAULT '0',
total_votes INT( 11 ) NOT NULL DEFAULT '0',
used_ips LONGTEXT NULL ,
PRIMARY KEY ( id )
) ENGINE = MYISAM AUTO_INCREMENT =3;'

This ran and then I initialized by running.

'INSERT INTO clientz_ratings ( id , total_value , total_votes , used_ips )
VALUES (
'1', '0', '0', NULL
), (
'2', '0', '0', NULL
);'

The paths seem ok to me. Everything runs fine (i.e. no errors) except the vote does not register!!

Member
Member
jayray999   04-01-2007, 20:49
#5

Also what does this paragraph in the README file mean?

I did away with the INSERT statement, because someone could get the db.php href and alter that (though not the rating or the IP) to add a new line into your db. I couldn't figure out a decent way to check that. So, at least for now, any new raters placed on a page have to be entered in your db manually, before votes can be registered to that id.

Is this the source of my troubles?

Member
Member
jayray999   04-01-2007, 21:40
#6

Yup, it is the insert and initialize thing. So I added the following line into the _drawrating.php file and all is well!!!!

After the line:

$query=mysql_query("SELECT total_votes, total_value, used_ips FROM $tableName WHERE id='$id' ")or die(" Error: ".mysql_error());

Add:

if (mysql_num_rows($query) == 0) {
$sql = "INSERT INTO $tableName (id,
total_votes, total_value, used_ips)
VALUES ('$id', '0', '0', '')";
$result = mysql_query($sql);
}

And it works.

Of course, on this forum I can never get code to show up accurately so I don't know but believe me this works. Of course I wonder if the original reason for avoiding the INSERT command in favor of manual insert is still valid. Any thoughts anybody?

Member
Member
jayray999   04-01-2007, 21:46
#7

Just to give credit where it is due...here is the big forum on how to use this rating system: http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/

Comment number 12. WaxOr is what helped.

Others have done things like most popular etc.

Member
Member
thinkdreams   04-01-2007, 21:59
#8

@jay-

did you do line #4 on my tutorial? I noted that in the drawrating file, I had to COMPLETELY hardcode the URL to get it to work:

[*] out of " class="r-unit rater">

Thus, http://www.thinkdreams.com/zenphoto/themes/thinkdreams_photoblog would be what I would use in my case. That might be causing your issue.

Member
Member
thinkdreams   04-01-2007, 22:01
#9

sorry, i was composing my response after you had posted, and I didn't refresh.... Glad to see it working.

Member
Member
jayray999   04-01-2007, 22:18
#10

So do you think the INSERT INTO $tableName solution is a bad idea? If so, I might try your URL instead of SERVER PATH suggestion. BTW, thanks a lot for everything.

Now for some cool icons...I think the stars (starrating.gif) are much nicer but they come with a rectangular white background block that does not take kindly to transparency. On the masugadesign.com page they tell you how to design custom icons.

Member
Member
thinkdreams   04-01-2007, 22:37
#11

if you look in the images dir, i started on a psd template of my own that i use, that you can model from if you like.

Member
Member
SubJunk   04-01-2007, 22:55
#12

Great stuff guys, with all the changes in this discussion it works perfectly!

Member
Member
jayray999   04-01-2007, 23:00
#13

Oh great. Very thoughtful.

Member
Member
jayray999   04-01-2007, 23:33
#14

I just tried without the INSERT mod and even with a complete URL and manual database initialization it does not work for me. So back to INSERT and all that comes with it.

Member
Member
thinkdreams   05-01-2007, 00:05
#15

hmm. what i can't understand is why some installations it works, and on some it doesn't. seems to be ok for subjunk.

@subjunk, is there anything possibly different about your install that you could share that might help jayray out?

and mod_rewrite is off right now on yours jayray right?

Member
Member
jayray999   05-01-2007, 00:18
#16

No mod_rewrite is ON. I thought you dismissed that as a possible cause. Anyway, as long as the INSERT command is not terribly insecure I don't mind running it so.

Member
Member
jayray999   05-01-2007, 00:22
#17

No mod_rewrite is ON. I thought you dismissed that as a possible cause. Anyway, as long as the INSERT command is not terribly insecure I don't mind running it so.

Member
Member
thinkdreams   05-01-2007, 00:26
#18

mod_rewrite needs to be off. then it should work. (at least from what i've found). since most people's 1.0.6 installations are going to be non-mod_rewrite to use subalbums anyway, I assumed where I should have explicitly stated it in the instructions. I apologize for that oversight.

Try it without mod_rewrite just for kicks. The problem is that the db.php call in the drawrating file is coded for a specific url and parameters, and it will get messed around with mod_rewrite. There may be a way to fix it in the mod_rewrite statements but I'm not sure how to go about that.

Member
Member
jayray999   05-01-2007, 00:28
#19

Ok. I will experiment and let you know.

Member
Member
thinkdreams   05-01-2007, 00:29
#20

Cool. Thanks Jay for testing too.

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.