473,387 Members | 1,859 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,387 software developers and data experts.

reading subdomain

tolkienarda
316 100+
hi all
i have a wildcard subdomain that will redirect all subdomains to one page. this page is a php script that will read the what subdomain they entered and if it is valid it will redirect to the apporiate page and if not it will go the the home page. the reason i am doing this is because of a client who apparently has major intelligence issues. but the problem is that i don't know how to get the full url they entered in.
'http://subdomain.dumbclient.com' the script is realy quite simple but i can't get that url and it is probaly some function that i just can't find below is the code that will process that so you can understand what i am doing a little better.

[PHP]
<?php
$a = 'http://subdomain.yoursite.com'; //will need the function to get the domain here
$sub = explode('.', $a);
$new_sub = explode('/', $sub[0]);


echo '<pre>';
echo var_dump($new_sub);
echo '</pre>';
//do weird stuff with $new_sub[2]
?>
[/PHP]

thanks for all past present and future help

eric
Mar 23 '07 #1
2 1969
tolkienarda
316 100+
hi all
i found a function that will work

for all those who want to use it here you go

[PHP]
function selfURL()
{
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2)
{
return substr($s1, 0, strpos($s1, $s2));
}
[/PHP]

and have a var = selfURL()
and it works perfectly

thanks

eric
Mar 23 '07 #2
ronverdonk
4,258 Expert 4TB
Thanks for sharing your solution.

Ronald :cool:
Mar 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Leon | last post by:
How do I point a sub-domain to a sub-directory or .aspx page of my site using asp.net? I'm using a shared hosting service, that does not offer subdoman forwarding. however, you can write your...
2
by: Abdul Qadir Khan | last post by:
Hi, We have different web sites e.g www.abc.com, www.xyz.com I want to read cookies written by www.abc.com from www.xyz.com and vice versa. Please advise. Thanks AQ.
2
by: Bill Borg | last post by:
Hello, I have a couple web services that I use across my apps. My isp supports exposing them either via subdomain (e.g. services.mydomain.com) or subfolder (e.g. mydomain.com/services). Are...
1
by: perspolis | last post by:
Hi If I want to create subdomain for my site dynamicaly how can I do that with ASP.NET? or is it possib;e to create subdomain with IIS?? thanks
1
by: thomas | last post by:
Hello all, It seems like subdomain forwarding prevents ASP.Net session state from working correctly. Example: two websites http://www.jgphotographers.com/test and...
0
by: Greg | last post by:
Is it possible for authentication using asp.net membership to persist from a site to a subdomain? The scenario I want to provide is: User browses to the page somesite.com and logs in. User...
3
by: a2rodger | last post by:
I am using the following function and parse_url() to attempt to grab the subdomain from my sites url function selfURL() { $s = empty($_SERVER) ? '' : ($_SERVER == "on") ? "s" : ""; $protocol =...
0
by: devilsjunk | last post by:
Hello Everybody, In my web application I have created an interface where, if any user register then a subdomain will be created with the user name of the user link this manner E.G. :-...
1
by: Josh | last post by:
I have a question about subdomains. I would like my website to have subdomains that essentially show my regular main website, except that the subdomain passes as a variable on all pages so that I...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.