Accessing singleton Auth object fails when IE is used as browser

43 views
Skip to first unread message

Saravana

unread,
Dec 31, 2011, 5:02:58 AM12/31/11
to Simple PHP Framework
Hi

My code base for this question is trunk SPF from git repo.

Source code:

fter the autentication succeeds, I want to redirect to a user.php
file. Used the code below in login.php:

redirect('user.php');

In user.php, I am trying to access the Auth object(which is a
singleton).Source for user.php is below:

1) <?PHP
2) require 'includes/master.inc.php';
3)
4) if($Auth->loggedIn() ==true)
5) echo 'hai ' . $Auth->username
6) else
7) echo 'still not logged in'
8) ?>

After a successful login from Firefox, I am able to view "hai John" .
But in case of IE, I am getting a new instance of Auth object, hence
the object is not initialized. Because of which , i am getting 'still
not logged in'.

the master.inc.php contains the following code:

session_name('spf');
session_start();

Please help me to get to the roots of this issue.
Thanks
Saravana

Nils Lagerkvist

unread,
Jan 2, 2012, 7:03:32 AM1/2/12
to simple-php...@googlegroups.com
Hi

If you have set up your web server on an different port, that is http://mydomain.com:81, or using localhost, that is http://localhost/, you will get some problems.

I was looking in to this problem the week before christmas. The problem seems to come from class.config.php, look in the function everywhere.

If this is the case you could try to replace it with this function. I have still some problems with the combination of localhost and a port though, that I have not had time to look into.

        private function everywhere()
        {
            // Store sesions in the database?
            $this->useDBSessions = false;

            // Settings for the Auth class
            $this->authDomain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
            $port = strpos($this->authDomain, ':');
            if ( $port !== false )
                $this->authDomain = substr($this->authDomain, 0, $port);
            $this->useHashedPasswords = true;
            $this->authSalt           = ''; // Pick any random string of characters
        }


//Nils



Saravana

--
You received this message because you are subscribed to the Google Groups "Simple PHP Framework" group.
To post to this group, send email to simple-php...@googlegroups.com.
To unsubscribe from this group, send email to simple-php-frame...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-php-framework?hl=en.


Reply all
Reply to author
Forward
0 new messages