Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Egly

Pages: [1]
1
Hi!

I have used the search, but i haven´t found it...
I think i have seen here a MOD which allows to post comments under a Members-Profile.

Has anybody a link for me?

Thanks,

Bastian

2
Mods & Plugins (Releases & Support) / Small Credit "System" "MOD"
« on: September 25, 2005, 12:39:44 AM »
Hi!

At first i have to say, that i cant guarantee, that this mod will work for everybody.
The Reason: I started PHP "coding" three days ago and my whole experience on this comes from 4images installing and modifying...  :mrgreen:
I dont know if it is coded correctly so the real coders may laugh at me but it works for me and that is all i wanted :D

Make BACKUP of all files !

The Mod:

It counts your user´s comments, posts in forum (optional), uploaded images and the image quality (from votes).
For comments users get 5 points, for posts 5 points for uploaded images 5 pts and for and the average image quality multiplyed with 25 = points for quality.
For 50points they get an extra upload.
For example: Standard 20 uploads
Points = 264
Extra Uploads: 5
Global uploads: 25  :mrgreen:

If users want more uploads, they must be active in your galery...

Mods needed:

User Upload Limits                       http://www.4homepages.de/forum/index.php?topic=3607.msg14765#msg14765
Dreamboard 2.1 (optional)            http://www.4homepages.de/forum/index.php?topic=9598.msg45950#msg45950

1. Step:

go to myphpadmin and make the following entry in  4images_users:

field: user_global_limit
type: smallint(3)
Null: No
Standard: 20                                     //here you can change the standard "global uploads"
(radio button click on):  ---                 (dont know how it is called ;-))

2. Step:

Make file: credits.php in your 4images folder and insert (make changes where i commented out):

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: credits.php                                          *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
$main_template "credits";

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

$user_id $user_info['user_id'];
$user_name $user_info['user_name'];



