session-variables

Setting session variable using javascript

∥☆過路亽.° 提交于 2019-11-27 12:11:06
问题 I am getting name and email id of a user after he logs in via facebook to my website.. I want to add those variables in session on login form itself using javascript; I tried following: FB.api('/me', function(me) { if (me.name) { document.getElementById('auth-displayname').innerHTML = me.name; <% Session["fbName"] = me.name; %> } } it gives error like me (in this line: <%Session["fbName"] = me.name; %>) does not exist in the current context etc.. my div "auth-displayname" is getting that

Session Variables: How much data is too much?

邮差的信 提交于 2019-11-27 12:01:40
问题 I've only seen examples of session variables being used to store small amounts of data, like a single user id. I'm wondering if it would be more efficient to instead hold more frequently accessed data in the session variables to avoid querying the database. For instance, I made a user class that gathers regularly requested data for that user upon construction (their user id, username, email, password and arrays of site specific data) and I hold this instance as a session variable. After the

Web authentication state - Session vs Cookie?

邮差的信 提交于 2019-11-27 11:48:55
What's the best way to authenticate and track user authentication state from page to page? Some say session state, some say cookies? Could I just use a session variable that has the ID of the user and upon authentication, instatiate a custom User class that has the User's information. Then, on every page, verify the session variable is still active and access basic user data from the User object? Any thoughts? Any good examples? There's no perfect way to do it. If you store it in a cookie you'll take flak that cookies can be stolen. If you store it in the session you'll take flak because

Asp.Net MVC and Session

牧云@^-^@ 提交于 2019-11-27 11:15:12
问题 I'd like to construct an object in different steps in an asp.net mvc application, each step being a different page. The sort of thing you'd store in Session in a quick Web.Forms application. Reading about it, Session doesn't seem to me as something very asp.net MVC'ish. However I can't really think of other alternatives to this situation as TempData and ViewData don't seem to fit either, so maybe I'm wrong. Of course I could put the 4 steps in one page and show/hide, but that's not my point

Magento - Passing data between a controller and a block

冷暖自知 提交于 2019-11-27 10:36:51
Really quick and simple question but I can't find a decent answer to this - What is the best way to pass data from a controller to a block in Magento. Incase it makes a difference, I am loading the layout as follows: $this->loadLayout(array('default', 'myModule_default')); $this->_initLayoutMessages('customer/session') ->_initLayoutMessages('catalog/session') ->renderLayout(); I should add, that I have been using the registry as follows: In the controller: Mage::register('data', $data); In the block: $data = Mage::registry('data'); Not sure if this is the best way to do it though. You don't.

PHP session seemingly not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 09:34:32
Session variables are apparently not working for me. I don't know what I'm doing wrong. This is the code that I'm using to check for a valid password: if ($input_password_hash == $password_hash) { session_start(); $_SESSION['is_user'] = 1; header("Location: ../new_look"); //or Location: index.php } else echo "Wrong password."; in the index.php file (where it redirects to), I have this code: if ($_SESSION['is_user'] == 1) { //show index page with navigation bar for registered user } else { //do something else } but it's not working at all. The session does apparently start and that can be

Static fields vs Session variables

心已入冬 提交于 2019-11-27 07:26:26
So far I've been using Session to pass some variables from one page to another. For instance user role. When a user logs in to the web application the role id of the user is kept in Session and that role is checked at different parts of the application. I've recently started thinking why not use static members instead. I can store the same information in a static field and easily access it anywhere in my application (well anywhere the namespace in which that static field resides is included.) I know that using Session variables comes handy sometimes, such that: Any kind of data can be stored

Setting a PHP $_SESSION['var'] using jQuery

风流意气都作罢 提交于 2019-11-27 06:41:12
I need to set a PHP $_SESSION variable using the jQuery. IF the user clicks on an image I want to save a piece of information associated with that image as a session variable in php. I think I can do this by calling a php page or function and appending that piece of info to the query string. Any ideas. I have found little help through google. thanks mike You can't do it through jQuery alone; you'll need a combination of Ajax (which you can do with jQuery) and a PHP back-end. A very simple version might look like this: HTML: <img class="foo" src="img.jpg" /> <img class="foo" src="img2.jpg" />

jsp:useBean scope

两盒软妹~` 提交于 2019-11-27 06:26:18
问题 The JSP code is : <jsp:useBean id="person" class="org.example.model.PersonModel" scope="session"> </jsp:useBean> <br> Name : <jsp:getProperty property="name" name="person"/> <br> Surname : <jsp:getProperty property="surname" name="person"/> Although I set java object in the request scope and not in the session scope in the Controller Servlet from where I am forwarding the request to this Servlet . How does the <jsp:useBean> gets hold of the request attribute although scope mentioned in the

Google App Engine - Getting Sessions working with Python 2.7

这一生的挚爱 提交于 2019-11-27 05:30:11
问题 First of all, I'm brand new to GAE, so its possible I'm doing this the wrong way - but I've used PHP before and session was how I kept persistent data. I'm using Python 2.7 because that is what I use for all my other Python development - although I'm beginning to wonder if downgrading to 2.5 might be a valid solution, if not an ideal one. The scenario is that I'm building a proof-of-concept site, and I need to have a 'dummy' login button that simply sets a session variable called 'user' with