4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
February 25, 2018, 04:18:06 PM

Login with username, password and session length
Search:     Advanced search
Follow 4images on twitter: Click here to follow!
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Issues / Ausgaben
| |-+  Installation, Update & Configuration (Moderators: Acidgod, ivan, Rembrandt)
| | |-+  install 2 galleries
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 » »» Print
Author Topic: install 2 galleries  (Read 37408 times)
airliner
Newbie
*
Offline Offline

Posts: 21

Thank You
-Given: 0
-Receive: 0


View Profile
« on: September 07, 2009, 10:07:24 AM »

Hi folks,

It it possible to install two galleries in the same database with different table prefixes and let them share login sessions ???
Is it hard to modify ??
I'm a bit of a newbie guys .. but I gues that constant, session.php has to be modified pretty much?

Thanx

Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #1 on: September 07, 2009, 10:02:16 PM »

assuming database prefix for you first 4images is 4images1 and for your second 4images is 4images2, then you can try replace in your second 4images includes/constants.php
1
2
3
define('SESSIONS_TABLE'$table_prefix.'sessions');
define('SESSIONVARS_TABLE'$table_prefix.'sessionvars');
define('USERS_TABLE'$table_prefix.'users');
with:
1
2
3
define('SESSIONS_TABLE''4images1_sessions');
define('SESSIONVARS_TABLE''4images1_sessionvars');
define('USERS_TABLE''4images1_users');

In includes/sessions.php find:
1
define('COOKIE_PATH''');

Replace with:
1
define('COOKIE_PATH''/path/to/first/4images/');

i.e. if your first 4images located at http://yourdomain.com/blah/4images1/, then the line would be:
1
define('COOKIE_PATH''/blah/4images1/');

not sure if it's going to work though
[EDIT]
just tested it, works fine, but you'll need add into config.php of each gallery:
1
define('SESSION_KEY'"this is a random string, must be identical in each gallery");
[/EDIT]

Follow members gave a thank to your post:
kridekride, asmaa, Kurman

For this post, 3 members gave a thank you!
« Last Edit: December 20, 2009, 08:13:40 AM by V@no » Logged

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)
airliner
Newbie
*
Offline Offline

Posts: 21

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: September 08, 2009, 08:32:53 AM »

Thanx ... worked fine ..
I missed the session key part Smile

Thank you very much Sir.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #3 on: September 08, 2009, 08:58:19 AM »

I just discovered, that auto login will not work in second 4images. One more change needed in second 4images to fix that. (added to the instructions above)

Follow members gave a thank to your post:
Kurman

For this post, 1 member gave a thank you!
« Last Edit: December 20, 2009, 08:13:04 AM by V@no » Logged

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)
airliner
Newbie
*
Offline Offline

Posts: 21

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #4 on: September 08, 2009, 09:36:20 AM »

Fantastic Sir! Smile
Logged
Sumale.my
Addicted member
******
Offline Offline

Posts: 1768

Thank You
-Given: 167
-Receive: 83

Neverdie


View Profile
« Reply #5 on: September 13, 2009, 02:01:35 AM »

Nice!
Added to my List:
http://www.4homepages.de/forum/index.php?topic=24888.0

Thanks V@no!
Logged
Kurman
Newbie
*
Offline Offline

Posts: 42

Thank You
-Given: 3
-Receive: 2


View Profile WWW
« Reply #6 on: December 20, 2009, 07:03:45 AM »

Good job! Works perfectly!

Only one correction - the posts above have a mistyping:

If we use for first gallery database table prefix "4images1", then we must have no prefix in database of second gallery.

##############

A question:
Can we use as well 3 or more galleries with one user table? (just like above, but more than 2)?
« Last Edit: December 20, 2009, 07:52:24 AM by Kurman » Logged

4images running as a music portal http://music.kurman.ru/
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #7 on: December 20, 2009, 08:08:04 AM »

The point behind prefixes is to have different tables on the same database. A table name without prefix would be automatically different from a table name with a prefix...and besides, using prefixes makes it easier to manage afterwards Wink

Theoretically this method should work for unlimited number of galleries, as long as they all on same database.
Logged

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)
Kurman
Newbie
*
Offline Offline

Posts: 42

