CpmFetch - Embedding in templates (SMF, Wordpress, PHPBB, etc, ...) - Page 5 CpmFetch - Embedding in templates (SMF, Wordpress, PHPBB, etc, ...) - Page 5
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

CpmFetch - Embedding in templates (SMF, Wordpress, PHPBB, etc, ...)

Started by vuud, May 07, 2005, 07:27:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jerx

Hi,

I use cpmfetch to display 2 random pictures on my phpbb portal page. Today some users experienced following error:

phpBB : critical error

Could not connect to the database

Warning: mysql_connect(): Too many connections in
/cpmfetch/cpmfetch_dao.php on line 661

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link
resource in /cpmfetch/cpmfetch_dao.php on line 665

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 666

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 679

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 682

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 683

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result
resource in /cpmfetch/cpmfetch_dao.php on line 710

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 671


Due to this problem some users were not able to log in. Looks like you run into problems if you have many pictures (5000+) in your gallery. When I started using cpmfetch I only had 3000+ pictures. The server load hasn' t been very high today, around 0.2.

Did anybody have had the same problem? Does anyone know how to get around this?

vuud

Quote from: jerx on December 04, 2005, 11:25:20 PM
Hi,

I use cpmfetch to display 2 random pictures on my phpbb portal page. Today some users experienced following error:

phpBB : critical error

Could not connect to the database

Warning: mysql_connect(): Too many connections in
/cpmfetch/cpmfetch_dao.php on line 661

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link
resource in /cpmfetch/cpmfetch_dao.php on line 665

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 666

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 679

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 682

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 683

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result
resource in /cpmfetch/cpmfetch_dao.php on line 710

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource
in /cpmfetch/cpmfetch_dao.php on line 671


Due to this problem some users were not able to log in. Looks like you run into problems if you have many pictures (5000+) in your gallery. When I started using cpmfetch I only had 3000+ pictures. The server load hasn' t been very high today, around 0.2.

Did anybody have had the same problem? Does anyone know how to get around this?


Are you calling the $objCpm->cpm_close() when you are done?  How are you using it in PHPBB?  The close may not matter.

I tend to think it is not a cpmfetch issue...  Cpmfetch opens a new database connection when you start it, then closes it when you call the close function.  It does not open one for each picture or anything - the number of photos you have would not make a difference.

It could be the amount of traffic you are getting to the site.  cpmFetch will open a new connection each time it is called, instead of using an existing one (otherwise it attempts to close the existing one when it closes). 

Hmmm...  I guess if you had 100 people hitting your page at the same time, it would open 100 database connections (1 per user).  But it would close them just as fast.

Let me know how you are embedding the images in there...

Also has anyone had problems just using phpbb?











Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

jerx

It looks like this:


...

// cpmfetch
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_setReturnType('html');

