Page 1 of 1

user authentication with PHP

Posted: Tue Jul 16, 2002 8:22 am
by lujack76
Hello

I am getting an error upon executing a page that has an include containing all of the pre-defined functions of this auth library, php_lib_login.

The error is that "function is undefined," and yet my include syntax and path are correct. I substituted some sample text php files to make certain, and the include looks OK. So when I include "login.inc.php," I cannot imagine why PHP is not able to find the function, which I have verified exists and is spelled correctly.

In summary, the include with all the variables and crucial functions is "invisible" to php. How can this be? This is blowing my mind.

Thanks in advance.

Posted: Tue Jul 16, 2002 8:54 am
by will
in my experience, this has been an issue with the function itself. You'll be able to include the library (login.inc.php), but the functions won't be visible if there are syntax errors (often a missing bracket or something). try loading just the library file in a browser (just add an echo'login library'; somewhere so it won't hang in the browser forever). let us know if this doesn't help.

Posted: Tue Jul 16, 2002 9:57 am
by lujack76
When you say try loading the library, what specifically do you mean for me to do? I have an index.php which calls a specific function from the included "login.inc.php," are you telling me to write echo 'login.inc.php'; and see what happens?

Posted: Wed Jul 17, 2002 3:20 am
by will
actually i said to "load the library _in a browser_". instead of going to http://www.mysite.com/index.php, go to http://www.mysite.com/login.inc.php. if there are syntax errors in that document, it'll tell you. actually, it should probably throw the errors when you include it, but it can somtimes get hidden.

if login.inc.php doesn't output anything anywhere, it will 'hang' in the browser, so add an echo 'foobar'; or something somwhere to prevent this.

Posted: Wed Jul 17, 2002 3:25 am
by hob_goblin
try using require() ...

maybe error reporting is messed up?

Posted: Wed Jul 17, 2002 8:11 am
by lujack76
No sh*t, the file "login.inc.php" failed to load in the browser. No specific error message, just "Attempt to load failed" basically.

At this point what should I do? This file is about 1,000 lines of code if not more.

I appreciate any help...

Posted: Wed Jul 17, 2002 8:25 am
by lujack76
OK, I stuck a print line into the library file, loaded it in the browser, and the print line executed but here's what followed:

Warning: Cannot send session cache limiter - headers already sent (output started at /Users/luke/Sites/PLI/passlib/php_lib_login_includes/login.inc.php:1) in /Users/luke/Sites/PLI/passlib/php_lib_login_includes/login.inc.php on line 263

So is there something wrong with the login.inc.php on line 263? Here is what the file has at that point:

262 //$gDB->debug = true; //update
263 session_register('gUser');
264 if (empty($gUser)) $gUser = '';

Again, appreciate any assistance.