corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Quich php question


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Quich php question
MikeLamb
Member

Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
10th May 05 at 15:40   View User's Profile U2U Member Reply With Quote

How do i find out where the script was called from? Ie, the script could be called from http://anything.domain.com/script.php and i need to what the http://anything.domain.com is?

Cheers
Laney
Member

Registered: 6th May 03
Location: Leeds
User status: Offline
10th May 05 at 15:47   View User's Profile U2U Member Reply With Quote

Chop it from the $_SELF variable?
Dom
Member

Registered: 13th Sep 03
User status: Offline
10th May 05 at 15:53   View User's Profile U2U Member Reply With Quote

im sure you could get it from the headers?
MikeLamb
Member

Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
10th May 05 at 16:00   View User's Profile U2U Member Reply With Quote

so am i, cant figure it out. I thought $_SELF returned everything after the tld?
Tim
Site Administrator

Avatar

Registered: 21st Apr 00
User status: Offline
10th May 05 at 16:05   View Garage View User's Profile U2U Member Reply With Quote

$ENV{'SERVER_NAME'}
Dom
Member

Registered: 13th Sep 03
User status: Offline
10th May 05 at 16:08   View User's Profile U2U Member Reply With Quote

just use $_self, then trim it using substr ie:
$a = substr($_SELF, 0, strlen($_SELF) - strlen("*insert script filename etc*));

^ i doubt that will work as im having to do it off the top of my head, but you get the idea

Only other thing i could suggest is get the header of the server etc, but that will return the main domain name (i believe).

Could just google for an example or use pscode.com mate
Tim
Site Administrator

Avatar

Registered: 21st Apr 00
User status: Offline
10th May 05 at 16:12   View Garage View User's Profile U2U Member Reply With Quote

Sorry, incase you wanted the actual Host: header instead of the webserver's defined hostname, then you can use $_SERVER{'HTTP_HOST'}...

It's not majorly difficult
MikeLamb
Member

Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
10th May 05 at 17:12   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by Tim
Sorry, incase you wanted the actual Host: header instead of the webserver's defined hostname, then you can use $_SERVER{'HTTP_HOST'}...

It's not majorly difficult


genius, worked perfectly! Cheers

 
New Topic

New Poll

Corsa Sport » Message Board » Off Day » Quich php question 24 database queries in 0.0075159 seconds