$_SERVER[' ?? ']

May 13, 2007

if i go:
$homePage = $_SERVER['REQUEST_URI'];
i get:
home page = /indie/index.php?list=top

if i go:
$homePage = basename($_SERVER[PHP_SELF]);
i get:
home page = index.php

what i want is something in the middle:

home page = index.php?list=top

so it only shows the base script name, but also includes the parameters.

View 4 Replies



Is there a way to use opendir() using some sort of absolute path?
I want a file to open the same directory on my site, no matter from what directory it is called.

For example, I have the following variables, but no combination seems to work for me.

Q: Does opendir() ONLY deal with relative paths?
Q: If opendir() works with absolute path, am I missing something?PHP Code:

View 1 Replies


I'm on HostMonster and I'm trying to setup cron to play nicely with a Drupal install I have running and I'm running into problems trying to code for a condition that says, "IF I'm the server and I'm making the request to do CRON, then do the following..."Basically (in layman's terms), I'm having a hard time trying to figure out how I should code for cron requests from the server, which brings me to the following questions:1.) Do cron jobs always execute from the host server? For example, if $_SERVER[SERVER_ADDR] is always "", does this mean that the 583 bytes sent for cron jobs always come from the same IP address or are there exceptions to this? The reason I ask this is because I have a poor man's byte counter in this cron code I'm working with that sets up a file read and keeps you in the reading loop until the byte count reaches 583 (which, according to my IP logs, is the number of bytes sent with each cron "ping" that gets made.) The code isn't firing, however, because I'm having a hard time making the code run from either cron requests or else from an inconsistency between the IP comparison code I have.2.) Before any cron code gets executed, I have "ignore_user_abort(true);" called at the beginning of the page. Will this effectively process all proceeding code thereafter if cron pings the page? In other words, will using this make the page get processed as if someone traveled to the cron.php page in their browser?

View 7 Replies

Setting A $_SERVER Value ($_SERVER['something']) Using Apache .htaccess?

Is it possible using .htaccess or other apache powers to set a custom server value in the php array $_SERVER.

for example
if($_SERVER['is_special']) {
echo "Yeah for us!";
} else {

I realize I ask a lot of questions that the answer is no so feel free to say so.

View 2 Replies


what's the difference between them? how to use them. i print_r($_SERVER). there is no result of $_SERVER['PATH_INFO'] and $_SERVER['PORIG_PATH_INFO'] .why? how to enable it.i have read the php manual on them, but still don't understand them.

View 2 Replies


What is the difference between:


View 3 Replies


If i need to fix the page name from which the click was originated, what is better to fix: $_SERVER['PHP_SELF'] or $_SERVER['HTTP_REFERER']? I mean the click to an external resource.

View 1 Replies


I simply love this site! Hope you all have a great Christmas holiday, and wish everyone have a prosperous 2010!

Anyway, I have a quick question regarding the global variables

View 5 Replies


what's the difference between them? how to use them. i [ICODE]print_r($_SERVER).[/ICODE] there are no result of $_SERVER['PATH_INFO'] and $_SERVER['PORIG_PATH_INFO'] .why? how to enable it.i have read the php manual about them, but still don't understand

View 1 Replies


I am having trouble with this line:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >

I get this error:

Parse error: parse error, unexpected '?'

View 1 Replies


I have a file called index.php (localhost/blabla/index.php), and my mind has just gone blank and I cant remember how to get the file path without the file info... for example I need to get


I am sure it is using $_SERVER but which argument =/

View 4 Replies

$_SERVER Get Just The Url?

is there a way to get just the url?

for instance if I have an address such as Domain Name/Oilers/oilers.html

in every instance I do $path = $_SERVER['SCRIPT_NAME']; I get /Oilers/oilers.html

If i just want /Oilers/ with the file running name at the end, how would I go about?

View 4 Replies

Using $_SERVER['http_referer']

I'm using $_SERVER['http_referer'] to see which site the visitors on my site
is coming from. It works OK, but as we all now, not all sites give
http_referer a value, i.e. miniclip.com.
What I DON'T understand is how my web-statistics program (awstats) can tell
me that a lot of the visitors on my site comes from miniclip.com. How can
awstats know, and http_referer don't?

View 3 Replies


what is exact sense of $_SERVER['HTTP_USER_AGENT'] output?

View 1 Replies

$_SERVER Not Working

I really loosing sleep over this one. I have php 4.4 running on Apache
2.... php works fine. phpinfo() retuns everything as it should..
However when I try to print anything using $_SERVER e.g $_SERVER
['HTTP_HOST']... it returns nothing. Then I realized that even $_GET
and $_POST are not working. All the uper globals are not working. They
just come back with e.g Array ['HTTP_HOST']...

View 7 Replies

JSP Equivalent To PHP $_SERVER?

I looked up System.getProperties, but to be honest, I have no clue how
to use it in light of what I can do in PHP, which is this:

<?php echo $_SERVER['HTTP_USER_AGENT'] . ' ' . $_SERVER['SERVER_URI'];

it would be very nice to find the JSP equivalent of <? phpinfo(); ?>
(anyone know who knows both PHP and JSP?) but until then, what on earth
do I do?

View 2 Replies

$_SERVER['PATH_INFO'] Where Is It Under Php 4.3.8 ?????

I compiled a recent version of php 4.3.8 on Suse 9.0 Pro with apache
1.3.28 that was a precompiled for Suse as an rpm. When I look at
phpinfo(), I do not see the environment setting $_SERVER['PATH_INFO']
however, I can see this setting on a different box running windows
and on yet another box running linux. Is there something I have to
set in the configuration for the value to show up?

View 2 Replies

$_SERVER['SCRIPT_FILENAME'] = '/php/php.exe'?

I am trying to use script filename to give me the entire path and
filename of the current page. For some reason though it is giving me
the value of '/php/php.exe'. Why might this be?

In my Apache http.conf file I do have the line:

Action application/x-httpd-php "/php/php.exe"

Might this have something to do with it?

View 1 Replies


can someone explain me with an easy example what the function for?

I've read on the php.net,

View 4 Replies


I'm working on a large intranet group site with a lot of pages, file types,
folders, subfolders, etc. I am using the include ('../includes/file.php') ,
but I would like to have a single snippet that will work for all .php/.html
pages in all subfolders. I have seen the $_SERVER['DOCUMENT_ROOT']
indicated as a way to access the root of the website without using ../ for
each folder you have to pass up through. However, I cannot get this to work
for me. I've seen recommendations for it's use in FAQs, etc. online, they
all seem to be a little bit different, but none of the formats (assign to a
variable, etc.) work for me. We're using PHP 4.3.2

View 4 Replies


I was wondering, is there a safer alternative to $_SERVER['HTTP_REFERER']? As I understand, $_SERVER['HTTP_REFERER'] can easily be surpassed by hackers.

View 1 Replies


This is my current code:

<a href='.$_SERVER['FULL_URL'].'>Here</a>

It works with no problems the link becomes the full url including arguments. However when I change the code to this the link becomes wrong ( I want to add some arguments to the link):

$newarg = '&newarg=egfesgseg'
<a href='.$_SERVER['FULL_URL'].$newarg.'> Here</a>

how to fix this?

View 3 Replies


I want to know when we should use $_SERVER['QUERY_STRING'] and how it works.. and the difference with $_SERVER['PHP_SELF'] also ?

View 1 Replies


I want to check to see if my webpage was directly accessed or to see where it was linked from, but if I use this variable($_SERVER['HTTP_REFERER']) it gives me an error when it was directly accessed. I want to be able to either catch the error or check to see if it exsists first before I use it. How do I do it? Either one is fine.

View 3 Replies


I have made a .htaccsess file with the following in it:

ErrorDocument 404 /status/status.php

And the status.php has the code:


Now I read: In the folder on the server if I make up a filename it would redirect to the status.php

Now if i make up a file name (eg. fake.php) it redirects to the status.php fine but the $url variable comes up with status.php and not the fake.php

Anything I am doing wrong?

View 3 Replies


I'm having a problem using $_SERVER['HTTP_REFERER']; I have a website and I want to know where new members are coming from before they click on my home page. The home page of my site does have a .php extension. I am using $page = $_SERVER['HTTP_REFERER']; but for some reason it will not register the information I need. I have tried other variables such as $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_USER_AGENT'] and these work perfectly. Any ideas on why $_SERVER['HTTP_REFERER'] won't work. Yes, I have tried going to the home page from a link outside of my site. I've tried this function using javascript and it works, only problem is I don't know how to change a javascript variable into a php variable. Any ideas on that one too?

View 6 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved