![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | 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 |
|
| | #2 (permalink) |
| Civilians | 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 |
|
| | #3 (permalink) |
| Civilians | 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 |
|
| | #4 (permalink) |
| Civilians | 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 |
|
| | #5 (permalink) |
| Civilians | 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" |
|
| | #6 (permalink) |
| Civilians | 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" |
|
| | #7 (permalink) |
| Civilians | 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 |
|
![]() | ![]() | ![]() |