Coppermine and Apache virtual hosts Coppermine and Apache virtual hosts
 

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

Coppermine and Apache virtual hosts

Started by dquelhas, August 15, 2006, 02:36:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dquelhas

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

Nibbler

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.

dquelhas

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

Nibbler

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.

dquelhas

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


Nibbler

Not without modifying core code. Perhaps you could place all such categories under a master category for each user.

dquelhas

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