Solved

Get file names from HTTP header

Posted on 2014-01-06
5
230 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

747 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

12 Experts available now in Live!

Get 1:1 Help Now