$template->assign_vars(array(
'RANDOM_IMAGE' => $objCpm->cpm_viewRandomMedia(1,2, array('alttag' => '%a, %f')),
'WELCOME_TEXT' => $CFG['welcome_text'],

..

'AVATAR_IMG' => $avatar_img)
);
$objCpm->cpm_close();
if(!isset($topics))
{

...


Today everything was back to normal. I don' t think it was too much traffic, because yesterday' s numbers were lower than today. Maybe it was a hacking attempt?! I saw 390 simultanous tasks. Usually it is below 100. At busy times it is slightly over 100. Unfortunately I did not know how to view the tasks/mysql connections, so I could not investigate any further.

vuud

Quote from: jerx on December 06, 2005, 12:05:26 AM
It looks like this:


...

// cpmfetch
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_setReturnType('html');

$template->assign_vars(array(
'RANDOM_IMAGE' => $objCpm->cpm_viewRandomMedia(1,2, array('alttag' => '%a, %f')),
'WELCOME_TEXT' => $CFG['welcome_text'],

..

'AVATAR_IMG' => $avatar_img)
);
$objCpm->cpm_close();
if(!isset($topics))
{

...


Today everything was back to normal. I don' t think it was too much traffic, because yesterday' s numbers were lower than today. Maybe it was a hacking attempt?! I saw 390 simultanous tasks. Usually it is below 100. At busy times it is slightly over 100. Unfortunately I did not know how to view the tasks/mysql connections, so I could not investigate any further.


Well, the code looks fine above... that will create and destroy one mysql session.  And if you start the cpmfetch object with $objCpm = new cpm("/gallery"); and then never use it, it never makes a database connection.  So the close would be redundant.  If you are using the same database for the cpmfetch and for the phpbb stuff, you could try

Find this line in cpmfetch_dao.php (somewhere around 661 in my copy, but I've been tampering with it, so it may be somewhere else)


$this->dbconnection = mysql_connect($this->dbhost, $this->dbuser, $this->dbpass, true);


and remove the true from the end


$this->dbconnection = mysql_connect($this->dbhost, $this->dbuser, $this->dbpass);


It is very important that you do NOT use the cpm_close() if you do this.  This lets it use an existing database connection if one exists.  If you use the close after that it will terminate your phpbb connection.

Normally on cpmfetch you do not want this behaviour - but in your case, this could reduce the number of connections by half.

I've made a note to make this behavior more definable in the next version of cpmfetch.


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

jerx

Changing cpmfetch_dao.php doesn' t seem to have any effect at all. Although you told me to delete the close statement I was curious and did not do it. But everything worked the same as before. I expected some missing data on my phpbb portal. Is it because all phpbb stuff was already done when the close statement is processed?

vuud

Quote from: jerx on December 06, 2005, 06:56:53 AM
Changing cpmfetch_dao.php doesn' t seem to have any effect at all. Although you told me to delete the close statement I was curious and did not do it. But everything worked the same as before. I expected some missing data on my phpbb portal. Is it because all phpbb stuff was already done when the close statement is processed?

Your probably correct on the result of not removing the close statement.  I would still remove it if I were you - just because it did not do anything there does not mean that it wont come back to bite you in the arse on some other page, or later if you add something else into phpbb that would get processed after.

It may not have a noticable effect, but it is one less db connection per client... so if too many concurrent users was your actual problem, this will help.

I dont think the problem was here originally, but this is a good improvement anyway.

I've been thinking about how you could have a lot of simultaneous connections that would cause the database too many connections error.  I've come up with a few things:

* If your hosted, someone else could have a run-away chunk of code opening a lot for no reason.  The server would block on a cumulative total (like 1000 - they user 999, leaving you with 1)

* A search engine could have crawled your site... I am not sure if PHP and PHPBB can share connections or if each instance would open a new one. 

I dunno.  Lets just hope the problem goes away!





 
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

astrothug

i was using an older version of coppermine and cpgfetch 1.6.2 then updated my coppermine to 1.4.2 and cpgfetch does not work. when i went to cftest i get this error
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
C:\www\webroot\site1\cpmfetch\cpmfetch_dao.php on line 710


everything was working great before i updated to the new coppermine.
www.ghostintheshell.ca
www.ghostintheshell.ca/wp/

vuud

Quote from: astrothug on December 13, 2005, 06:01:16 AM
i was using an older version of coppermine and cpgfetch 1.6.2 then updated my coppermine to 1.4.2 and cpgfetch does not work. when i went to cftest i get this error
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
C:\www\webroot\site1\cpmfetch\cpmfetch_dao.php on line 710


everything was working great before i updated to the new coppermine.
www.ghostintheshell.ca
www.ghostintheshell.ca/wp/


This is a known, well discussed issue.  View the releasenotes that came with cpmfetch 1.6.2 or search the boards.  You need to make a simple edit to cpmfetch_dao.php

That should fix what ails you.  The database in cpg changed between 1.3 and 1.4
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dlkbailey

Quote from: vuud on December 13, 2005, 06:25:39 AM

This is a known, well discussed issue.  View the releasenotes that came with cpmfetch 1.6.2 or search the boards.  You need to make a simple edit to cpmfetch_dao.php

That should fix what ails you.  The database in cpg changed between 1.3 and 1.4

I just installed cpmfetch 1.6.2 and I get the following error on the test page
" Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /mounted-storage/home8/sub001/sc14959-TCLB/LN/cpmfetch/cpmfetch_dao.php on line 710"

I searched the forum for this problem and I found the post I quoted where there was the same problem. So I did as instructed from that post and read the release notes. The release notes said to comment out line 54 and un comment line 59. I commented line 54 and there insn't even a line 59. I am lost and I would really like to use this script please help.

tgelston

I have been having some other problems so tonight I updated my fetch to see if that would help.  I got the same error you did.  I got it to work by commenting out

// This is for CPG versions prior to 1.4
/*var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/


And uncommenting

// This is for CPG v 1.4.1 beta 1

var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';


So that was line 57 you comment out and 62 you un-comment.

Hope that helps :)

I was hoping it would solve my problem. .  it has not.

n3n

Has anyone tested this within the theme.php file ? Its very weird but cant get itw work there.
Also would it be possible to change the output of a thumb. I would like it to have rounded corners. This could be done
by adding a transparant gif/png on the corners of the thumb.

When are you planning on releasing the 1.7 version.

soldstatic

I was getting the unknown column error, so I did the fix where you uncomment the one line and comment the other. now i dont get images but also no errors.

sorry about asking this same question i know there's TONS of people having this problem...

my problem is that on the cftest.php it says
DOCUMENT_ROOT is not a good match is bad

and when i look at the info line i see
55 DOCUMENT_ROOT: /home/soldstatic/emdscene.com

where the doc root SHOULD be
55 DOCUMENT_ROOT: /home/.asta/soldstatic/emdscene.com

how do i fix this?

maxout

i think it would be much easier to make addon/module/plugin for each most famous. portals/fourms

this is too much work. and hard for even middle level php/database user.

coppermine has installed and embed the SMF properly so there should be some clean UPTODATE instruction to do this hard work.

i have installed fresh SMF and Coppermine

and i think i got the bridge thing going well.. but i just need to wrap the gallery around the forum.

and here i am strugling. any professional help.

Miyagi

Quote from: tgelston on February 28, 2006, 01:21:36 AM
I have been having some other problems so tonight I updated my fetch to see if that would help.  I got the same error you did.  I got it to work by commenting out

// This is for CPG versions prior to 1.4
/*var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/


And uncommenting

// This is for CPG v 1.4.1 beta 1

var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';


So that was line 57 you comment out and 62 you un-comment.

Hope that helps :)

I was hoping it would solve my problem. .  it has not.

I've spent a few hours trying to resolve this issue myself and i'm left scratching my head.

Vuud any recommendations?

Thanks,
Miyagi

n3n

Could anyone tell me how to get it working within theme.php. Doesnt seem to work for me.

shamrox

I'm using SMF with Tinyportal and would like to have the Coppermine Random images show up using this CpmFetch, but I have no clue what i need to do to make this happen.

I tried to mess with making a center block and using the test file. but that didn't work. Can anyone lay out exactly what I need to do??

Thanks in advance.

tareone

I got this error when running testpage:

QuoteFatal error: Call to undefined function: setphotoprefix() in /home/int2000/XXXXX/html/cpmfetch/cpmfetch.php on line 90

All tests are ok and i have commented and uncommented cpmfetch_dao.php lines which caused errors earlier. Any fix for this?

n3n

Has anyone been able to use cpmfetch within theme.php/template.html. Want to create an imageblock with users last uploads.

Tnx !

trvlnman

Quote from: shamrox on May 13, 2006, 09:42:47 PM
I'm using SMF with Tinyportal and would like to have the Coppermine Random images show up using this CpmFetch, but I have no clue what i need to do to make this happen.

I tried to mess with making a center block and using the test file. but that didn't work. Can anyone lay out exactly what I need to do??

Thanks in advance.

I am trying to do the same thing.  I have found a few links with folks doing that.  I think that a PHP article needs to be created using an IFrame ( I think) and CPMFetch.  If I find out anything else I'll let you know.

trvlnman


I have been trying to get CPMFetch installed with no luck (I think)  Here is the page I get from cftest.php.

I am using:

SMF 1.1 RC2 w/ Helios Multicolor
TinyPortal 0.86
Coppermine 1.4.5
CPMFetch 1.6.2

I have a user gallery created with the ID that I used to login with using TinyPortal.

Tests:
5 You set your partial URL to /coppermine PASS
10 No dots in partial url PASS
15 coppermine.php not present PASS
20 coppermine_dao.php not present PASS
25 cpmfetch.php found PASS
30 cpmfetch_dao.php found PASS
35 Server OS = Linux situ.dh2.net 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 INFO
40 WebServer = Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a INFO
45 PHP Version = 4.3.11 INFO
55 DOCUMENT_ROOT: /home/tristen/public_html INFO
60 C_DOCUMENT_ROOT: Not found INFO
65 doc_root: /home/tristen/public_html/ INFO
70 SCRIPT_FILENAME: /home/tristen/public_html/cpmfetch/cftest.php INFO
75 DOCUMENT_ROOT is a good match PASS
80 Found CPG config file PASS

Trying to display some images:

Your installation seems correct so far, you should see a small grid of thumbnails from your gallery
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/tristen/public_html/cpmfetch/cpmfetch_dao.php on line 710


I can access the gallery fine through the portal on the site.  I only have a few pics in some user galleries at this point.  I do not have any graphics in the main gallery.  I took a look and I am usig the standard naming conventions.

Any ideas??

Thanks in advance for your help.