-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sonic wrote:
| Hi!

Greetings!

| I'm trying to add a login mechanism to my page. I copy-n-pasted the
code from
| a posting to this list (thanks, Ingo :-) so I hoped for better luck this
| time, but what happens is that every time I hit the login button all I
get is
| these two warnings:

The problem is that NemeinAuthentication, like many old
libraries, is not E_ALL compatible. Nothing serious, just
inconvenient.

It means you have to set error_reporting() level lower
before running the NemeinAuth functions.

| Here's the code I'm using. Its located in the ROOT style element:

Modify it in the following way:

| <?php
| $user=0;

error_reporting(E_WARNING);

| if($_POST["login"]) {
|     // Create the authentication session
|     $result=auth_login($_POST["username"],$_POST["password"],1);
|     if($result) {
|         echo $result;
|     }
|     else{
|         // Login was successful, get user information
|         $user=mgd_get_person($midgard->user);
|     }
| }
|
| else{
|     // Refresh existing session from user's cookies
|     $login_error=auth_by_cookies();
|     if(!$login_error) {
|         // Session validated, get user information
|         $user=mgd_get_person($midgard->user);
|     }
| }

error_reporting(E_ALL);

| if($user){
| // User found, show page content
| ?>
|  <[head]>
|  <[body]>
| <?
| }
| else {
|    // show login screen
| ?>
| <[head-login]>
| <[body-login]>
| <?
| }
| ?>

| A.f.

/Bergie

- --
Henri Bergius                           [EMAIL PROTECTED]
Consultant Partner                      Tel: +358-20-198 6032
Nemein Oy                               http://www.nemein.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAV3TINkT8k497k9IRAq2nAJ4k1APuZErKJdw52EMOwTd2TxAc8QCfZmZ6
0P9In7UhsnfalP0K53TdJ5g=
=kryo
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to