Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 04-14-2005, 04:00   #1 (permalink)
Viper
Civilians

 
Default How to do this in PHP?

Not sure if any of you will know but how do I do what <!--#echo
var="HTTP_HOST" --> does in a .shtml in .php?

--
Viper
Are you seeking revenge?
http://www.seekingrevenge.com


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 04-14-2005, 04:00   #2 (permalink)
Chris Hope
Civilians

 
Default Re: How to do this in PHP?

Viper wrote:

> Not sure if any of you will know but how do I do what <!--#echo
> var="HTTP_HOST" --> does in a .shtml in .php?


<?php print $_SERVER['HTTP_HOST']; ?>

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2005, 04:00   #3 (permalink)
Viper
Civilians

 
Default Re: How to do this in PHP?

Chris Hope wrote:
> Viper wrote:
>
>> Not sure if any of you will know but how do I do what <!--#echo
>> var="HTTP_HOST" --> does in a .shtml in .php?

>
> <?php print $_SERVER['HTTP_HOST']; ?>


Thanks was just heading back to say I got <? echo $HTTP_HOST; ?> to work...
Any difference between the 2?

--
Viper
Are you seeking revenge?
http://www.seekingrevenge.com


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2005, 04:00   #4 (permalink)
Chris Hope
Civilians

 
Default Re: How to do this in PHP?

Viper wrote:

> Chris Hope wrote:
>> Viper wrote:
>>
>>> Not sure if any of you will know but how do I do what <!--#echo
>>> var="HTTP_HOST" --> does in a .shtml in .php?

>>
>> <?php print $_SERVER['HTTP_HOST']; ?>

>
> Thanks was just heading back to say I got <? echo $HTTP_HOST; ?> to
> work... Any difference between the 2?


$HTTP_HOST requires the register globals configuration option to be set
and this has been deprecated for some time now, although it will still
be enabled on most hosts to prevent older scripts being broken.

the $_SERVER and other arrays were introduced to avoid some security
issues and are the "proper" way of doing things.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2005, 04:00   #5 (permalink)
Steve Sobol
Civilians

 
Default Re: How to do this in PHP?

Viper wrote:
> Not sure if any of you will know but how do I do what <!--#echo
> var="HTTP_HOST" --> does in a .shtml in .php?
>


<? echo $_SERVER["HTTP_HOST"] ?>

--
JustThe.net - Apple Valley, CA - http://JustThe.net/ - 888.480.4NET (4638)
Steven J. Sobol, Geek In Charge / sjsobol@JustThe.net / PGP: 0xE3AE35ED

"The wisdom of a fool won't set you free"
--New Order, "Bizarre Love Triangle"
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2005, 04:00   #6 (permalink)
Steve Sobol
Civilians

 
Default Re: How to do this in PHP?

Viper wrote:
> Chris Hope wrote:
>
>>Viper wrote:
>>
>>
>>>Not sure if any of you will know but how do I do what <!--#echo
>>>var="HTTP_HOST" --> does in a .shtml in .php?

>>
>><?php print $_SERVER['HTTP_HOST']; ?>

>
>
> Thanks was just heading back to say I got <? echo $HTTP_HOST; ?> to work...
> Any difference between the 2?


Yes. Some older installations of PHP set things up so the $_SERVER, $_COOKIE,
$_GET and $_POST arrays get extracted to scalar variables. However, this may
cause some security issues so newer PHP versions default to having it off,
which I believe to be a good idea. To be safe, use the method described by
Chris and myself. Otherwise $HTTP_HOST might be undefined.



--
JustThe.net - Apple Valley, CA - http://JustThe.net/ - 888.480.4NET (4638)
Steven J. Sobol, Geek In Charge / sjsobol@JustThe.net / PGP: 0xE3AE35ED

"The wisdom of a fool won't set you free"
--New Order, "Bizarre Love Triangle"
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-14-2005, 04:00   #7 (permalink)
Don
Civilians

 
Default Re: How to do this in PHP?

On 13 Apr 2005 Viper wrote in alt.www.webmaster

> Chris Hope wrote:
>> Viper wrote:
>>
>>> Not sure if any of you will know but how do I do what <!--#echo
>>> var="HTTP_HOST" --> does in a .shtml in .php?

>>
>> <?php print $_SERVER['HTTP_HOST']; ?>

>
> Thanks was just heading back to say I got <? echo $HTTP_HOST; ?> to work...
> Any difference between the 2?
>


What's the difference between "print" and "echo" as used in php?

--
Don
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 11:24.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.88089 seconds with 18 queries