473,770 Members | 1,841 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_variabl e','value'); on
every view file
of every files stored in the system.

session_start() ;
$_SESSION["session_variab le"] = "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_variabl e','value') is equal as
$_SESSION["session_variab le"] = "value";
but why it doesn`t work?

How to do this on mojavi?

Please help me
Marcin from Poland
Jul 26 '07 #1
6 2018
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_variabl e','value'); on
every view file
of every files stored in the system.

session_start() ;
$_SESSION["session_variab le"] = "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_variabl e','value') is equal as
$_SESSION["session_variab le"] = "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*******@attgl obal.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 PassageLoginLog inAction.php

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

class PassageLoginLog inAction extends Action {

function execute(&$contr oller, &$request, &$user) {

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

$controller->forward("Passa geAfterLogin", "Index");
return VIEW_NONE;
}
}
?>
-----------------------------------------------------------
Second file is PassageAfterLog inIndexAction
-----------------------------------------------------------

<?php
session_start() ;
require_once(LI B_DIR . "ScreenErrorHan dler.lib.php");
require_once(LI B_DIR . "Action.lib.php ");

class PassageAfterLog inIndexAction extends Action {
function execute(&$contr oller, &$request, &$user) {

$user->setAttribute(" passage_login_s ession",
$user->getAttribute(' variable_login_ session'));
$user->setAttribute(" variable_login" ,
$user->getAttribute(' variable_login' ));

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

}
}

?>

-----------------------------------------------------------
Third file is PassageAfterLog inViewAction.ph p
-----------------------------------------------------------
<?php
session_start() ;
require_once(LI B_DIR . "Action.lib.php ");

class PassageAfterLog inViewAction extends Action {
function execute(&$contr oller, &$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 PassageAfterLog inViewSuccessVi ew.class.php
-----------------------------------------------------------

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

class PassageAfterLog inViewSuccessVi ew extends SmartyView {
function execute(&$contr oller, &$request, &$user) {

$this->renderer->setTemplate("i ndex.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="mainLayo ut"><tbody>
{include file="login.tpl "}
</tbody></table>
.....
-----------------------------------------------------------
6th file is login.tpl

-----------------------------------------------------------
{if $variable_login _session=='well _loged'}
<tr><td class="separato rRow"></td></tr>
<tr>
<td class="footerPa ne">
<table>
<tbody>
<tr>
<td class="footerPa neLeft">
<b><h style="color:wh ite;">Actual logged:</h></b{$variable_log in}
&nbsp;&nbsp; | &nbsp;&nbsp;
<a href="{ $scriptName }"><b><h style="color:wh ite;">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*******@attgl obal.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*******@attgl obal.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
12052
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 on the server (in our own accounts on the same machine). When I am testing both versions of our program using the same browser (IE on Windows or Konqueror on Linux) the session variables will mix up and only the latest selection or options will...
0
1476
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, smarty and adodb. since i haven't gog any expirience at all with those frameworks i have got a cuple of questions: a) is this a common combination of frameworks for a medium sized application?
0
1295
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 ? Thanks..
3
2480
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 (IIS 5.0) with ASP 3.0 (no .NET on this site). Sometime, data in session is emptied. I say "sometime"
6
3807
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
3
1681
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 company, we're developing a web product based on ASP.NET 2.0, in conjunction with Oracle database over ADO.NET and external COM objects
1
1349
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
2324
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 access this object in the second action display : Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class
0
1091
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 mechanism using mojavi mvc functions? Are there any functions which would let me build rss channels? If not, is there any way to build rss channels while still working on portal based on mojavi framework and not changing the structure of whole...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9453
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7451
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
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 we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.