P.Z. Low Cost CPanel Web Hosting  

Go Back   P.Z. Low Cost CPanel Web Hosting > Page-Zone Web Hosting Main Forum > General Discussion

General Discussion Anything which doesn't fit into the specific topics above. Posting limited to registered members.

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
PHP: $HTTP_SERVER_VARS Question
Old
  (#1 (permalink))
TomTech
Registered User
TomTech is on a distinguished road
 
Status: Offline
Posts: 3
Join Date: Jan 2006
Rep Power: 0
PHP: $HTTP_SERVER_VARS Question - 01-21-2006, 12:19 PM

Take the following line:

$Domain = $HTTP_SERVER_VARS["HTTP_HOST"].$PHP_SELF;

$Domain should contain the name of the location (Domain.Page) that the script executed.

Research has shown me that the amount of information obtained is up to the host (Page-Zone). In some cases it's just the domain name, and in others it's the name of the actual page.

My tests have shown that I'm only getting my domain info, and not the page info I hoped for.

Can Page-Zone clarify this?

Thanks

Tom
   
Reply With Quote
Old
  (#2 (permalink))
midwest
blink and it's over
midwest will become famous soon enough
 
midwest's Avatar
 
Status: Offline
Posts: 802
Join Date: Oct 2002
Location: Big Sky, MT
Rep Power: 78
01-21-2006, 06:20 PM

use $_SERVER
http://us3.php.net/reserved.variables
as for PHP_SELF it is up to the server, you get either the file name or the path+file name.

and the statement should not be this
$Domain = $HTTP_SERVER_VARS["HTTP_HOST"].$PHP_SELF;
but instead
$Domain = "$_SERVER['HTTP_HOST']/$PHP_SELF";
For vars to be properly interpolated they need to be enclosed in double quotes.


Ronnie Gauthier
www.instaguide.com

======================
for official page-zone support please visit
www.page-zone.com/support.shtml
   
Reply With Quote
Does Not Work
Old
  (#3 (permalink))
TomTech
Registered User
TomTech is on a distinguished road
 
Status: Offline
Posts: 3
Join Date: Jan 2006
Rep Power: 0
Does Not Work - 03-05-2006, 05:03 PM

Making the change you outline creates an Error on the $Domain Line:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

Here's the code:

================================================== =
$ip = getenv ("REMOTE_ADDR");
$Domain = "$_SERVER['HTTP_HOST']/$PHP_SELF";

mysql_select_db($database) or die("Could Not Select Database");
================================================== =

Tom
   
Reply With Quote
Old
  (#4 (permalink))
midwest
blink and it's over
midwest will become famous soon enough
 
midwest's Avatar
 
Status: Offline
Posts: 802
Join Date: Oct 2002
Location: Big Sky, MT
Rep Power: 78
04-16-2006, 04:50 PM

sorry for taking so long to reply...been busy...but now that ski season is over I'm un-busy.
After relooking at your post I don't see why I did not catch it first. Globals are off. That means you must use the long form for environmental variables.

This code works on my server
Code:
<?php
//path info and file name
$pinfo = pathinfo($_SERVER['PHP_SELF']);
$domain = $_SERVER['HTTP_HOST'];
$path = $pinfo['dirname'];
$file = $pinfo['basename'];
//output
echo "<p>&nbsp;<p>";
print_r($pinfo);
echo "<p>file name is: $file<br>";
echo "url is: $domain$path/$file";
?>


Ronnie Gauthier
www.instaguide.com

======================
for official page-zone support please visit
www.page-zone.com/support.shtml
   
Reply With Quote
Thanks For The Reply...
Old
  (#5 (permalink))
TomTech
Registered User
TomTech is on a distinguished road
 
Status: Offline
Posts: 3
Join Date: Jan 2006
Rep Power: 0
Thanks For The Reply... - 04-16-2006, 05:09 PM

No biggie on the length of time...

I've been working other aspects of life as well.

I'll look into your code as time permits.

Thanks again.

Tom
   
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Live Help



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC6
vBulletin Skin developed by: vBStyles.com
Copyright © 2002 Page-Zone Web Hosting. All rights reserved.
Smilies provided by Crack's Smilies http://www.mysmilies.com