Solved

Get file names from HTTP header

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

756 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