Solved

Get file names from HTTP header

Posted on 2014-01-06
5
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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 …
The viewer will learn how to count occurrences of each item in an array.

623 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