Thank You
-Given: 3
-Receive: 2


View Profile WWW
« Reply #8 on: December 20, 2009, 10:58:29 PM »

Not quite right, V@no.

Look:

We use users table from the first gallery, and we've prefix 4images1 for first gallery, and prefix 4images2 for the second, right?
  • in config.php of the first gallery we have $table_prefix = "4images1_";
  • in config.php of the second gallery we have $table_prefix = "4images2_";

So, if we call in constants.php in the second gallery for
1
2
3
define('SESSIONS_TABLE', '4images1_sessions');
define('SESSIONVARS_TABLE', '4images1_sessionvars');
define('USERS_TABLE', '4images1_users');

We will recieve mysql error, for script (second gallery) will search for
1
2
3
define('SESSIONS_TABLE', '4images2_4images1_sessions');
define('SESSIONVARS_TABLE', '4images2_4images1_sessionvars');
define('USERS_TABLE', '4images2_4images1_users');

Because in config of the second gallery we already put  $table_prefix = "4images2_";
and constats.php looks for 4images2_(its own prefix, defined in root config)+4images1_bla-bla.

So, if we do in that way, we must not use table prefix for second gallery. Then it will search correctly for tables and find them
1
2
3
define('SESSIONS_TABLE', '4images1_sessions');
define('SESSIONVARS_TABLE', '4images1_sessionvars');
define('USERS_TABLE', '4images1_users');

Because there is no prefix in its own config.php.

Practically it is it. I thought for 3 or more galleries, but there is no way to do it in the similar way Confused Because each gallery, when calls for user table of the main gallery, adds its own prefix to path, and we get mysql error 116.. And only prefixless gallery finds right way for other user table.
« Last Edit: December 20, 2009, 11:14:31 PM by Kurman » Logged

4images running as a music portal http://music.kurman.ru/
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #9 on: December 21, 2009, 12:11:11 AM »

You misunderstand this.
The original line (4images1) is:
define('SESSIONS_TABLE', $table_prefix.'sessions');

then in second 4images (with prefix 4images2) we change it to:
define('SESSIONS_TABLE', '4images1_sessions');
see, no more $table_prefix used, therefor there is no "4images2_4images1_sessions" issue
Logged

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)
Kurman
Newbie
*
Offline Offline

Posts: 42

Thank You
-Given: 3
-Receive: 2


View Profile WWW
« Reply #10 on: December 21, 2009, 04:34:41 AM »

Now I see.

It is great feature of 4images, and amazing flexibility!  Wink

Thank you, V@no!
Logged

4images running as a music portal http://music.kurman.ru/
weedray
Pre-Newbie

Offline Offline

Posts: 1

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #11 on: January 24, 2010, 08:21:35 PM »

I figured out now what i was missing Smile
Logged
paule
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #12 on: January 02, 2011, 08:41:16 PM »

Hallo,

ich habe die ─nderungen vorgenommen und bekomme folgende Fehlermeldung wenn ich 4images2 aufrufen will:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /Library/WebServer/Documents/4images2/includes/db_mysql.php on line 116

db_mysql.php Line 116 = return mysql_num_rows($this->query_id);

Gru▀ paule

1.7.7 / www.kosecki.de
Logged
Jan-Lukas
Addicted member
******
Offline Offline

Posts: 1276

Thank You
-Given: 151
-Receive: 47


View Profile WWW
« Reply #13 on: January 03, 2011, 12:10:30 AM »

Hi Paule,
versuche das mal

http://www.4homepages.de/forum/index.php?topic=22668.0

LG

Backup nicht vergessen!
Logged

Danke Harald



paule
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #14 on: January 03, 2011, 01:13:41 PM »

Hallo Harald,

vielen Dank. Hab┤s versucht. Es gibt keine ─nderung der Fehlermeldung:

An unexpected error occured. Please try again later.
An unexpected error occured. Please try again later.
An unexpected error occured. Please try again later.
An unexpected error occured. Please try again later.
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /Library/WebServer/Documents/4images2/includes/db_mysql.php on line 116

Gibt┤s noch eine Idee wie ich das Problem l÷sen kann?

beste GrŘ▀e paule
Logged
Pages: [1] 2 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.088 seconds with 22 queries.
Post your comments here