Reputation: 12142
i am using google maps with xml data, the way google maps works is that it calls my server to get the xml(i have to pass it an url, i can't pass the xml to google),
since all my pages are user/password protected, i need to implement some sort of authentication for google maps, so i was thinking of passing it the current user session id(encrypted in some way) so that when google calls my script, i can check that a session with that id exists, thus google is calling me on behalf of that user
Upvotes: 0
Views: 1703
Reputation: 12142
I ended up using my own table to save the session and then execute queries on it
in bootstrap.php
protected function _initSession()
{
$this->bootstrap('cache')
$config = array(
'name' => 'session', //table name as per Zend_Db_Table
'primary' => array(
'session_id', //the sessionID given by PHP
'save_path', //session.save_path
'name', //session name
//'cols' => array('session_id', 'save_path', 'name', 'modified', 'lifetime', 'session_data')
),
'primaryAssignment' => array(
//you must tell the save handler which columns you
//are using as the primary key. ORDER IS IMPORTANT
'sessionId', //first column of the primary key is of the sessionID
'sessionSavePath', //second column of the primary key is the save path
'sessionName', //third column of the primary key is the session name
),
'modifiedColumn' => 'modified', //time the session should expire
'dataColumn' => 'session_data', //serialized data
'lifetimeColumn' => 'lifetime', //end of life for a specific record
'user_id' => 'user_id'
);
//Tell Zend_Session to use your Save Handler
$savehandler = new Zend_Session_SaveHandler_DbTable($config);
//http://framework.zend.com/wiki/display/ZFPROP/Zend_Session_SaveHandler_DbTable
//cookie persist for 30 min
$config = Zend_Registry::get('config');
$seconds = $config->session->seconds_life;
//Zend_Session::rememberMe($seconds = ($config->session->seconds_life));
//make the session persist for 30 min
$savehandler->setLifetime($seconds)
->setOverrideLifetime(true);
Zend_Session::setSaveHandler($savehandler);
Zend_Session::start();
}
Upvotes: 1
Reputation: 20726
I would suggest to use the method of the Zend Session class.
$sessionId = Zend_Session::getId();
Upvotes: 0
Reputation: 10583
session_id()
will give you the session id of the current request. You could attempt to send this to Google as a cookie, remember that for this to work Google will have to accept your cookies. If it does not then you'll have to find a different way
Upvotes: 0