if (
$user_info['user_level'] >= USER) {
$sql "SELECT user_comments AS comments
         FROM "
.USERS_TABLE."
         WHERE  "
.get_user_table_field("""user_id")." = $user_id";
 
$row $site_db->query_firstrow($sql);
$comments = (isset($row['comments'])) ? $row['comments'] : 0;
 
$user_pscomments "<B> ".$row['comments']."</B>\n";
 
$site_template->register_vars("user_pscomments"$user_pscomments);



$sql2 "SELECT COUNT(image_id) AS totimg
         FROM "
.IMAGES_TABLE."
         WHERE  "
.get_user_table_field("""user_id")." = $user_id";
 
$row2 $site_db->query_firstrow($sql2);
$totimg = (isset($row2['totimg'])) ? $row2['totimg'] : 0;
 
$user_psimages "<B> ".$row2['totimg']."</B>\n";
 
$site_template->register_vars("user_psimages"$user_psimages);



$sql3 "SELECT user_posts AS posts
         FROM "
.USERS_TABLE."
         WHERE  "
.get_user_table_field("""user_id")." = $user_id";
 
$row3 $site_db->query_firstrow($sql3);
$posts = (isset($row3['posts'])) ? $row3['posts'] : 0;
 
$user_posts "<B> ".$row3['posts']."</B>\n";
 
$site_template->register_vars("user_posts"$user_posts);



$sql4 "SELECT round(avg(image_rating),2) AS rating 
FROM " 
.IMAGES_TABLE.
WHERE "
.get_user_table_field("""user_id")." = $user_id AND image_rating > 0";

 
$row4 $site_db->query_firstrow($sql4);
$rating = (isset($row4['rating'])) ? $row4['rating'] : 0;
if($row2['totimg'] <> 0) {
$psrating $row4['rating'];}
else {
$psrating="0";
 
}
 
$site_template->register_vars("psrating"$psrating);



$sql5 "SELECT user_global_limit AS globallimit
         FROM "
.USERS_TABLE."
         WHERE  "
.get_user_table_field("""user_id")." = $user_id";
 
$row5 $site_db->query_firstrow($sql5);
$limit = (isset($row5['globallimit'])) ? $row5['globallimit'] : 0;
 
$user_global_limitges $row5['globallimit'] ;
 
$site_template->register_vars("user_global_limitges"$user_global_limitges);



$sql6 "SELECT COUNT(image_rating) AS votedimages 
         FROM "
.IMAGES_TABLE."
         WHERE  "
.get_user_table_field("""user_id")." = $user_id AND image_rating > 0";
 
$row6 $site_db->query_firstrow($sql6);
$votedimages = (isset($row6['votedimages'])) ? $row6['votedimages'] : 0;
 
$user_votedimages $row6['votedimages'];
 
$site_template->register_vars("user_votedimages"$user_votedimages);





if ($row6['votedimages'] <> 0){
$ratingpointsround($row4['rating'] *25/$row6['votedimages'],0);  
}else{ 
$ratingpoints0;
}




$postpoints$row3['posts'] * 5; //Change points for posts here
$imagepoints$row2['totimg'] * 5; //Change points for images here
$commentpoints$row['comments'] * 5 //Change points for comments here
$totalpoints$commentpoints  $imagepoints $postpoints $ratingpoints;
$zusatzuploadsround($totalpoints/50,0);
$uploadsges$zusatzuploads 20;                                                                             //Change default global limit here
$restuploads=$uploadsges $row2['totimg'];





$sql "
UPDATE "
.USERS_TABLE."
SET user_global_limit = 20 + '
$zusatzuploads'
WHERE "
.get_user_table_field("""user_id")." = $user_id";
$site_db->query($sql);


}


$site_template->register_vars(array(
  
"user_psname" => $user_name,
  
"commentpoints" => $commentpoints,
  
"totalpoints" => $totalpoints,
  
"imagepoints" => $imagepoints,
  
"postpoints" => $postpoints,
  
"ratingpoints" => $ratingpoints,
  
"zusatzuploads" => $zusatzuploads,
  
"uploadsges" => $uploadsges,
  
"restuploads" => $restuploads
  
));
   



  
$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php'); 
?>

3. Step:

create new file called credits.html (in template folder) from your template and insert this table:

Code: [Select]
<table class="head1" width="600" border="0" cellspacing="0" cellpadding="10">
                              <tr>
                                <td width="367">Credits from  {user_psname} </td>
                                <td width="133">&nbsp;</td>
                              </tr>
                              <tr>
                                <td height="36">You have written {user_pscomments} comments and get: </td>
                                <td><div align="center">{commentpoints} Points</div></td>
                              </tr>
                              <tr>
                                <td height="24" colspan="2"><hr size="1"></td>
                                </tr>
                              <tr>
                                <td height="23">You have uploaded {user_psimages} Images and get for that:</td>
                                <td><div align="center">{imagepoints}  Points</div></td>
                              </tr>
                              <tr>
                                <td height="24" colspan="2"><hr size="1"></td>
                                </tr>
                              <tr>
                                <td height="20">You have posted {user_posts} Posts in the Forum and get: </td>
                                <td><div align="center">{postpoints} Points</div></td>
                              </tr>
                              <tr>
                                <td height="20" colspan="2"><div align="center">
                                  <hr size="1">
                                </div></td>
                                </tr>
                              <tr>
                                <td>Your images are rated with an average of {psrating}, and for this you get:</td>
                                <td><div align="center">{ratingpoints} Points </div></td>
                              </tr>
                               <tr>
                                <td height="20" colspan="2"><div align="center">
                                  <hr size="1">
                                  <hr size="1">
                                </div></td>
                                </tr>
                              <tr>
                                <td>Your Points:</td>
                                <td><div align="center">{totalpoints} </div></td>
                              </tr>
                              <tr>
                                <td>Additional Uploads for your points: </td>
                                <td><div align="center">{zusatzuploads}</div></td>
                              </tr>
                              <tr>
                                <td>Your global upload Limit (images) </td>
                                <td><div align="center">{uploadsges}</div></td>
                              </tr>
                              <tr>
                                <td>Your allready uploaded images: </td>
                                <td><div align="center">{user_psimages}</div></td>
                              </tr>
                              <tr>
                                <td>&nbsp;</td>
                                <td><div align="center"></div></td>
                              </tr>
                              <tr>
                                <td colspan="2"><div align="right">You can upload: {restuploads} images.</div></td>
                                </tr>
                            </table>


4. Step:

in member.php find: ( attention: only availlable if MOD user upload limits is installed!!!)

Code: [Select]
function check_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$upload_limit = ($row['user_limit']);

$site_template->register_vars("upload_limit", $upload_limit);

$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$images_per_user = $site_db->get_numrows($result);

// $sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
// $result = $site_db->query($sql);
// $tmp_images_per_user = $site_db->get_numrows($result);
// $images_per_user = $tmp_images_per_user + $images_per_user;

// Uncomment above four lines if you also want to check uploaded but not yet validated images against the user limit

$site_template->register_vars("images_per_user", $images_per_user);

if($images_per_user >= $upload_limit) {
return false;
} else {
return true;
}
}

and replace with:

Code: [Select]
function check_picture_limit($user_id) {
global $site_db, $site_template;

$sql = "SELECT user_global_limit FROM ".USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$global_upload_limit = ($row['user_global_limit']);

$site_template->register_vars("global_upload_limit", $global_upload_limit);

$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$globalimages_per_user = $site_db->get_numrows($result);

$sql = "SELECT image_id FROM ".IMAGES_TEMP_TABLE." WHERE user_id=$user_id";
$result = $site_db->query($sql);
$tmp_images_per_user = $site_db->get_numrows($result);
$globalimages_per_user = $tmp_images_per_user + $globalimages_per_user;

// Uncomment above four lines if you also want to check uploaded but not yet validated images against the user limit

$site_template->register_vars("globalimages_per_user", $globalimages_per_user);

if($globalimages_per_user >= $global_upload_limit) {
return false;
} else {
return true;
}
}

find:

Code: [Select]
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_picture_limit($user_id))) {
// if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {

//
// Depending on your requirements, you can either check against global or daily limit. For global check leave it as it is now.
// For daily limit comment first line and uncomment second one.
//

$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}

and replace with:

Code: [Select]
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_picture_limit($user_id))) {
$site_template->print_template($site_template->parse_template("over_limit2"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}

if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_daily_picture_limit($user_id))) {
$site_template->print_template($site_template->parse_template("over_limit"));
include(ROOT_PATH.'includes/page_footer.php');
exit;
}

5. Step:

open from template folder: over_limit.html

delete:

Code: [Select]
{lang_no_limits}

{lang_no_limits_text}
{lang_show_my_images}

and insert any message you want (if users are on their global limt) and save it as over_limit2.html

6. Step:

open in your template folder user_logininfo.html and find:

Code: [Select]
<a href="{url_lightbox}">{lang_lightbox}</a><br>
after that add:

Code: [Select]
<a href="/credits.php">My Points</a><br />

Save and upload all files. It should work ;-)


---------------------------------------------------------------------------

If you dont have installed Dreamboard do as follows:

Delete from credits.php:

Code: [Select]
$sql3 = "SELECT user_posts AS posts
         FROM ".USERS_TABLE."
         WHERE  ".get_user_table_field("", "user_id")." = $user_id";
  $row3 = $site_db->query_firstrow($sql3);
$posts = (isset($row3['posts'])) ? $row3['posts'] : 0;
  $user_posts = "<B> ".$row3['posts']."</B>\n";
  $site_template->register_vars("user_posts", $user_posts);
Code: [Select]
$postpoints= $row3['posts'] * 5; //Punkte für Posts hier eintragen
Code: [Select]
+ $postpoints
In credits.html delete from the table code:

Code: [Select]
                              <tr>
                                <td height="20">You have posted {user_posts} Posts in the Forum and get: </td>
                                <td><div align="center">{postpoints} Points</div></td>
                              </tr>
                              <tr>
                                <td height="20" colspan="2"><div align="center">
                                  <hr size="1">
                                </div></td>
                                </tr>
                              <tr>

Done.

------------------------------------------------------
Question so someone who is really able to code php:
My problem with this is, that the database entry only gets updated, if  credits.php will be opened.
How can i fix this?

Maybe i could add to index.php:

Code: [Select]
include(ROOT_PATH.'credits.php');
and:

Code: [Select]
$sql = "
UPDATE ".USERS_TABLE."
SET user_global_limit = 20 + '$zusatzuploads'
WHERE ".get_user_table_field("", "user_id")." = $user_id";
$site_db->query($sql);


}

Will that work?

Greez Egly

3
Chit Chat / PHP Question
« on: September 21, 2005, 12:38:07 AM »
Hi.

I want to print out the total comments of the user that is logged in with that code:

Code: [Select]
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');

$user_id = $user_info['user_id'];

if ($user_info['user_level'] >= USER) {
$sql = "SELECT COUNT(user_comments) AS comments
         FROM ".USERS_TABLE;"
WHERE  URL_USER_ID = $user_id";
  $row = $site_db->query_firstrow($sql);

  $comments = (isset($row['comments'])) ? $row['comments'] : 0;
  $user_pscomments = "".$lang['total_votes']."<B> ".$row['comments']."</B>\n";
 
  $site_template->register_vars("user_pscomments", $user_pscomments);
unset($user_pscomments);
   
 }

My problem is that  it counts all the time "24" with every account i logg in...
Where is my mistake?
I have to say, that i´m very noob to php... Started coding today  :lol:

4
Hello,

i need your help! On my site http://www.amberger-fotogalerie.de
If you click on any thumbnail you want, you get to the image called "usertreffen".
What happend?

It would be nice, if somebody could help me with that...
I changed no code...
The images are on my server. I can see them via FTP.

5
Discussion & Troubleshooting / My Pictures / Meine Bilder
« on: September 01, 2005, 09:48:32 AM »
Hi!

I tried to add a link like "My Pictures" to the User Box
I used the following code for it in page_header.php

Code: [Select]
"user_name2" => $user_info['user_name'],
under
Code: [Select]
"user_loggedout" => 0,
in user_logininfo.html i used this:

Code: [Select]
<a href="/search.php?search_user={user_name2}">Meine Bilder</a>
But if i try it on my page, the search is empty and the search form appears..

If i use {user_name} instead of {user_name2} then it works but i get the images of ANY user but not my pictures...

What should i do to get it work?

Thx

6
Discussion & Troubleshooting / Counter Problem
« on: August 30, 2005, 01:48:01 PM »
Hi,

i searched alot but i havent found the answer for my promlem..

A user uploads an image and after a while the hit counter for this image shows about 70 hits.
The Counter on our index.html says that there have only about 10 people visited our site...
Which counter is the wrong one?
Is there a reload blockade integrated? If not, is it possible to integrate one?

www.amberger-fotogalerie.de

Thx

7
Discussion & Troubleshooting / Problem: Bewertung der Bilder geht net
« on: July 28, 2005, 03:22:26 PM »
Hallo Forum!

Folgendes Problem:
Ich habe das 4images Skript auf meiner Homepage erfolgreich installiert und auch so modifiziert, dass (fast) alles funktioniert.
Das einzige, das nicht geht ist der Button für die Bewertungen und der Suche Button.
Hier die Fehlerhafte Seite: http://egly.eg.funpic.de/

Auf der folgenden Seite hab ichs genauso gemacht und auch den selben code verwendet, und es funktioniert...
http://www.egly2k.de

Vielleicht kann mir ja einer helfen...

Pages: [1]