Author Topic: Number of Own Images in MySQL  (Read 19900 times)

0 Members and 1 Guest are viewing this topic.

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Number of Own Images in MySQL
« on: April 08, 2005, 12:01:18 AM »
Hi there,

ma Question is:

Where can i find the Number of my own images in the mySQL Database????

I will put in an Top Uloader Mod but i can´t find the Numer of my Images....

i have no users_t_images
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad 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: Number of Own Images in MySQL
« Reply #1 on: April 08, 2005, 12:25:58 AM »
there is no field that stores your images.
u will have to "calculate" them:
Code: [Select]
SELECT COUNT(image_id) as num FROM 4images_images WHERE user_id = XX(where XX is the user id) and the number of images will be returned as "num"
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 JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Number of Own Images in MySQL
« Reply #2 on: April 08, 2005, 12:39:11 AM »
mmh,

now i have become the Mod Top 10 Uploader from a User. It called...

open index.php

insert

Code: [Select]
//-----------------------------------------------------
 //--- Top 10 Uploader --------------------------------
 //-----------------------------------------------------
 $sql = "SELECT user_t_images, user_name, user_id FROM ".USERS_TABLE."
               WHERE user_level >= '".GUEST."'
                 ORDER BY user_t_images DESC
               LIMIT 10";
     $result = $site_db->query($sql);
 
     while ($row = $site_db->fetch_array($result)) {
     $user_uploaders_list .= '&nbsp;&nbsp;<a href ="'.ROOT_PATH.'member.php?action=showprofile&user_id='.$row['user_id'].'">'.$row['user_name'].'</a> <span class="smalltext">('.$row['user_t_images'].')</span><br>';
     }
 
 $user_uploaders_box = $site_template->parse_template("user_uploaders_box");
 $site_template->register_vars(array(
   "user_uploaders_box" => $user_uploaders_box,
   "user_uploaders_list" => $user_uploaders_list
 ));
   unset($user_uploaders_box);
   unset($user_uploaders_list);

create a template called user_uploaders_box.html and insert this

Code: [Select]
{user_uploaders_list}
in home.html insert

Code: [Select]
{user_users_box}
But i have not the user_t_images table. I search for a way to see the top uploader...
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad 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: Number of Own Images in MySQL
« Reply #3 on: April 08, 2005, 12:50:59 AM »
here is your mysql query:
Code: [Select]
$sql = "SELECT COUNT(i.image_id) as user_t_images, u.user_name, u.user_id
        FROM ".USERS_TABLE." u
        LEFT JOIN ".IMAGES_TABLE." i ON (i.user_id = u.user_id)
        WHERE u.user_level >= ".GUEST."
        GROUP by u.user_id
        ORDER BY user_t_images DESC
        LIMIT 10";
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 JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Number of Own Images in MySQL
« Reply #4 on: April 08, 2005, 01:11:49 AM »
Thanks a lot. Now it works...
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline karimun

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • http://www.at6pm.com
Re: Number of Own Images in MySQL
« Reply #5 on: April 26, 2005, 08:02:00 PM »
When I click the members name the profile page is displayed in the default language (not in the language the user has choosen before) and there is also no sessionid appended to the url which leads to the profile page.

My mysql query in page_header.php is:
Code: [Select]
$sql = "SELECT user_t_images, user_name, user_id FROM ".USERS_TABLE."
WHERE user_level >= '".USER."'
ORDER BY user_t_images DESC
LIMIT 5";
$result = $site_db->query($sql);

while ($row = $site_db->fetch_array($result)) {
$last_action_user_list .= '<a href ="'.ROOT_PATH.'member.php?action=showprofile&user_id='.$row['user_id'].'"><b>'.$row['user_name'].'</b></a> <span class="smalltext">'.$row['user_t_images'].'</span><br>';
}

$site_template->register_vars(array(
"user_uploaders_list" => $last_action_user_list,
));
unset($user_uploaders_list);

What must be changed?

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: Number of Own Images in MySQL
« Reply #6 on: April 27, 2005, 12:20:38 AM »
When I click the members name the profile page is displayed in the default language (not in the language the user has choosen before)
that's because u entered the text directly into template, not registered it as a tag?

and there is also no sessionid appended to the url which leads to the profile page.
Replace:
Code: [Select]
$last_action_user_list .= '<a href ="'.ROOT_PATH.'member.php?action=showprofile&user_id='.$row['user_id'].'"><b>'.$row['user_name'].'</b></a> <span class="smalltext">'.$row['user_t_images'].'</span><br>';with this:
Code: [Select]
$last_action_user_list .= '<a href ="'.$site_sess->url(ROOT_PATH.'member.php?action=showprofile&user_id='.$row['user_id']).'"><b>'.$row['user_name'].'</b></a> <span class="smalltext">'.$row['user_t_images'].'</span><br>';
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 karimun

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • http://www.at6pm.com
Re: Number of Own Images in MySQL
« Reply #7 on: April 27, 2005, 07:20:46 PM »
V@no, thank you for the sessionid help.

Quote
that's because u entered the text directly into template, not registered it as a tag?

Sorry, what you mean with text?

the mysql query is in page_header.php.
created user_uploaders_box.html with {user_uploaders_list} in it.
I call the mod from my home.html with {user_uploaders_list}.

Whats wrong?
v1.7.1

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: Number of Own Images in MySQL
« Reply #8 on: April 28, 2005, 01:37:49 AM »
I dont know what is wrong...the mod does NOT print any words, only a number, that's all...what text are u talking about?

[EDIT]
ah, I think I know what u ment. The fix I provided for sessionid is also should fix the language issue.
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 ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Number of Own Images in MySQL
« Reply #9 on: April 28, 2005, 03:55:23 AM »
here is your mysql query:
Code: [Select]
$sql = "SELECT COUNT(i.image_id) as user_t_images, u.user_name, u.user_id
        FROM ".USERS_TABLE." u
        LEFT JOIN ".IMAGES_TABLE." i ON (i.user_id = u.user_id)
        WHERE u.user_level >= ".GUEST."
        GROUP by u.user_id
        ORDER BY user_t_images DESC
        LIMIT 10";

Hi I have run this query and i get an error my prefix is girls_ how can I modify this to run it?

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: Number of Own Images in MySQL
« Reply #10 on: April 28, 2005, 03:59:43 AM »
what error messages? run where?
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 ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Number of Own Images in MySQL
« Reply #11 on: April 28, 2005, 04:41:16 AM »
sorry  :oops: :oops: :oops: I thougth that that codo was a query to run in PHPmy admin hehehe i'm stupid.

Please can any body put step by step what I have to do to get the top uploader list? cuz I have done what karimun said and I don't gae it to work

Offline karimun

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • http://www.at6pm.com
Re: Number of Own Images in MySQL
« Reply #12 on: April 28, 2005, 02:14:47 PM »
ascanio:
have you created your user_t_images field in the database ?
The code I posted was from a thread which I don´t find anymore since the hack attack.
If you need more details I will try to help you although I´m not the crack.

V@no:
your solution for the sessionID was not successful. Any other idea?

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: Number of Own Images in MySQL
« Reply #13 on: April 28, 2005, 02:39:46 PM »
your solution for the sessionID was not successful. Any other idea?
then I didnt understand you...
would u explain it more detailed?
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 ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Number of Own Images in MySQL
« Reply #14 on: April 28, 2005, 06:10:50 PM »
Hi I have follow all the steps and I have add the user_t_images field in the database but is not working could u post what u did step by step?