Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Share data between domains
Old 08-07-2010, 12:35 PM [done] Share data between domains
c2k
c2k's Avatar
Skilled Talker

Posts: 72
Location: Germany
Trades: 0
Hey there,

I'm not completely sure where to post this, but since I write my server side code in PHP I thought I put it here.

Currently I only have one domain mapped to my webspace. Let's say my webspace path is /www/htdocs/john_doe, then the webserver root for the domain john_doe.com would link to that path. However I would like to host a second domain in this webspace. So I was thinking to do as follows:

www.john_doe.com -> /www/htdocs/john_doe/john_doe
www.jane_doe.com -> /www/htdocs/john_doe/jane_doe

The thing is I would like to share common data between both domains, for example the family picture to save some space. As I understand this, using this configuration sharing pictures between both domains is not possible, is it? If not, how would you guys organize the webspace?

Thanks for your help!

Last edited by c2k; 08-07-2010 at 08:30 PM.. Reason: Done
c2k is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-07-2010, 04:14 PM Re: Share data between domains
Average Talker

Posts: 25
Name: Stephen
Location: Arizona
Trades: 0
Are the images persisted in the file system or the database?

If in the file system, I would only share the folder to the php scripts, and use them to serve the content... such as getimage.php?param1=a&param2=b etc...
__________________

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
GetGamesHere is offline
Reply With Quote
View Public Profile Visit GetGamesHere's homepage!
 
Old 08-07-2010, 06:30 PM Re: Share data between domains
c2k
c2k's Avatar
Skilled Talker

Posts: 72
Location: Germany
Trades: 0
Hey,
thanks for your reply. Could you please elaborate? I must confess I do not really understand what you mean. Thanks
c2k is offline
Reply With Quote
View Public Profile
 
Old 08-07-2010, 07:02 PM Re: Share data between domains
Average Talker

Posts: 25
Name: Stephen
Location: Arizona
Trades: 0
Sure, here is a simplified example to illustrate the concept:

getimage.php
PHP Code:
$sharedpath "/some/path/to/shared/content/";

// do not just consume $_GET fields, validate the data to prevent attacks

$imagename $sharedpath $_GET["imagename"];

// add a switch block to determine mime type

$mimetype "image/jpeg";

header("Content-Type: $mimetype");
echo 
file_get_contents($imagename); 
Use the php file to access the shared images:
HTML Code:
<img src="/getimage.php?imagename=121112112a889.jpg"/>
__________________

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
GetGamesHere is offline
Reply With Quote
View Public Profile Visit GetGamesHere's homepage!
 
Old 08-07-2010, 08:28 PM Re: Share data between domains
c2k
c2k's Avatar
Skilled Talker

Posts: 72
Location: Germany
Trades: 0
Ah, thanks. Now it makes perfectly sense. This seems to be a good and flexible solution. I think this will be easy to handle, since I already have a class returning the pictures' paths, but currently they all reside within one of the domain's root's leafs. I just have to check where the picture resides and either return the path or the picture (or return the picture in any case, as a matter of fact).

Thanks again!
c2k is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Share data between domains
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32920 seconds with 12 queries