Getting Username from htaccess
Posted: Wed Jul 13, 2005 10:05 pm
Hi Gang,
We've been using the following code to get the username form the htaccess auth mechanism and passing it too the script. Now i've tried to install this onto php 4.3.9-3 and it's not working.
I was recieving a security error so I added "rvar_" in the connect.inc script and that seemed to fix that.
The next errors are :
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 45
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 46
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 47
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 48
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 49
I've tried to fix this by changing the request to the following, but still get the error.
Can anyone shed any light on this? I've run out of things to try.
Ta, Will.
We've been using the following code to get the username form the htaccess auth mechanism and passing it too the script. Now i've tried to install this onto php 4.3.9-3 and it's not working.
Code: Select all
include("connect.inc");
$username = $_SERVER["REMOTE_USER"];
// query the database, team leaders and admin can be here, no one else can
$result1 = mysql_query("SELECT * FROM users WHERE userName='$username'");
$result2 = mysql_query("SELECT * FROM teamLeaders WHERE userName='$username'");
$result3 = mysql_query("SELECT * FROM salesReps WHERE userName='$username'");
$result4 = mysql_query("SELECT * FROM executives WHERE userName='$username'");
$result5 = mysql_query("SELECT * FROM admin WHERE userName='$username'");
// assign the query as an array of results
$userPass = mysql_fetch_array($result1);
$tlPass = mysql_fetch_array($result2);
$salesPass = mysql_fetch_array($result3);
$execPass = mysql_fetch_array($result4);
$adminPass = mysql_fetch_array($result5);Code: Select all
import_request_variables("gP", "rvar_");mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 45
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 46
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 47
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 48
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /production/www/intranet/html/custcomplaints/index.php on line 49
I've tried to fix this by changing the request to the following, but still get the error.
Code: Select all
$result = mysql_query("SELECT * FROM users WHERE userName='$username'");
$query_data = mysql_fetch_array($result);
$userPass = $query_data["userPass"];Ta, Will.