Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help.

Google
Reply
 
LinkBack Thread Tools Display Modes
Old 05-20-2007, 5:33 PM   #1
David Cain
 
David Cain's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Calling PHP file

I am just wondering if there is a PHP function that returns the file
name or domain name of where the file/script is located that called the
PHP script in question?

Thanks in advance.
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Advertisements
Old 05-20-2007, 5:33 PM   #2
Floortje
 
Floortje's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Calling PHP file

David Cain schreef:
> I am just wondering if there is a PHP function that returns the file
> name or domain name of where the file/script is located that called the
> PHP script in question?
>
> Thanks in advance.


Hi, take a look at this !

http://www.php.net/reserved.variables

--
Arjen
http://www.hondenpage.com
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-20-2007, 5:33 PM   #3
AlmostBob
 
AlmostBob's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Calling PHP file

http://php.net/reserved.variables
Predefined variables

(part of the page)
____________
Server variables $_SERVER
$_SERVER is an array containing information such as headers, paths, and
script locations. The entries in this array are created by the web server.
There is no guarantee that every web server will provide any of these;
servers may omit some, or provide others not listed here. That said, a large
number of these variables are accounted for in the » CGI 1.1 specification,
so you should be able to expect those.


'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted
'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
______________

something like onscreen display
<? php
echo $_SERVER['REMOTE_ADDRESS'];
echo $_SERVER['HTTP_REFERER'];
?>

or write it to a file,

<?php //stats.php
// Get the user stats.
$getdate = date( 'd-m-Y, H:i:s' );// Get the date.
$user_ip = $_SERVER['REMOTE_ADDR'];// Get the users IP.
$user_browser = $_SERVER['HTTP_USER_AGENT'];// Get the browser type.
//see if its worth rewriting the page to support multiple browsers
$referer = getenv("HTTP_REFERER");// Get the refering page. another approach
as well as $_server
// Look for the text file and open it for writting.
$file = "./logfile.csv";// define the file.
//csv files import easily in excell for analysis, file has to be chmod
writeable
$fp = fopen($file, "a+");//open file for writing.
// Write the user stats into the text file.
fputs ($fp, "$user_ip,$getdate, $referer\n"); //comma separated values, my
choice any other format you wish
fclose($fp);// Close the text file.
?>

or get any of the premade php monitor scripts and see how they did it,
http://www.bbclone.de is an example

--
If at first you dont succeed
try try try again
If at first you do succeed
try not to look surprised

_
"David Cain" <david@shesurf.ws> wrote in message
news:4648d2af$0$16033$afc38c87@news.optusnet.com.a u...
> I am just wondering if there is a PHP function that returns the file
> name or domain name of where the file/script is located that called the
> PHP script in question?
>
> Thanks in advance.



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-20-2007, 5:33 PM   #4
AlmostBob
 
AlmostBob's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Calling PHP file

dammit - long lines text wrapped

_
"AlmostBob" <anonymous1@discussions.microsoft.com> wrote in message
news:u652i.9661$V75.4901@edtnps89...
http://php.net/reserved.variables
Predefined variables

(part of the page)
____________
Server variables $_SERVER
$_SERVER is an array containing information such as headers, paths, and
script locations. The entries in this array are created by the web server.
There is no guarantee that every web server will provide any of these;
servers may omit some, or provide others not listed here. That said, a
large
number of these variables are accounted for in the » CGI 1.1 specification,
so you should be able to expect those.


'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted
'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
______________

something like onscreen display
<? php
echo $_SERVER['REMOTE_ADDRESS'];
echo $_SERVER['HTTP_REFERER'];
?>

or write it to a file,

<?php //stats.php
// Get the user stats.
$getdate = date( 'd-m-Y, H:i:s' );// Get the date.
$user_ip = $_SERVER['REMOTE_ADDR'];// Get the users IP.
$user_browser = $_SERVER['HTTP_USER_AGENT'];// Get the browser type.
//see if its worth rewriting the page to support multiple browsers
$referer = getenv("HTTP_REFERER");// Get the refering page. another
approach
// as well as $_server
// Look for the text file and open it for writting.
$file = "./logfile.csv";// define the file.
//csv files import easily in excell for analysis, file has to be chmod
// writeable
$fp = fopen($file, "a+");//open file for writing.
// Write the user stats into the text file.
fputs ($fp, "$user_ip,$getdate, $referer\n"); //comma separated values, my
// choice any other format you wish
fclose($fp);// Close the text file.
?>

or get any of the premade php monitor scripts and see how they did it,
http://www.bbclone.de is an example

--
If at first you dont succeed
try try try again
If at first you do succeed
try not to look surprised

_
> "David Cain" <david@shesurf.ws> wrote in message
> news:4648d2af$0$16033$afc38c87@news.optusnet.com.a u...
> > I am just wondering if there is a PHP function that returns the file
> > name or domain name of where the file/script is located that called the
> > PHP script in question?
> >
> > Thanks in advance.

>
>



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-20-2007, 5:33 PM   #5
Alan Jones
 
Alan Jones's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Calling PHP file

On Tue, 15 May 2007 07:20:47 +1000, David Cain <david@shesurf.ws>
wrote:

>I am just wondering if there is a PHP function that returns the file
>name or domain name of where the file/script is located that called the
>PHP script in question?
>
>Thanks in advance.


$_SERVER used with one of several reserved variables will do that.
I like... $_SERVER['PHP_SELF']

Here's how you might use it...

<?php if ($_SERVER['PHP_SELF'] == '/index.php')
{include('signature.php');}?>

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 05-20-2007, 5:33 PM   #6
Tom
 
Tom's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Calling PHP file


"David Cain" <david@shesurf.ws> wrote in message
news:4648d2af$0$16033$afc38c87@news.optusnet.com.a u...
> I am just wondering if there is a PHP function that returns the file
> name or domain name of where the file/script is located that called the
> PHP script in question?
>
> Thanks in advance.


From my understanding PHP pages are normally access from a web browser so
you may be looking for "referrer" information that is typically logged in
your web servers access_log. If may be easier to find a web stats program
and track the information that way. Either way though there is a chance
people can be accessing with web browsers that jumble up the referral
information so that may not always be accurate.

Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Featured Websites
Free Space
Free Space
Free Space Free Space
Reply
Tags: , ,




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

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
file recovery tool terry brian Operating Systems And Software 5 05-22-2007 6:15 PM
How do I read a php file into a php program boombangabang PHP 2 05-20-2007 5:33 PM
Free FILE hosting modric Web Site Hosting 6 07-31-2006 11:15 AM
File Recovery Software FilleFolle Mac 0 07-31-2006 6:44 AM


Featured Websites




All times are GMT +1. The time now is 6:02 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98