using the same database for differnet sites? using the same database for differnet sites?
 

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

using the same database for differnet sites?

Started by bangers, February 24, 2005, 05:04:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bangers

Hi, hope someione can help.

I have a number of different sites that I would like to use the same database that I have set up for coppermine gallery. Which would allow users to access galleries across all sites.

However, i would like the image folders to be sites specific so, for example: if someone enters site1.com they can only see photos in the gallery which are held in the image folder called site1. The if they go onto site2.com they only see the images in the folder site2 etc etc.

Also I would like the gallery theme to change according to whatever site the user goes onto, so for example: if someone visits site1.com the gallery uses the custom theme site1 if site2.com it uses the them site2.

Is any of this possible? If so, could someone let me know how to do it.

many thanks
bangers

Joachim Müller

The albums folder of a coppermine install has to be on one server - you can't "pull" files from another server, so the images would all have to reside on the same server and you would have to use coppermine's user/groups management to determine what a user can see and what not. There has been a similar request only recently, where a user asked how to accomplish using different themes, based on the referer the visitor comes from, please look this thread up (it can be done using the theme override method using theme=foobar in the link url). Another method could be the modification of the code: adding some conditionals that check what group a user belongs to and set the theme for him accordingly.
All of this is not easy to accomplish; if you're not an experienced coder I suggest you review the whole idea, or hire someone to code it for you. The answer is: it can be done, but is not easy. Without further details, I can't tell you more (actuall examples wand links to existing sites would help a lot).

Joachim

P.S. Please don't forget that we have a "one question per thread" policy on this board...

bangers

Thanks for the help.

Changing the theme seems straight forward enough, I could just use the link url method. So that's no problem.

With regards to the different sites loading specific images. It seems it could be easier than I first thought as all the sites reside on the same server as do the image folders.

to view examples of my sites (although I am currently using different databases for these):
(both have the same sites structure).

"you would have to use coppermine's user/groups management to determine what a user can see and what not"
I guess my question boils down to this, how do I set this up on different sites so that in my case only photo's of graeme are seen on his site and only picture of paul are seen on his?

Regards
Bangers


Joachim Müller

well, as I said this is not a "regular" setup meant for newbies, you will have to do some additional coding: the coppermine source files should exist for both sites independently, but they should point to the same database tables. This way, you will be sharing the same pic/file information and the same user data. The trick is to create custom groups, one being "graeme-members", one being "paul-members". You'd then have to modify the php code of your registration pages (remember, you need to have different coppermine source files for both sites, so you will have different register.php and db_input.php files as well) and add a routine that automatically adds every user who registers on the "graeme" site to the "graeme-members" group (and of course the same thing would have to be done for the paul site as well). Finally, you'd have to set the permissions on all albums ("album properties") for each site to be accessible for the correct membergroup.
Hope I was able to explain this as detailed as possible.

Joachim

bangers

Thanks again GauGau.

This sounds good but is there a way of doing this without having to affect the members just the sites.

At the moment I'm not having anyone signup to the galleries so they are open to anyone who visits the site.

Could I set something up which would have anyone who visits paul's site appear as a paul member and therefore only see paul's pics and vice versa?

Thanks again for the help
Bangers

Joachim Müller

would require some more fiddling with the code; in theory, it's possible: based on the cookie information you could add if/the conditionals in coppermine's code that show parts of coppermine and not show others based on where the user comes from. This is quite a task to accomplish though, I'd go for separate installs: saving just a few MBs of webspace isn't worth the effort, especially if you don't want to use a common user base, but allow anonymous access. If you're just short of webspace, I suggest you take a look at http://coppermine.sourceforge.net/faq.php#minimumInstall instead of going through all the stress with those modifications - it will be very hard to upgrade your coppermine installs in the future if you hack the code as much as it would be necessary to accomplish what you're up to.

Joachim

donnoman

Maybe I'm not understanding this quite right.

But what if you were to do TWO installs of coppermine and use a different prefix for each install, and set the cookie prefix differently.

Then in the second install config the "albums" directory to point to the first.

This would give you two totally separate installs, you would have to batch add the files twice, but you would only have to generate the thumbs/intermediates once, and thats what takes the lionshare of the time.

The advantage being you only have one set of images sucking up space, your users uploaded pics are going into separate USERPICS (I think thats good, but I suppose you could set them to the same dir), you've done zero mods and only configuration options: updating will be easy.

donnoman

I'm not sure I was understanding that right.

After re-reading his original post it almost seems like he should do two installs, and use a coppermine to coppermine bridge file. ie the second install is bridged to the first.

Would provide same users/groups but the albums/images/themes would be different between the installs.

bangers

Looks like I should speerate installs then.
only problem is that my service provider (oneandnone) only allows a certain number of mysql databases within my package and I'm hoping to exceed this number (but that's easy enough to sort).
Thanks again for all the help.
Bangers

donnoman

you could install both (or multiple) coppermines into the same database, as long as you specify a unique table prefix in config.inc.php for each one.

Pick one to be your primary install, bridge the rest to the primary.

Make sure you specify different cookie prefixes in the config of each install as well.