[advanced search]
Results from the most recent live auction are here.
20 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Web Design Discussion
User Name
Password

Old 04-03-2008, 12:40 AM   · #1
stub
DNOA Member
 
stub's Avatar
 
Name: Stu
Trader Rating: (328)
Join Date: Jan 2006
Posts: 2,926
NP$: 12477.00 (Donate)
stub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatness
Capturing domain name

I would like to have a For Sale page with many domains being redirected to that page. Is there any way to capture the domain name in a variable so I can display it on the served page.


Please register or log-in into NamePros to hide ads
stub is offline  
  Reply With Quote
Old 04-03-2008, 12:57 AM   · #2
-NC-
Traveller
 
-NC-'s Avatar
 
Location: In an airport, probably
Trader Rating: (35)
Join Date: Mar 2007
Posts: 1,347
NP$: 573.28 (Donate)
-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of
Animal Cruelty Animal Rescue Ethan Allen Fund Protect Our Planet
<?php echo $_SERVER['SERVER_NAME'] ?>

edit: wait, sorry, you want to redirect them all to the same url, using forwarding?

e.g.

domain1.com -> domainforsale.com
domain2.com -> domainforsale.com

probably the most reliable way would be to include the domain in the url, e.g.

domain1.com -> domainforsale.com?domain=domain1.com
domain2.com -> domainforsale.com?domain=domain2.com

then you have $_GET['domain']

if you dont want to do that, you might be able to use the referrer property, however there is no guarantee it will always exist.

$_SERVER['HTTP_REFERER']

Last edited by -NC- : 04-03-2008 at 01:02 AM.
-NC- is offline  
  Reply With Quote
Old 04-03-2008, 02:09 AM   · #3
stub
DNOA Member
 
stub's Avatar
 
Name: Stu
Trader Rating: (328)
Join Date: Jan 2006
Posts: 2,926
NP$: 12477.00 (Donate)
stub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatness
I'm not an expert with PHP. OK. What's wrong with this...

http://www.example.com?domain=domain1.com goes to this page...

<?php
$_GET['domain']
echo "domain name is $domain";
?>

Last edited by stub : 04-03-2008 at 02:58 AM.
stub is offline  
  Reply With Quote
Old 04-03-2008, 03:05 AM   · #4
-NC-
Traveller
 
-NC-'s Avatar
 
Location: In an airport, probably
Trader Rating: (35)
Join Date: Mar 2007
Posts: 1,347
NP$: 573.28 (Donate)
-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of
Animal Cruelty Animal Rescue Ethan Allen Fund Protect Our Planet
<?php echo $_GET['domain']; ?>
-NC- is offline  
  Reply With Quote
Old 04-03-2008, 07:42 AM   · #5
stub
DNOA Member
 
stub's Avatar
 
Name: Stu
Trader Rating: (328)
Join Date: Jan 2006
Posts: 2,926
NP$: 12477.00 (Donate)
stub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatness
Fabulous! I've been working on this on-and-off for about six months! Thank you very much indeed. If I could find out how to add rep, I would.
stub is offline  
  Reply With Quote
Old 04-03-2008, 08:04 AM   · #6
-NC-
Traveller
 
-NC-'s Avatar
 
Location: In an airport, probably
Trader Rating: (35)
Join Date: Mar 2007
Posts: 1,347
NP$: 573.28 (Donate)
-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of-NC- has much to be proud of
Animal Cruelty Animal Rescue Ethan Allen Fund Protect Our Planet
lol! no problem. to add rep, you click the blue scales* icon on the left of a post, right next to the warning sign icon for reporting posts.

*i don't think it looks like scales at all

p.s. the code i gave you is really just an example, is insecure, allows anyone to put whatever they want into the address bar of their browser and have your site render it, this means they could put some nasty javascript or frame code in some links to your site.

this is much more secure:

<?php
echo preg_replace('/[^a-zA-Z0-9.-]/', '', $_GET['domain']);
?>

( only allows numbers, letters, dots and hyphens )

Last edited by -NC- : 04-03-2008 at 08:23 AM.
-NC- is offline  
  Reply With Quote
Old 04-03-2008, 01:37 PM   · #7
stub
DNOA Member
 
stub's Avatar
 
Name: Stu
Trader Rating: (328)
Join Date: Jan 2006
Posts: 2,926
NP$: 12477.00 (Donate)
stub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatnessstub Has achieved greatness
Funny. I knew it was somewhere down there, and I tried clicking on a few things (but I think I might have been right-clicking). Rep added. I think it looks like gray scales

Thank you for the revised code.
stub is offline  
  Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Proof is in the Parking Click to Watch Instant Video Hunting Moon
Advertise your business at NamePros
All times are GMT -7. The time now is 03:29 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0