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

0 Members and 1 Guest are viewing this topic.

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #75 on: February 11, 2006, 12:07:47 AM »
Go to your DB (4images_XX) , there 4images_voted , and after choose "browse" , there you have a list of votes ;)

I've put as prefix 4images, maybe you've another one...but i hope you've understand (sorry for my english)

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 #76 on: February 11, 2006, 12:09:12 AM »
MySQL query:[qcode]DELETE FROM 4images_voted WHERE user_id = XXX[/qcode]where XXX is user id.

And yes, the code above will restrict voting for the same image from same IP, it will not work for guests though.
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 TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #77 on: February 11, 2006, 06:11:49 PM »
cheribibi, V@no... thanks!!  :D

One more questions.
Is it correct, that the dropdownlist is not activ because of the DB entry, but the voting (e.g. 5) is shown becaus of a cookie?.
When I delete the cookies, the dropdown is not activ (perfect), but the voting isn't shown anymore.

Is it possible to show the voting stored in the DB?

Thanks!!

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 #78 on: February 11, 2006, 06:27:44 PM »
I just updated cheribibi's post (hope they dont mind ;))
replace
Code: [Select]
  $image_rated = (isset($row['vote']))? $row['vote'] : 0 ;with:
Code: [Select]
  $rating = (isset($row['vote']))? $row['vote'] : 0 ;
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 TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #79 on: February 11, 2006, 06:51:09 PM »
Hi V@no,

now the MOD is perfect for me!

Again, thanks to you an cheribibi!   :D

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #80 on: February 11, 2006, 07:05:53 PM »
I'm using the Version A , and i would like know how make only possible see "who Voted" for Admin's ? For Another Users make show "You've No Permission"  :mrgreen:


 :wink:

Anyone can answer me ?  :roll:


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 #81 on: February 11, 2006, 07:16:55 PM »
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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #82 on: February 11, 2006, 07:37:27 PM »
http://www.4homepages.de/forum/index.php?topic=6123.45

But how make appear a message for non-admin's " You've no permission ... "   :?

Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #83 on: February 12, 2006, 01:43:02 PM »
for Admin use:

$vote = ($user_info['user_level'] == ADMIN) ? " (".$row['vote'].")" : "";

for User use:

$vote = ($user_info['user_level'] == USER) ? " (".$row['vote'].")" : "";

and for Admin and User:

???

Sorry i dont no  :?
4images in Benutzung/use seit/since 2002 / Version 1.7.6

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [MOD] Votes saved in DB
« Reply #84 on: February 12, 2006, 03:02:41 PM »
http://www.4homepages.de/forum/index.php?topic=6123.45

But how make appear a message for non-admin's " You've no permission ... "   :?

try to replace this code :
Code: [Select]
while ($row = $site_db->fetch_array($result))
{
  $vote = ($user_info['user_level'] == ADMIN) ? " (".$row['vote'].")" : "";
  $voted_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['user_id'])."\">".$row['user_name']."</a>".$vote."<br />"; //member name WITH a link to their profile page
//  $voted_list .= $row['user_name'].$vote."<br />"; //member name WITHOUT a link to their profile page
}
by this one :
Code: [Select]
if ($user_info['user_level'] == ADMIN) {
  while ($row = $site_db->fetch_array($result))
  {
    $vote = $row['vote'];
    $voted_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['user_id'])."\">".$row['user_name']."</a>".$vote."<br />"; //member name WITH a link to their profile page
  //  $voted_list .= $row['user_name'].$vote."<br />"; //member name WITHOUT a link to their profile page
  }
} else {
  $voted_list .= "You have no permission!" // or anything you want
}
ch€ri{Bi}²


Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #85 on: February 12, 2006, 03:04:41 PM »
@cheribibi:

Quote

if ($user_info['user_level'] == ADMIN) {
  while ($row = $site_db->fetch_array($result))
  {
    $vote = $row['vote'];
    $voted_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row[$user_table_fields['user_id']])."\">".$row[$user_table_fields['user_name']]."</a>".$vote."<br />"; //member name WITH a link to their profile page
  //  $voted_list .= $row[$user_table_fields['user_name']]. $vote."<br />"; //member name WITHOUT a link to their profile page
  }


And :

Quote

$voted_list .= "You have no permission!" // or anything you want


to :

Quote

$voted_list .= $lang['no_permission']; // or anything you want


This text has already been added as part of the core in 4images's lang/english/main.php definition file. ;)
« Last Edit: February 12, 2006, 03:56:33 PM by TheOracle »

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [MOD] Votes saved in DB
« Reply #86 on: February 12, 2006, 03:34:26 PM »
@cheribibi:

Quote

