I need single login functionality across multiple sites. For this I
implemented the following code:-

if(isset($this->params['pass']['0']) && $this->params['pass']
['0']=='sid'){
    $db = &ConnectionManager::getDataSource('default');
            $sql = "SELECT data FROM cake_sessions s WHERE s.id = '".
$this->params["pass"]["1"]."' ";
            $res = $db->query($sql);

            $variables = array();

            $a = preg_split( "/(\w+)\|/", $res['0']['s']['data'],
-1,PREG_SPLIT_NO_EMPTY |
PREG_SPLIT_DELIM_CAPTURE );
                    for( $i = 0; $i < count( $a ); $i = $i+2 ) {
                            $variables[$a[$i]] = unserialize( $a[$i
+1] );
                       }

            $myData['User'] = $variables['User'];

    // if(session_id()!=$this->pharams["pass"]["1"]){
    // $this->Session->destroyOldSession($this->params["pass"]["1"]);
    // $this->Session->write($myData);
    // }

            $this->DAuth->controller = $this;
            $this->DAuth->setUserData($myData['User']);
}

In this code I appended the last two lines so as to call setUserData()
function of DAuth explicitly.
And in setUserData() function in DAuth component class I added a
die('*******');
in the else part and then run the code and the code runs fine.
Although the die('******'); was not called but it worked fine and
user's data was not deleted from cake_sessions table.

But If I remove the die statement then it deletes the records and log
out from the site.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to