Author Topic: [MOD] Votes saved in DB  (Read 245058 times)

0 Members and 1 Guest are viewing this topic.

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Votes saved in DB
« Reply #150 on: December 14, 2007, 06:08:53 PM »
i thing, it is not working  :wink:


KurtW

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: [MOD] Votes saved in DB
« Reply #151 on: December 14, 2007, 06:14:17 PM »
oh yeah it is. you have to use the code in the thread vom V@no of course. and after that: use my piece and put it in rating_new.php.

notice: i have only members allowed to vote, so it is possible to save username, id, voting and a lot more ;)
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Votes saved in DB
« Reply #152 on: December 14, 2007, 06:18:01 PM »
sorry, but i thing no...

you use a old mode code.

in rating_new.php:

search:
Code: [Select]
        if (($vote_sent >= 1 && $vote_sent <= $units)) {
                $update = "UPDATE " . IMAGES_TABLE . " SET image_votes='".$count_new."', image_rating='".$sum_new."', image_used_ips='".$ip."', image_used_ids='".$old_used_ids."".$leer."".$new_used_id."' WHERE image_id='" . $image_id_sent . "'";
                $result = $site_db->query($update);

after this code you can add the new code from c-bass


Kurt

Offline davy_74

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Problem deleting images and Ctegories in [MOD] Votes saved in DB - Option A
« Reply #153 on: December 26, 2007, 04:04:26 PM »
Hey guys

I already installed the [MOD] Votes saved in DB. I use Option A. I use a table called "voted" to store the image_id, the user_id, vote, and user_IP. The problem is when I delete an image or an entire category, it's ok. 4images delete the records in the images table, but doesn't delete the record in the voted table. How can we repair this?

I looked for the code to delete the image

  $sql = "DELETE FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $del_img = $site_db->query($sql);


and the code to delete the comments

  $sql = "DELETE FROM ".COMMENTS_TABLE."
          WHERE image_id = $image_id";
  $del_com = $site_db->query($sql);

We should add something like this somewhere  (I don't know how) -- PLease Help

  $sql = "DELETE FROM ".VOTED_TABLE."
          WHERE image_id = $image_id";
  $del_img = $site_db->query($sql);

In ACP we should do something too.

Need some help from the author and the good programmers here to solve this.

Cheers

David

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: [MOD] Votes saved in DB
« Reply #154 on: December 26, 2007, 05:01:32 PM »
the same goes for deleting users. the user votes also have to be deleted.
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline davy_74

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #155 on: December 26, 2007, 06:44:26 PM »
Yes, c-bass you are right. But the problem I have is where to put the code. I know MySQL but I'm a newbie in PHP coding.
I need some help

Cheers

David


Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #156 on: December 31, 2007, 04:54:58 PM »
David... i think in admin/users.php

and delete the user...not the images  :wink:

       $sql = "DELETE FROM ".VOTED_TABLE."
          WHERE user_id = $user_id";
       $site_db->query($sql);
« Last Edit: January 02, 2008, 12:00:03 AM by Daniel »
4images in Benutzung/use seit/since 2002 / Version 1.7.6

Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #157 on: January 01, 2008, 03:07:48 PM »
 :?:

Wie müßte bloß die sql-Abrafe lauten wenn man nur die neuen Votes aus dem VOTED_TABLE errechnen und in den images_table damit updaten wollen würde...

How can i use only new new votes (just from voted_table) to inset this in the image_table

 :?:


a happy new year  :wink:
4images in Benutzung/use seit/since 2002 / Version 1.7.6

Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #158 on: January 08, 2008, 06:22:37 PM »
Du kannst für jede einzelne Kategorie angeben wer voten darf... ACP -> Kategorien bearbeiten
4images in Benutzung/use seit/since 2002 / Version 1.7.6

skiemor

  • Guest
Re: [MOD] Votes saved in DB
« Reply #159 on: January 12, 2008, 08:44:31 AM »
From Configuration statistics.php "Note: Save Votes in DB type A must be installed and altered by votetime"
http://www.4homepages.de/forum/index.php?topic=6123.0

How to do that?

In der statistics.php ist der Tabellenname VOTED_TABLE vorgegeben.
Meine Tabelle heißt aber 4images_voted und da wird auch alles reingeschrieben. Zumindest wird eine Statistik erstellt
Die VOTED_TABLE ist leer.


Die Tabelle wird in der statistics.html angzeigt, wenn ich die Funktion aktiviere (1 statt 0).

Chris
« Last Edit: January 12, 2008, 12:04:14 PM by skiemor »

skiemor

  • Guest
Re: [MOD] Votes saved in DB
« Reply #160 on: January 12, 2008, 11:19:11 AM »
Ich habe jetzt einfach mal testweise bei den Bildern ein Datum (1200055080) eingetragen.
In der Statistik werden die Votes dann gezählt.
Neue Bewertungen werden aber nicht dazugezählt. ;-(

Ich glaube, dass die Anpasssung fehlt: "Note: Save Votes in DB type A must be installed and altered by votetime".
http://www.4homepages.de/forum/index.php?topic=6123.0

Kann mir jemand dabei helfen?

Chris.
« Last Edit: January 12, 2008, 12:04:41 PM by skiemor »

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [MOD] Votes saved in DB
« Reply #161 on: April 01, 2008, 09:32:57 PM »
Hallo!

Ich habe den MOD Votes saved in DB - Option A installiert und versuchte die IP-Adresse zu speichern beim Berwerten.
Dazu machte ich folgendes:

DB-Code:
Code: [Select]
ALTER TABLE 4images_voted ADD vote_ip VARCHAR( 15 ) NOT NULL
includes/functions.php
Suche:
Code: [Select]
$sql = "INSERT INTO ".VOTED_TABLE."
        (user_id, image_id, vote)
        VALUES
        (".$user_info['user_id'].", ".$image_id.", ".$rating.")";

Ersetze mit:
Code: [Select]
global $site_sess;
$sql = "INSERT INTO ".VOTED_TABLE."
        (user_id, image_id, vote, vote_ip)
        VALUES
        (".$user_info['user_id'].", ".$image_id.", ".$rating.", ".$site_sess->user_ip.")";

Jedoch dies alles funktionierte nicht.
Es stand nur "NULL" in "vote_ip". "global $site_sess;" vergass ich nicht...

Ich versuchte auch mit "$session_info['session_ip']" anstatt mit "$site_sess->user_ip".

Könntet ihr mir bitte weiterhelfen.
Vielen Dank
Gruss Jones


4images: 1.7.6
Php Version: 4.4.7

Offline cliff

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #162 on: January 14, 2009, 11:31:48 AM »
Hallo,

der MOD interessiert mich sehr, allerdings ist der Link zur Installationsdatei von Seite 1 nicht mehr aktuell. Hat hier jemand noch diese Datei oder den entsprechenden sql Befehl... ???

__________

I am very interested of this Mod, but the link to the installer at side 1 isn´t active. Has here anyone the file or the sql order...???

Besten Dank
ThanX
cliff

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Votes saved in DB
« Reply #163 on: January 14, 2009, 04:35:03 PM »
all needed files are attached to the original post:
http://www.4homepages.de/forum/index.php?topic=6123.msg26633#post_attach
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline cliff

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #164 on: January 14, 2009, 06:06:43 PM »
ohhh... call me an idiot!  I didn´t see that file... Now it´s running wonderful!
ThanX a lot...

best regards
cliff