Re: [PHP-DB] use of undefined constant

2006-10-26 Thread [EMAIL PROTECTED]

- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>
To: "Zbigniew Szalbot" <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, October 26, 2006 9:41 AM
Subject: Re: [PHP-DB] use of undefined constant


> Zbigniew Szalbot wrote:
> > Hello again,
> >
> > On Thu, 26 Oct 2006, Chris wrote:
> >
> >> You'll need to change:
> >>
> >> $PHP_AUTH_USER to $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW to
> >> $_SERVER['PHP_AUTH_PW']
> >>
> >> The former variables are ok before 4.2.0 (where register_globals was
> >> off by default I think) but now they have moved to the $_SERVER
> >> super-global.
> >>
> >> Read http://www.php.net/manual/en/language.variables.predefined.php
> >
> > Thanks a lot again! I am so thankful for your help! It did work. But I
> > have a curious observation. I can only log in when I delete the password
> > and just log in using my login. As soon as I write password with field
> > type PASSWORD or OLD_PASSWORD I am not able to login. Delete the
> > password, and I am back in the program. Now I guess I will need to talk
> > to the person who wrote it for us a couple of years ago because I am not
> > sure what is going on. Presumably as this was written for mysql 3.x
> > something and php 4.0.x so I guess the code has lots of things which may
> > now be incompatible.
>
> Yeh sounds like the old code needs a bit of an overhaul.
>
> PHP_AUTH_USER and PHP_AUTH_PW are set once per browser session. Try
> closing & re-opening your browser. If that doesn't fix the problem with
> the passwords, separate things out:
>
> .
>
> $id_worker=getWorkerID($_SERVER['PHP_AUTH_USER'],
$_SERVER['PHP_AUTH_PW']);
>
>
> ## this will go into your apache error log or if php has an
> error_log it will go there.
>
> error_log('id_worker returned ' . $id_worker);
>
>
>  if(!isset($_SERVER['PHP_AUTH_USER']) || !$id_worker)
>  {
>  Header( "WWW-authenticate: basic realm='Workers of SGM only'");
>  Header( "HTTP/1.0  401  Unauthorized");
>  echo  "You  must  enter  a  valid  login  ID  and password  to
>   access  this system\n";
>  exit;
>  };
>
>
> and go from there. If id_worker is returning something when it
> shouldn't, look at that function and work out why and go "backwards" to
> find the problem :)
>
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of undefined constant

2006-10-26 Thread Chris

Zbigniew Szalbot wrote:

Hello again,

On Thu, 26 Oct 2006, Chris wrote:


You'll need to change:

$PHP_AUTH_USER to $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW to 
$_SERVER['PHP_AUTH_PW']


The former variables are ok before 4.2.0 (where register_globals was 
off by default I think) but now they have moved to the $_SERVER 
super-global.


Read http://www.php.net/manual/en/language.variables.predefined.php


Thanks a lot again! I am so thankful for your help! It did work. But I 
have a curious observation. I can only log in when I delete the password 
and just log in using my login. As soon as I write password with field 
type PASSWORD or OLD_PASSWORD I am not able to login. Delete the 
password, and I am back in the program. Now I guess I will need to talk 
to the person who wrote it for us a couple of years ago because I am not 
sure what is going on. Presumably as this was written for mysql 3.x 
something and php 4.0.x so I guess the code has lots of things which may 
now be incompatible.


Yeh sounds like the old code needs a bit of an overhaul.

PHP_AUTH_USER and PHP_AUTH_PW are set once per browser session. Try 
closing & re-opening your browser. If that doesn't fix the problem with 
the passwords, separate things out:


.

$id_worker=getWorkerID($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);


## this will go into your apache error log or if php has an 
error_log it will go there.


error_log('id_worker returned ' . $id_worker);


if(!isset($_SERVER['PHP_AUTH_USER']) || !$id_worker)
{
Header( "WWW-authenticate: basic realm='Workers of SGM only'");
Header( "HTTP/1.0  401  Unauthorized");
echo  "You  must  enter  a  valid  login  ID  and password  to 
 access  this system\n";

exit;
};


and go from there. If id_worker is returning something when it 
shouldn't, look at that function and work out why and go "backwards" to 
find the problem :)


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of undefined constant

2006-10-26 Thread Zbigniew Szalbot

Hello again,

On Thu, 26 Oct 2006, Chris wrote:


You'll need to change:

$PHP_AUTH_USER to $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW to 
$_SERVER['PHP_AUTH_PW']


The former variables are ok before 4.2.0 (where register_globals was off by 
default I think) but now they have moved to the $_SERVER super-global.


Read http://www.php.net/manual/en/language.variables.predefined.php


Thanks a lot again! I am so thankful for your help! It did work. But I 
have a curious observation. I can only log in when I delete the password 
and just log in using my login. As soon as I write password with field 
type PASSWORD or OLD_PASSWORD I am not able to login. Delete the password, 
and I am back in the program. Now I guess I will need to talk to the 
person who wrote it for us a couple of years ago because I am not sure 
what is going on. Presumably as this was written for mysql 3.x something 
and php 4.0.x so I guess the code has lots of things which may now be 
incompatible.


