You are here: Re: mojavi sessions problem « PHP Programming Language « IT news, forums, messages
Re: mojavi sessions problem

Posted by MZ on 07/26/07 16:51

Unfortunately it still doesn`t work...

I have the first file where I`ve implemented session variable $user. I`ve
made some changes to make the code easier to understand

First file PassageLoginLoginAction.php

<?php
session_start();
require_once(LIB_DIR . "Action.lib.php");

class PassageLoginLoginAction extends Action {

function execute(&$controller, &$request, &$user) {

$user->authenticate(true);
$user->setAttribute("variable_login", $data["Login"]);

$controller->forward("PassageAfterLogin", "Index");
return VIEW_NONE;
}
}
?>
-----------------------------------------------------------
Second file is PassageAfterLoginIndexAction
-----------------------------------------------------------

<?php
session_start();
require_once(LIB_DIR . "ScreenErrorHandler.lib.php");
require_once(LIB_DIR . "Action.lib.php");

class PassageAfterLoginIndexAction extends Action {
function execute(&$controller, &$request, &$user) {

$user->setAttribute("passage_login_session",
$user->getAttribute('variable_login_session'));
$user->setAttribute("variable_login",
$user->getAttribute('variable_login'));

$controller->forward('PassageAfterLogin','View');
return VIEW_NONE;

}
}

?>

-----------------------------------------------------------
Third file is PassageAfterLoginViewAction.php
-----------------------------------------------------------
<?php
session_start();
require_once(LIB_DIR . "Action.lib.php");

class PassageAfterLoginViewAction extends Action {
function execute(&$controller, &$request, &$user) {

$user->setAttribute("variable_login_session",
$user->getAttribute('variable_login_session'));
$user->setAttribute("variable_login",
$user->getAttribute('variable_login'));

return VIEW_SUCCESS;
}
}
?>


-----------------------------------------------------------
4th file is PassageAfterLoginViewSuccessView.class.php
-----------------------------------------------------------

<?php
session_start();
require_once(LIB_DIR . "SmartyView.lib.php");

class PassageAfterLoginViewSuccessView extends SmartyView {
function execute(&$controller, &$request, &$user) {

$this->renderer->setTemplate("index.tpl");

$this->renderer->setAttribute('variable_login_session',$user->getAttribute('variable_login_session'));
$this->renderer->setAttribute('variable_login',$user->getAttribute('variable_login'));

parent::execute($controller, $request, $user);

}
}

?>

-----------------------------------------------------------
5th file is index.tpl
-----------------------------------------------------------
......
<table class="mainLayout"><tbody>
{include file="login.tpl"}
</tbody></table>
.....
-----------------------------------------------------------
6th file is login.tpl

-----------------------------------------------------------
{if $variable_login_session=='well_loged'}
<tr><td class="separatorRow"></td></tr>
<tr>
<td class="footerPane">
<table>
<tbody>
<tr>
<td class="footerPaneLeft">
<b><h style="color:white;">Actual logged:</h></b> {$variable_login}
&nbsp;&nbsp; | &nbsp;&nbsp;
<a href="{ $scriptName }"><b><h style="color:white;">Log
out</h></b></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
{/if}


==========================================================
When the above code is being called everything works fine. But when I click
on the other (didn`t mention in the
above files) <a href> link which also has session_start() call at the
beginning of the file, it the login.tpl if statement
can`t let get inside the code and actual logged person is not displayed.

Please help me
Marcin

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация