Questions tagged [server-variables]

87 questions
2
votes
1 answer

what is equivalent function of $_SERVER['HTTP_REFERER'] in mobile web application

I'm developing a PHP website as an application of Android, but there is a problem I stuck. I have a back button, where I write below logic using $_SERVER['HTTP_REFERER'] to find out the page from where it comes..but when I watch this website on…
xkeshav
  • 53,360
  • 44
  • 177
  • 245
2
votes
4 answers

DOCUMENT ROOT variable on PHP-IIS

Does the $_SERVER["DOCUMENT_ROOT"] variable exist on IIS running PHP? Earlier I thought this variable is Apache specific and on IIS, you have to emulate it by string manipulation of SCRIPT_NAME and SCRIPT_FILENAME variables but I now see this…
Salman A
  • 262,204
  • 82
  • 430
  • 521
2
votes
0 answers

JetBrains PhpStorm Not Resolving Server Variable?

The following line... require_once $abs_us_root.$us_url_root.'users/includes/header.php'; is producing the IDE error: Path '/var/www/projectName$us_url_rootusers/includes/header.php' not found. the actual path to the file is…
xendi
  • 2,332
  • 5
  • 40
  • 64
2
votes
1 answer

Asp 5 ServerVariables

I am in the progress of rewriting some code to work with ASP 5. The old code does the following: string Local_IP=Request.ServerVariables["LOCAL_ADDR"]; string HTTP_reverse_VIA = Request.ServerVariables["HTTP_REVERSE_VIA"]; How do I get the…
René Madsen
  • 213
  • 2
  • 10
2
votes
4 answers

$_SERVER['REMOTE_HOST'] empty for some users

I have activated HostnameLookups Double in my Apache2 configuration, so that I can store user's remote hosts and rest assured that their IP addresses are real and not spoofed. However, I noticed that for quite a few of my 'users' (people entering…
user1111929
  • 6,050
  • 9
  • 43
  • 73
2
votes
1 answer

How to use the path from $_SERVER variable, modify it and assign it to some variable in PHP?

As we know $_SERVER array is wriiten by web server and it's not a good practice to make any change in it. Now the scenario is I'm using this $_SERVER array in my project and I want to temporarily change the value of one of array elements of $_SERVER…
PHPLover
  • 1
  • 51
  • 158
  • 311
2
votes
2 answers

Accessing $_SERVER variables from command line

How do I access $_SERVER variables I've set from the command line in PHP? When I try to call a PHP method I've created I get the following error, which shows that all the $_SERVER variables are only defined when one calls my app via its URLs, i.e.,…
2
votes
3 answers

How to tell if web visitor is a robot

On an ASP website, is there a way to tell whether a visitor is a robot? I'm thinking there might be a parameter in the ServerVariables collection that could be used, in a similar way to HTTP_X_FORWARDED_FOR and REMOTE_ADDR can be used to get the…
greener
  • 4,989
  • 13
  • 52
  • 93
2
votes
1 answer

Setting HTTP_X_FORWARDED_FOR server variable in classic ASP

I need to set the HTTP_X_FORWARDED_FOR value in the Request.ServerVariables collection. I'm trying with Fiddler (see this article). So I set up a custom HTTP request: GET http://myhost/ HTTP/1.1 http_x_forwarded_for: my.fake.ip.1, my.fake.ip.2 Host:…
2
votes
2 answers

server variable document root is not playing nice with file_exists when virtual folder is involved

I've got a virtual folder on IIS. When I do a server document root, I'm not getting file_exists find the files. But interestingly, if I use include (or require directives for that matter) same files being found. example $full_path =…
Average Joe
  • 4,521
  • 9
  • 53
  • 81
1
vote
2 answers

Jquery / .Net Passing a Server Variable in the Data of Ajax Call

I want to take a .Net server variable and user that in the data of an Ajax call. $.ajax({ url: "get_user_info.aspx", data: "user_id=<%=UserID%>" }); However, I get an Object Expected error with the above. The UserID is an int in the C#…
User970008
  • 1,135
  • 3
  • 20
  • 49
1
vote
0 answers

Blazor Server App - Supporting Windows and Non-Windows Users In The Same App

My organization creates apps that must support employees on two entirely separate networks (let's call them network "A" and network "B"). Applications on network "A" must always use Windows Authentication. Since network "B" is entirely separate and…
1
vote
1 answer

Using $_server['document_root'] on localhost/the wild web

On my WAMP setup, I'm using $_server['document_root'] in a number of filepaths.. I had been using a static $ROOT variable, but thought it would be nice not to have to edit that constant when uploading the site. Unfortunately, on my WAMP setup,…
Damon
  • 10,493
  • 16
  • 86
  • 144
1
vote
1 answer
1
vote
1 answer

phpmyadmin server variables and session values

I'm going to use utf8mb4. Also some of my variables must be utf8mb4 that mentioned here. I set them from phpmyadmin Variables menu. But some of changes to utf8mb4 but it's session value is still uft8. And when I run this command: SHOW VARIABLES…
Vahid Najafi
  • 4,654
  • 11
  • 43
  • 88