473,503 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mojavi sessions problem

K.
Hello!!!!

I have a problems with sessions in mojavi technology.

I have created a login panel to log into the system:
Unfortunately sessions variable disappears while trying to click on any
other <a hreflink on my page and user has to log into the system many
times.
How to build a page to have session variables values available on every page
on my system
and how to avoid using $user->setAttribute('session_variable','value'); on
every view file
of every files stored in the system.

session_start();
$_SESSION["session_variable"] = "value";

declared once should store the value of this session variable on every page
and when I created
clear PHP systems (without any more technology) based on the above code it
was working well all the time.

I heard that $user->setAttribute('session_variable','value') is equal as
$_SESSION["session_variable"] = "value";
but why it doesn`t work?

How to do this on mojavi?

Please help me
Marcin from Poland
Jul 26 '07 #1
6 2002
K. wrote:
Hello!!!!

I have a problems with sessions in mojavi technology.

I have created a login panel to log into the system:
Unfortunately sessions variable disappears while trying to click on any
other <a hreflink on my page and user has to log into the system many
times.
How to build a page to have session variables values available on every page
on my system
and how to avoid using $user->setAttribute('session_variable','value'); on
every view file
of every files stored in the system.

session_start();
$_SESSION["session_variable"] = "value";

declared once should store the value of this session variable on every page
and when I created
clear PHP systems (without any more technology) based on the above code it
was working well all the time.

I heard that $user->setAttribute('session_variable','value') is equal as
$_SESSION["session_variable"] = "value";
but why it doesn`t work?

How to do this on mojavi?

Please help me
Marcin from Poland

You need to call session_start() at the beginning of EVERY page which
uses sessions. The first page is not enough. But you don't need to set
your variable on every page - just set it once and you can retrieve it
on other pages.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 26 '07 #2
MZ
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 hreflink 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
Jul 26 '07 #3
MZ wrote:
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
<code snipped>
>
================================================== ========
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 hreflink 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

Well, first of all, you're using Smarty, which changes things a lot.
It's not just your PHP code any more.

Is the href pointing at the same domain as the rest? That is, if you're
page is www.example.com/page1.php, is the page being referenced
something like www.example.com/page2.php?

The reason I ask is that browsers won't send a cookie created by one
domain to another domain (security issue - and PHP uses cookies for the
session id).

Otherwise I would recommend you ask in the Smarty discussion forums.
Someone's probably run into it there.

Also, when replying to a message, please copy the relevant part of the
message and post your response below the copied text (as I did here), or
, in the case of a long message, interspaced in the message. It helps
to keep the continuity and we don't have to keep going back to look at
previous messages. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 26 '07 #4
MZ wrote:
Unfortunately it still doesn`t work...
================================================== ========
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 hreflink 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

Ah, my mistake. You're using Mojavi - which I hadn't heard of before.
And I see their website is under renovation. I'm not sure how many
people here have used it - I don't think I've heard it mentioned here
before, although I could have missed it.

It will be a lot tougher to help you in this case. But maybe someone
who is using it (or has used it) can help out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 26 '07 #5
K.
I have found out what it was. I had to create a /tmp folder in the folder
where I have web page.
In the tmp folder where session created. If it doesn`t exist, there is no
session created.
There is such configuration on the ftp server this page is placed.
The main thing which helped was phpinfo

Thank you all for reading my posts
Marcin
Aug 1 '07 #6
Rik
On Wed, 01 Aug 2007 11:27:33 +0200, K. <ha************@poczta.onet.pl>
wrote:
I have found out what it was. I had to create a /tmp folder in the folder
where I have web page.
In the tmp folder where session created. If it doesn`t exist, there is no
session created.
There is such configuration on the ftp server this page is placed.
The main thing which helped was phpinfo
Ah, next time, enable error display/log, PHP would've told you in an
instant :).
--
Rik Wasmus
Aug 1 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
12018
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
0
1460
by: michael | last post by:
hi, i have to do a medium sized project using php. i'm new to php but i quite like the model-view-controller pattern. so i was thinking to use the following combination of frameworks: mojavi,...
0
1280
by: Weird-beard | last post by:
I need brief intro into MVC/Mojavi/php.Mvc/java Struts (Frameworks based on mvc pattern) etc. Do you really think MVC is applicable and required for PHP ? Any successful implementation stories ?...
3
2454
by: Maxime Ducharme | last post by:
Hi group We have a problem with sessions in one of our sites. Sessions are used to store login info & some other infos (no objects are stored in sessions). We are using Windows 2000 Server...
6
3764
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
1669
by: AlonR | last post by:
Hi, We're experiencing random user sessions losses on our web applications, and are researching for any useful information which may shed light on this problem. Environment: In our...
1
1336
by: Jahedur Rahman | last post by:
I am in a problem in creating subdomain. I use mojavi platform to work in php5. Please inform me as early as possible with details. With regards. JAHED
3
2308
by: ezahn | last post by:
Hello, I need to store in user session an instance of an OWN class, "Foo", for example. Its works inside a single action but the object doesn't "survive" between two actions (1) Trying to...
0
1073
by: AD | last post by:
Hello! I have got the portal based on mojavi mvc model after the IT person, who did not have time to work on this. I know that Mojavi is rather an old framework. Is it possible to implement rss...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.