user authentication with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lujack76
Forum Newbie
Posts: 7
Joined: Mon Jul 15, 2002 3:08 pm
Location: Midwest USA

user authentication with PHP

Post 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.
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post 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.
lujack76
Forum Newbie
Posts: 7
Joined: Mon Jul 15, 2002 3:08 pm
Location: Midwest USA

Post 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?
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post 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.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

try using require() ...

maybe error reporting is messed up?
lujack76
Forum Newbie
Posts: 7
Joined: Mon Jul 15, 2002 3:08 pm
Location: Midwest USA

Post 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...
lujack76
Forum Newbie
Posts: 7
Joined: Mon Jul 15, 2002 3:08 pm
Location: Midwest USA

Post 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.
Post Reply