if ($user_info['user_level'] == ADMIN) {
  while ($row = $site_db->fetch_array($result))
  {
    $vote = $row['vote'];
    $voted_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;URL_USER_ID."=".$row[$user_table_fields['user_id']])."\">".$row[$user_table_fields['user_name']]."</a>".$vote."<br />"; //member name WITH a link to their profile page
  //  $voted_list .= $row[$user_table_fields['user_name']]. $vote."<br />"; //member name WITHOUT a link to their profile page
  }



@TheOracle
well, the code I post was a copy/paste of another code this the topic. please can you also correct all the other codes in this thread ? thanks ! :mrgreen:
ch€ri{Bi}²


Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #87 on: February 12, 2006, 03:57:55 PM »
@Daniel:

Perhaps you're looking for this :

Code: [Select]

for User use:

$vote = ($user_info['user_level'] >= USER) ? " (".$row['vote'].")" : "";


;)

Offline glitzer

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • over 7000 E-Cards
Re: [MOD] Votes saved in DB
« Reply #88 on: February 12, 2006, 05:10:03 PM »
 :Dworks perfect thank you very much!

Offline wallpapers

  • Full Member
  • ***
  • Posts: 107
    • View Profile
    • Tuned-Cars.Net
Re: [MOD] Votes saved in DB
« Reply #89 on: February 12, 2006, 05:29:41 PM »
I have made a plugin so you can view whitch member had voted in witch file.
My programming and my englisch are not good i know.

You can change a lot on this file. (it's a start for me  :lol:)

This is the code
Code: [Select]
<?php // PLUGIN_TITLE: voted

$nozip 1
define('IN_CP'1); 

$root_path "./../../"
define('ROOT_PATH'$root_path); 
require(
ROOT_PATH.'admin/admin_global.php'); 
show_admin_header(); 

function 
display_results() { 
  global $site_db
  
$sql 
'SELECT * FROM `4images_voted` LIMIT 0, 30 ';
  $result $site_db->query($sql); 
  while($row $site_db->fetch_array($result)){ 
    $user_id $row["user_id"]; 
    $postcard_date date("D d M, Y g:i a"$row["postcard_date"]); 
    $image_id $row["image_id"];
    $image_name $row["image_name"]; 
    $image_thumb_file $row["image_thumb_file"]; 
    $cat_id $row["cat_id"]; 
    $postcard_headline $row["postcard_headline"]; 
    $postcard_message $row["postcard_message"]; 
 
    
    $postcard_sender_name 
$row["postcard_sender_name"]; 
    $postcard_sender_email $row["postcard_sender_email"]; 
    $postcard_recipient_name $row["vote"]; 
    $postcard_recipient_email $row["postcard_recipient_email"]; 
    
    $cat_id 
$row['cat_id'];
    $pict_id get_media_code($row['image_media_file'], $image_id$cat_id$row['image_name']);
    $image_media_file get_media_code($row['image_media_file'], $image_id$cat_id$row['image_name']); 
    $template TEMPLATE_PATH
    
    
echo 
          
<font color=\"#000000\" size=\"1\"></td>
   </tr>
</tbody>
</table></td>
   </tr>
</tbody>
</table>
        <table border=\"1\">
                <tr>
                        <td height=\"15\" width=\"119\" align=\"center\" bgcolor=\"#E5E5E5\">
                        <p align=\"center\"><b>Gebruiker</b></td>
                        <td height=\"15\" width=\"148\" align=\"center\" bgcolor=\"#E5E5E5\"><b>
                        Cijfer</b></td>
                        <td height=\"15\" width=\"286\" align=\"center\" bgcolor=\"#E5E5E5\"><b>
                        Wallpaper</b></td>
                </tr>
                <tr>
                        <td height=\"21\" width=\"119\" align=\"center\" bgcolor=\"#F5F5F5\">
                        <font color=\"#000000\" size=\"2\" face=\"Tahoma\" >
$user_id</td>
                        <td height=\"21\" width=\"148\" align=\"center\" bgcolor=\"#F5F5F5\">
                        <font face=\"Tahoma\">  <font color=\"#000000\" size=\"2\" >
                        
$postcard_recipient_name</font><font size=\"2\">  </font>  <font color=\"#000000\" size=\"1\" >
                <a href=\"mailto:
$postcard_recipient_email\">
                        <font color=\"#000000\" size=\"2\">
$postcard_recipient_email</a></font></td>
                        <td height=\"21\" width=\"286\" align=\"center\" bgcolor=\"#F5F5F5\">
                        <font color=\"#555555\" size=\"2\" face=\"Tahoma\" >
&nbsp;(<a href=\"../../details.php?image_id=
$image_id\" target=\"_blank\">ID: $image_id</a>)
&nbsp;</font></td>
                </tr>
        </table>\n"
;
END;  


display_results(); 
show_admin_footer(); 
?>


Yes i change a other plugin to get this.
I enybody has a better code  8)