473,382 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Detecting and displaying the domain name

Hi,

I have a site that has several domains pointing to its DNS.
I would like to implement a script that will grab the domain name visitors typed in, and display it
on the page. Is there a way to do it?
Thanks,

--
Charles.
Jul 17 '05 #1
4 23863

"Charles" <no*****@nothing.com> schreef in bericht
news:bq*************@ID-208473.news.uni-berlin.de...
Hi,

I have a site that has several domains pointing to its DNS.
I would like to implement a script that will grab the domain name visitors typed in, and display it on the page. Is there a way to do it?
Thanks,


$_SERVER['HTTP_HOST'] (use phpinfo() to lookup vars like this)
JW

Jul 17 '05 #2
Thanks, it's working fine. Is there a way to display only the name with www and extention such as:

- name

instead of

- www.name.com

Thanks again,

--
Charles.
Jul 17 '05 #3

"Charles" <no*****@nothing.com> schreef in bericht
news:bq*************@ID-208473.news.uni-berlin.de...
Thanks, it's working fine. Is there a way to display only the name with www and extention such as:
- name


Shure, per example with:

$name = ereg_replace(
"^(www.)?([^.]+).[^.]+$", "\\2",
$_SERVER['HTTP_HOST']
);
JW

Jul 17 '05 #4
Wow thank you very much Janwillem, you're very helpful.
Have a nice week-end,

--
Charles.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Damon Morbius | last post by:
Is there a standard way to detect the device a visitor is using to access your site (i.e. Cell phone, handheld, web browser). Ultimately my goal is to detect what kind of device a visitor is using...
1
by: Luthor | last post by:
Hi, Say I'm on the site www.xyz.com and on a certain page if the user leaves the domain xyz.com, I have a popup cme up w/ stuff. I don't need to know what the new domain is, I just want to know...
1
by: Dave Parkinson | last post by:
Can anyone help. I'm new to Javascript so be gentle. I have 2 registered domains which are set up to redirect to my homepages which are on a different ISP. I have been told that it is possible to...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
9
by: D. Shane Fowlkes | last post by:
I'm using SQL Server 2000 and on my page, I'm simply creating a SQLDataReader and filling in Labels with the retrieved (single) record. However, how can I prevent from getting errors when a field...
2
by: naijacoder naijacoder | last post by:
I want to have a asp page that would be displaying different contents depending on the user that logged in. And the data would be populated from the Database! Any ideas on how to do this ***...
3
by: andrew sargent | last post by:
Hi, I have two domain names pointing to the same webspace, but i want them to be directed to seperate directories on the server: www.web1.com -> dir "Web1" www.web2.com -> dir"Web2" The...
1
by: Tuong | last post by:
I have a situation where i have a form that contains a webbrowser control. With this I was able to implement an application that can browse websites. One particular website i visited opens up...
1
by: Roshan | last post by:
Hi, I wanted a reliable way of detecting if a given NTAccount object represents a user account or group account. I was using SecurityIdentifier.IsAccountSid() method but this doesn't work as I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.