Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

php authentication

Quote Reply
php authentication
From a php page, how do I check to see if the user is logged in (as far as LSQL is concerned) and (1) if so, allow them to see the page or (2) if not, send them to the appropriate login, then redirect to the php page? In essence, I need a php equivalent to add.cgi.

Also, are there any globals/functions available to use similar to how <%Username%> is used on the cgis like add and modify.

Thanks
Quote Reply
Re: [estjohn] php authentication In reply to
The presence of the variable $Username should mean that a user is logged in. With the redirect, I think you'll have to do a meta redirect instead of sending redirect headers, since the page would have already been sent.

Quote:
Also, are there any globals/functions available to use similar to how <%Username%> is used on the cgis like add and modify.
Sorry, but I'm not sure what you mean by that.

Adrian
Quote Reply
Re: [brewt] php authentication In reply to
Hi Brewt, thanks for trying to help, I'm sorry I wasn't more clear.

I'll try a different approach:

I have a blank php page with a print statement that says "This is a test, <USERNAME>". There is no other code on the page.

I want to check if the person trying to access it is a LinksSQL user on my site, and if so I want to him to see that php print statement with his username in the <USERNAME> field.

I assume I have to include some sort of authentication code. I tried including the ones in the Link/PHP directory and it didn't work. Perhaps my setup is incorrect or I am not including the right code?
Quote Reply
Re: [estjohn] php authentication In reply to
Take a look at Authenticate.inc.php. You'll have to initialize the sessions in a similar manner and then you should be able to so something like in auth_valid_session.

Adrian