coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: dquelhas on August 15, 2006, 02:36:19 PM

Title: Coppermine and Apache virtual hosts
Post by: dquelhas on August 15, 2006, 02:36:19 PM
Hello, i would like to know if there is a way to, through virtual hosts, to redirect the visitor to the set of categories belonging to a specific user.
The idea is to have a subdomain to each member of the family, and, for instance, if someone accesses the subdomain dinis.emviagem.com it is redirected to my part of the gallery, and if someone accesses my wife's subdomain, ana.emviagem.com, goes to her part of the gallery, and so on.
I am hosting the website at home, with apache2, php5 and mysql5, so any changes in the server are possible.
Thanks in advance for any help.

Dinis
Title: Re: Coppermine and Apache virtual hosts
Post by: Nibbler on August 15, 2006, 02:39:45 PM
You wouldn't need to use virtual hosts. You'd just need to add some code into init.inc.php to see what subdomain the request went to and set the album/category accordingly.
Title: Re: Coppermine and Apache virtual hosts
Post by: dquelhas on August 15, 2006, 03:18:43 PM
Hello Nibbler,

if you could be a bit more precise, it would be great. I'm new to this and i need some guidance.  ???
How to i see what subdomain the request went to?
How do i set the album/category accordingly?
What code should i add to init.inc.php?

Thanks,

Dinis
Title: Re: Coppermine and Apache virtual hosts
Post by: Nibbler on August 15, 2006, 03:29:12 PM
Maybe add something like this at the end of the file.


$parts = explode('.', $_SERVER['HTTP_HOST']);
$subdomain = $parts[0];

$categories = array(
'dinis' => 3,
'ana' => 5,
);

if (isset($categories[$subdomain])) $_GET['cat'] = $categories[$subdomain];


You'd need to set the correct category numbers in the code.
Title: Re: Coppermine and Apache virtual hosts
Post by: dquelhas on August 15, 2006, 03:49:56 PM
Thank you Nibbler, it seems to be a good direction pointing towards what i need.
One more question: In the solution you gave me, it only allows me to have one category per user.
Do you think it is possible to retrieve all the categories belonging to a specific user id?  :)

Thank you once again,

Dinis

Title: Re: Coppermine and Apache virtual hosts
Post by: Nibbler on August 15, 2006, 04:12:15 PM
Not without modifying core code. Perhaps you could place all such categories under a master category for each user.
Title: Re: Coppermine and Apache virtual hosts
Post by: dquelhas on August 15, 2006, 04:15:26 PM
Nibbler, you are the men. Thank you very much. After i wrote the last post, i saw how imbecile the question was.
Thank you for your patience.

Regards,

Dinis