But again - Chris huge thank you for your help!


--
Zbigniew Szalbot

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of undefined constant

2006-10-26 Thread Chris

Zbigniew Szalbot wrote:

Hello again,

On Thu, 26 Oct 2006, Chris wrote:

In the error log I can see this: Use of undefined constant is_admin - 
assumed 'is_admin' in /path_to_file.


I bet you have something like:

$GLOBALS[is_admin]

You need quotes around that, or else (as you've seen) php thinks it's 
a constant:


$GLOBALS['is_admin']

A really quick and dodgy fix would be to turn error reporting down - 
but you should fix it properly.


That fixed the error. Thank you very much!

I am still not able to log in. I am sure this is not the issue of me 
entering wrong login/password.


This is the code in the program that uses authorization:

if ( eregi('/admin/',$REQUEST_URI) || eregi('/workers/',$REQUEST_URI) )
{
session_register("id_worker");
session_register("is_admin");

if(!isset($PHP_AUTH_USER) || !$id_worker=getWorkerID($PHP_AUTH_USER, 
$PHP_AUTH_PW))

{
Header( "WWW-authenticate: basic realm='Workers of SGM only'");
Header( "HTTP/1.0  401  Unauthorized");
echo  "You  must  enter  a  valid  login  ID  and password  to  
access  this system\n";

exit;
}
}


You'll need to change:

$PHP_AUTH_USER to $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW to 
$_SERVER['PHP_AUTH_PW']


The former variables are ok before 4.2.0 (where register_globals was off 
by default I think) but now they have moved to the $_SERVER super-global.


Read http://www.php.net/manual/en/language.variables.predefined.php

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of undefined constant

2006-10-26 Thread Zbigniew Szalbot

Hello again,

On Thu, 26 Oct 2006, Chris wrote:

In the error log I can see this: Use of undefined constant is_admin - 
assumed 'is_admin' in /path_to_file.


I bet you have something like:

$GLOBALS[is_admin]

You need quotes around that, or else (as you've seen) php thinks it's a 
constant:


$GLOBALS['is_admin']

A really quick and dodgy fix would be to turn error reporting down - but you 
should fix it properly.


That fixed the error. Thank you very much!

I am still not able to log in. I am sure this is not the issue of me 
entering wrong login/password.


This is the code in the program that uses authorization:

if ( eregi('/admin/',$REQUEST_URI) || eregi('/workers/',$REQUEST_URI) )
{
session_register("id_worker");
session_register("is_admin");

	if(!isset($PHP_AUTH_USER) || 
!$id_worker=getWorkerID($PHP_AUTH_USER, $PHP_AUTH_PW))

{
		Header( "WWW-authenticate: basic realm='Workers of SGM 
only'");

Header( "HTTP/1.0  401  Unauthorized");
		echo  "You  must  enter  a  valid  login  ID  and 
password  to  access  this system\n";

exit;
}
}

If by any chance you see an error somewhere here, I will appreciate 
further comments.


Many thanks again for such a prompt reply!

--
Zbigniew Szalbot

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of undefined constant

2006-10-26 Thread Chris

Zbigniew Szalbot wrote:

Hello,

I am using PHP 5.1.6 (cli) and MySQL 5.1.11-beta on a FreeBSD 6.1 stable 
release. I am trying to make a custom database program work in this 
environment. I have it working under MS Windows XP Pro with MySQL 
5.0.19-nt and php 4.3.10.


It seems everything is in order. A logging window pops up for me to 
enter username and password. I do it but I am never able to log in. I 
made sure the username and passwords are OK so this is not the problem.


In the error log I can see this: Use of undefined constant is_admin - 
assumed 'is_admin' in /path_to_file.


I bet you have something like:

$GLOBALS[is_admin]

You need quotes around that, or else (as you've seen) php thinks it's a 
constant:


$GLOBALS['is_admin']

A really quick and dodgy fix would be to turn error reporting down - but 
you should fix it properly.


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] use of undefined constant

2006-10-26 Thread Zbigniew Szalbot

Hello,

I am using PHP 5.1.6 (cli) and MySQL 5.1.11-beta on a FreeBSD 6.1 stable 
release. I am trying to make a custom database program work in this 
environment. I have it working under MS Windows XP Pro with MySQL 
5.0.19-nt and php 4.3.10.


It seems everything is in order. A logging window pops up for me to enter 
username and password. I do it but I am never able to log in. I made sure 
the username and passwords are OK so this is not the problem.


In the error log I can see this: Use of undefined constant is_admin - 
assumed 'is_admin' in /path_to_file.


I understand this is way too few details to suggest any advice but perhaps 
you could tell me what to do to output more details? Or maybe someone 
knows what the problem may be? I have tried to make sure that php.ini 
settings that are different between both machines, are put in .htaccess 
file for that database program. One such flag that I need to use with it 
is register_globals for example. I know that this is not good to use it 
but both boxes operate only in LAN environment.


Any suggestions will be gladly welcome. Thanks!

--
Zbigniew Szalbot

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php