XAMPP don't recognizes variables like "PHP_AUTH_USER&qu

Problems with the Windows version of XAMPP, questions, comments, and anything related.

XAMPP don't recognizes variables like "PHP_AUTH_USER&qu

Postby icaroscherma » 11. November 2008 08:09

Hi...
Here the newer XAMPP isn't recognizing some default php variables like "PHP_AUTH_USER", "PHP_AUTH_PW"...
I remember something that in a near past, I had to add some DLLs in httpd.conf (of apache) or was in php.ini (in apache/bin folder)...
Anyone can help me?
Thanks,
Ícaro R. Scherma.
icaroscherma
 
Posts: 4
Joined: 11. November 2008 08:04
Location: Natal/RN, Brazil

Postby Wiedmann » 11. November 2008 13:37

Here the newer XAMPP isn't recognizing some default php variables like "PHP_AUTH_USER", "PHP_AUTH_PW"...

You mean $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']? Well, these are only set after a HTTP authentication.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby icaroscherma » 11. November 2008 16:16

I know, but it HAVE a HTTP Authentication, and it works in my hosting service, but locally it haves a Infinite Looping on LOGIN... I put, and put again, but its like I'm putting the wrong user/pass...
So I've changed "Display Errors" (of php) to "E_ALL" only, so It shows Everything... And after that, It shows that PHP_AUTH_USER, PHP_AUTH_PW are Undefined Variables... So, PHP don't recognizes the user and pass that I input, that was the reason that haves a Infinite Looping xD
I've read in some forums that I need to put "LoadModule php4_module" in Apache, but I've tried some things and no success =x
Please, someone help me T_T
icaroscherma
 
Posts: 4
Joined: 11. November 2008 08:04
Location: Natal/RN, Brazil

Postby Nobbie » 11. November 2008 16:52

register_globals ...

(The 1.000.000th request about register_globals).
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Postby Wiedmann » 11. November 2008 18:27

I know

So you are really talking about $_SERVER['PHP_AUTH_USER'] and not $PHP_AUTH_USER?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby icaroscherma » 11. November 2008 19:27

I've tried with "Register Globals" On and Off... And tried with $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_USER, I'm useing other server, and now, the error its other..

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\wamp\www\opinatorio\senha.php on line 6

<?php
include ("config.php");

$acesso = false;
$user_w = mysql_query("SELECT * FROM usuario");
while($user = mysql_fetch_array($user_w)){

$PHP_AUTH_USER = strtoupper($PHP_AUTH_USER);
$PHP_AUTH_PW = strtolower($PHP_AUTH_PW);

if (($PHP_AUTH_USER == $user['usuario']) && (md5($PHP_AUTH_PW) == $user['usuario_codigo'])){
$user_sw = mysql_query("SELECT * FROM usuario WHERE usuario='$PHP_AUTH_USER' && usuario_codigo='".$user['usuario_codigo']."'");
$user_section = mysql_fetch_array($user_sw);
$sessao = $user_section['nivel'];
$acesso = true;
}
}
if (!$acesso){
header('WWW-Authenticate: Basic Realm="Camaroes Login"');
header('HTTP/1.0 401 Unauthorized');
echo 'Usuario e/ou Senha Invalidos!';
exit;
}
?>


Somebody knows why it's happening that? (The text is in Portuguese Brazilian).
\o\[/quote]
icaroscherma
 
Posts: 4
Joined: 11. November 2008 08:04
Location: Natal/RN, Brazil

Postby Wiedmann » 11. November 2008 19:41

And tried with $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_USER,

Only $_SERVER['PHP_AUTH_USER'] is correct. (There is no guarantee you have $PHP_AUTH_USER on a server).

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\wamp\www\opinatorio\senha.php on line 6

There is a problem with the query on line 5.
--> test the result from mysql_query for an error. And if there is one, use the function mysql_error() to see which one.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby icaroscherma » 11. November 2008 20:29

Wiedmann, how exactly can I do that? xD
\o\
icaroscherma
 
Posts: 4
Joined: 11. November 2008 08:04
Location: Natal/RN, Brazil

Postby Wiedmann » 11. November 2008 21:07

--> test the result from mysql_query for an error. And if there is one, use the function mysql_error() to see which one.

how exactly can I do that?

From the PHP manual http://de.php.net/manual/en/function.mysql-query.php (Example 1):
Code: Select all
$user_w = mysql_query("SELECT * FROM usuario");
if (!$user_w) {
    die('Invalid query: ' . mysql_error());
}
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 147 guests