Solved

Get file names from HTTP header

Posted on 2014-01-06
5
231 Views
Last Modified: 2014-01-07
I'm sure someone has done this.

What I need to do is be able to connect to 2 different MySql databases on the same site.  The php/html is going to be the same.  My partner want's to change the data in his side of the site.

It's set up to load different databases on different servers and this does work.

Is there a way that I can get the info from the header on the web browser and then determine what data base that I should open?
0
Comment
Question by:breeze351
  • 2
  • 2
5 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39760341
If you mean "Can PHP detect which URL was used to access a common PHP script set?" The answer is yes.  Look in $_SERVER['HTTP_HOST']
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39760481
Somehow I think in other way,  when you do http access on browser
and you have already known what url you want to type or go on browser.
 
There is a lot of $_SERVER variables you might need, please read this
http://www.php.net/manual/en/reserved.variables.server.php

Please tell us more detail of your question, so we could help you on exectly what you need.

Duncan
0
 

Author Comment

by:breeze351
ID: 39760561
I've read it the manual.  I can get the end of the url.  What it need to do is the the front of it.

IE:
http:\\langsystems.net\index.php

or

http:\\amy.langsystems.net\index.php

If I can get the line from the url, I can parse between the "http\\" and the first period  and get "amy" and then open the correct database.
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39760587
Thanks for your reply and explain. glad to see you have solved your question.
 When or after I  click submit button for my first reply post, this post has already
closed and solved.  sorry I was late to answer your question. Hope help  you
in next time.

have a nice day

Duncan
0
 

Author Comment

by:breeze351
ID: 39763102
I haven't resolved this yet.

There is one web site with a sub under it:

"langsystems.net"

"amelia.langsystems.net"

I need to change the database name to "amelia".
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now