Trouble with PHP server script
| From: | Robert Cox | Date: | Mon, 11 Feb 2008 03:09:36 +0000 |
| Subject: | Trouble with PHP server script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-269064@lists.php.net to get a copy of this message | ||
Is it possible to use the "$_SERVER['PHP_AUTH_USER'];" construct in a URL
forwarded site? I am trying to find the authorised user id so that I can
access an SQL database with it. Anyone got some ideas?
PHP looks like this....
<?php
//Get User
$user = $_SERVER['PHP_AUTH_USER'];
// Get User type
$db = mysql_connect(localhost, ....., .....) or die("Can't connect to
database: ".mysql_error());
mysql_select_db(................) or die("Can't select database:
".mysql_error());
$query = "SELECT * FROM user WHERE staffid LIKE $user";
$result = mysql_query($query) or die ('Not a valid User: ' .
mysql_error());
....
?>