468,242 Members | 1,685 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

PHP Template

Hi,

I am trying to have 1 template site and have an unlimited number of
websites
using this template site to call there own information.

The sites are exactly the same except for the database, each of the
sites
also needs there own URL, for example one of these urls may be
www.example1.com and the other www.example2.com. These sites are
identical
apart from the database they call to, one will call to a database
called
example1 and the other example2. I want another site (for example
www.solution.com) to read what url has been entered and to pull in the
database for that site (either example1 or example2) and show that
information. I have tried using the CURL library without success (not
sure
how to use it fully) and have tried using frames but had loads of
problems
regarding losing session data. can anyone help?

Thanks
Kev

Oct 25 '06 #1
6 1119
KevinM2k wrote:
Hi,

I am trying to have 1 template site and have an unlimited number of
websites
using this template site to call there own information.

The sites are exactly the same except for the database, each of the
sites
also needs there own URL, for example one of these urls may be
www.example1.com and the other www.example2.com. These sites are
identical
apart from the database they call to, one will call to a database
called
example1 and the other example2. I want another site (for example
www.solution.com) to read what url has been entered and to pull in the
database for that site (either example1 or example2) and show that
information. I have tried using the CURL library without success (not
sure
how to use it fully) and have tried using frames but had loads of
problems
regarding losing session data. can anyone help?
Hi,

The reason you loose your sessiondata is simple: The sessionid is stored in
a cookie together with the domain it belongs to.
Every request to a certain domain send along the cookie, and the possible
ppsessid, and so the server can see if it has a session belonging to that
user.
Imagine what happens if this was not implemented like this (as in early
versions of Netscape): You have 2 windows open, one on
www.wehackforfun.com, and one to your companies intranet. If both sites
receive all cookies, the former one can easily 'steal your session' to your
company's intranetsite, simply by reading the name and value of the
cookie...

If you have 2 different domains, they cannot share a session. (Well, they
can, but that is less straightforward.)

Bottomline, don't try to share sessions across different domains.

If this is really a requirement, you can set this up only if you own both
sites, and let them use a common session storageplace (database eg), AND
let both sites explicitely send the sessionid around via GET, because the
cookie will not work.
I am not sure if that is wise, but it can be done.
Regards,
Erwin Moller
>
Thanks
Kev
Oct 25 '06 #2

Erwin Moller wrote:
KevinM2k wrote:
Hi,

I am trying to have 1 template site and have an unlimited number of
websites
using this template site to call there own information.

The sites are exactly the same except for the database, each of the
sites
also needs there own URL, for example one of these urls may be
www.example1.com and the other www.example2.com. These sites are
identical
apart from the database they call to, one will call to a database
called
example1 and the other example2. I want another site (for example
www.solution.com) to read what url has been entered and to pull in the
database for that site (either example1 or example2) and show that
information. I have tried using the CURL library without success (not
sure
how to use it fully) and have tried using frames but had loads of
problems
regarding losing session data. can anyone help?

Hi,

The reason you loose your sessiondata is simple: The sessionid is stored in
a cookie together with the domain it belongs to.
Every request to a certain domain send along the cookie, and the possible
ppsessid, and so the server can see if it has a session belonging to that
user.
Imagine what happens if this was not implemented like this (as in early
versions of Netscape): You have 2 windows open, one on
www.wehackforfun.com, and one to your companies intranet. If both sites
receive all cookies, the former one can easily 'steal your session' to your
company's intranetsite, simply by reading the name and value of the
cookie...

If you have 2 different domains, they cannot share a session. (Well, they
can, but that is less straightforward.)

Bottomline, don't try to share sessions across different domains.

If this is really a requirement, you can set this up only if you own both
sites, and let them use a common session storageplace (database eg), AND
let both sites explicitely send the sessionid around via GET, because the
cookie will not work.
I am not sure if that is wise, but it can be done.
Regards,
Erwin Moller

Thanks
Kev
Do you have any suggestions on any other way to do this then because I
am completely stuck for ideas.

Thanks

Oct 25 '06 #3

Michael Vilain wrote:
In article <11**********************@e3g2000cwe.googlegroups. com>,
"KevinM2k" <ke******@yahoo.co.ukwrote:
Erwin Moller wrote:
KevinM2k wrote:
>
Hi,

I am trying to have 1 template site and have an unlimited number of
websites
using this template site to call there own information.

The sites are exactly the same except for the database, each of the
sites
also needs there own URL, for example one of these urls may be
www.example1.com and the other www.example2.com. These sites are
identical
apart from the database they call to, one will call to a database
called
example1 and the other example2. I want another site (for example
www.solution.com) to read what url has been entered and to pull in the
database for that site (either example1 or example2) and show that
information. I have tried using the CURL library without success (not
sure
how to use it fully) and have tried using frames but had loads of
problems
regarding losing session data. can anyone help?
>
Hi,
>
The reason you loose your sessiondata is simple: The sessionid is stored in
a cookie together with the domain it belongs to.
Every request to a certain domain send along the cookie, and the possible
ppsessid, and so the server can see if it has a session belonging to that
user.
Imagine what happens if this was not implemented like this (as in early
versions of Netscape): You have 2 windows open, one on
www.wehackforfun.com, and one to your companies intranet. If both sites
receive all cookies, the former one can easily 'steal your session' to your
company's intranetsite, simply by reading the name and value of the
cookie...
>
If you have 2 different domains, they cannot share a session. (Well, they
can, but that is less straightforward.)
>
Bottomline, don't try to share sessions across different domains.
>
If this is really a requirement, you can set this up only if you own both
sites, and let them use a common session storageplace (database eg), AND
let both sites explicitely send the sessionid around via GET, because the
cookie will not work.
I am not sure if that is wise, but it can be done.
>
>
Regards,
Erwin Moller
>

Thanks
Kev
Do you have any suggestions on any other way to do this then because I
am completely stuck for ideas.

Thanks

Uhm. The first fix was free kid. Now we gotta start charging you.

If you can't figure this out, hire a consultant or buy a php book.
There are lots out there. Browse the O'Reilley and Sitepoint sites.

--
DeeDee, don't press that button! DeeDee! NO! Dee...
I am posting on these groups to get this help, not to be told to read
books which aren't going to help in this situation anyway.

I have it so that if you manually set the site id it works, however i
need it to pick this id up depending on what domain you select.

K

Oct 26 '06 #4
KevinM2k wrote:
>Uhm. The first fix was free kid. Now we gotta start charging you.

If you can't figure this out, hire a consultant or buy a php book.
There are lots out there. Browse the O'Reilley and Sitepoint sites.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

I am posting on these groups to get this help, not to be told to read
books which aren't going to help in this situation anyway.

I have it so that if you manually set the site id it works, however i
need it to pick this id up depending on what domain you select.

K
Hi,

Let's get the situation clear. I am still a bit confused.
And I am not charging yet. ;-)

This is what you asked, I putted my questions in:
The sites are exactly the same except for the database, each of the
sites
also needs there own URL, for example one of these urls may be
www.example1.com and the other www.example2.com. These sites are
identical
apart from the database they call to, one will call to a database
called
example1 and the other example2.
Ok, So you have 2 domains.
(The fact that they are similar is not relevant for the problem you have at
hand, I think)

I want another site (for example
www.solution.com) to read what url has been entered
Entered Where?
One the first site, the second, or the www.solution.com?
I think the third, but I am unsure.
Can you explain very clear what you mean here? I am kinda slow today.

If the third, why not send the visitor to the first or second, and start
your session from there?

Or do you want to transmit your sessiondata MADE in the solution.com to one
of the others? (That can be done, and if this is your problem I can explain
how.)
and to pull in the
database for that site (either example1 or example2) and show that
information.

Regards,
Erwin Moller
Oct 26 '06 #5
KevinM2k wrote:
Michael Vilain wrote:
>>In article <11**********************@e3g2000cwe.googlegroups. com>,
"KevinM2k" <ke******@yahoo.co.ukwrote:

>>>Erwin Moller wrote:

KevinM2k wrote:
>Hi,
>
>I am trying to have 1 template site and have an unlimited number of
>websites
>using this template site to call there own information.
>
>The sites are exactly the same except for the database, each of the
>sites
>also needs there own URL, for example one of these urls may be
>www.example1.com and the other www.example2.com. These sites are
>identical
>apart from the database they call to, one will call to a database
>called
>example1 and the other example2. I want another site (for example
>www.solution.com) to read what url has been entered and to pull in the
>database for that site (either example1 or example2) and show that
>information. I have tried using the CURL library without success (not
>sure
>how to use it fully) and have tried using frames but had loads of
>problems
>regarding losing session data. can anyone help?

Hi,

The reason you loose your sessiondata is simple: The sessionid is stored in
a cookie together with the domain it belongs to.
Every request to a certain domain send along the cookie, and the possible
ppsessid, and so the server can see if it has a session belonging to that
user.
Imagine what happens if this was not implemented like this (as in early
versions of Netscape): You have 2 windows open, one on
www.wehackforfun.com, and one to your companies intranet. If both sites
receive all cookies, the former one can easily 'steal your session' to your
company's intranetsite, simply by reading the name and value of the
cookie...

If you have 2 different domains, they cannot share a session. (Well, they
can, but that is less straightforward.)

Bottomline, don't try to share sessions across different domains.

If this is really a requirement, you can set this up only if you own both
sites, and let them use a common session storageplace (database eg), AND
let both sites explicitely send the sessionid around via GET, because the
cookie will not work.
I am not sure if that is wise, but it can be done.
Regards,
Erwin Moller
>Thanks
>Kev

Do you have any suggestions on any other way to do this then because I
am completely stuck for ideas.

Thanks

Uhm. The first fix was free kid. Now we gotta start charging you.

If you can't figure this out, hire a consultant or buy a php book.
There are lots out there. Browse the O'Reilley and Sitepoint sites.

--
DeeDee, don't press that button! DeeDee! NO! Dee...


I am posting on these groups to get this help, not to be told to read
books which aren't going to help in this situation anyway.

I have it so that if you manually set the site id it works, however i
need it to pick this id up depending on what domain you select.

K
Erwin is correct. These groups are to help people learn how to do
things, not to do your work for you. You got a very workable solution -
probably the only way to do it within the limits of security set by the
browsers and protocol. Don't like it? Figure out how to do it
yourself, or pay someone else to do it.

Sound crass? You bet it is. But many of us make our livings off of
writing PHP code. We help here because we like to help others learn how
to do things. But we won't do your job for you for free. We like to
eat, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 27 '06 #6

KevinM2k wrote:
I am posting on these groups to get this help, not to be told to read
books which aren't going to help in this situation anyway.
How do you know that the books aren't going to help in this situation
if you haven't read them!

Oct 27 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

31 posts views Thread by nikola | last post: by
5 posts views Thread by Gianni Mariani | last post: by
2 posts views Thread by Rudy Ray Moore | last post: by
2 posts views Thread by Alfonso Morra | last post: by
19 posts views Thread by aaragon | last post: by
3 posts views Thread by Hamilton Woods | last post: by
45 posts views Thread by charles.lobo | last post: by
2 posts views Thread by Gary Nastrasio | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.