session

Keep socket connection when new page is loaded

喜欢而已 提交于 2020-05-17 03:02:10
问题 I have a small project with socket.io and node.js. Basically the landing page (index.html) is a waiting room for players, who can agree to play with each other. In that case, I want to redirect them to a different html (game.html, which is in the same folder as index.html). I want to keep the socket connection, since during the game there has to be communication with the server. I have tried two ways, but both fail. In each case, I change the client-side window.location (as described here). 1

Keep socket connection when new page is loaded

放肆的年华 提交于 2020-05-17 03:00:38
问题 I have a small project with socket.io and node.js. Basically the landing page (index.html) is a waiting room for players, who can agree to play with each other. In that case, I want to redirect them to a different html (game.html, which is in the same folder as index.html). I want to keep the socket connection, since during the game there has to be communication with the server. I have tried two ways, but both fail. In each case, I change the client-side window.location (as described here). 1

Sliding Session on Web API Request

给你一囗甜甜゛ 提交于 2020-05-10 06:47:09
问题 UPDATE: it appears it is trying to write the new cookie header in ApplyResponseGrantAsync but can't because it's throwing an exception that the headers are already sent. UPDATE: to be clearer. How do I get the Set-Cookie header added to the XHR response during a Web API request? TL;DR; The issue is that the application is authenticated with MVC, but makes heavy use of Web API. The Web API requests do not slide the session even though they use the Authentication attribute - almost certainly

Check for a cookie with Python Flask

女生的网名这么多〃 提交于 2020-05-09 18:48:04
问题 I would like to get a cookie (e.g. country ) with this Flask call. data = request.cookies.get("country") How can I tell if the cookie exists? 回答1: request.cookies is a dict , so: if 'country' in request.cookies: # do something else: # do something else 回答2: request.cookies.get('my_cookie') should have worked. If it didn't work, you may not have access to the request object when you call this line. Try importing flask at the top import flask then call cookie = flask.request.cookies.get('my

Set expire time for session variables

僤鯓⒐⒋嵵緔 提交于 2020-05-09 08:05:10
问题 I'm getting mad with the fact that a client could change cookie values, because I realized that everything on my website was pretty unsecure. Before I just setted a cookie with an expire time, and I was sure that a given user would have kept a particular property (such as "logged in" or "he has this privilege") for that exact amount of time (unless he cleared the cache). Now that I have to switch everything to sessions, which doesn't have an expire time. So, while for the login I implemented

How can I get an unknown username given an ID?

最后都变了- 提交于 2020-05-03 04:14:32
问题 I got a numerical ID of 20 characters witch looks like 10527391670258314752 , given this ID, how can I get the username associated with it? The table looks like this: id | name | password | balance 10527391670258314752 | Jhon | 12345 | 12.51 The username retrieved from the database should then be stored into $_SESSION['name'] . I've tried this: $connection = mysqli_connect('localhost', 'root', '', 'user_data'); $id = '10527391670258314752'; $query = "SELECT username FROM user_data WHERE id =

How can I get an unknown username given an ID?

二次信任 提交于 2020-05-03 04:11:28
问题 I got a numerical ID of 20 characters witch looks like 10527391670258314752 , given this ID, how can I get the username associated with it? The table looks like this: id | name | password | balance 10527391670258314752 | Jhon | 12345 | 12.51 The username retrieved from the database should then be stored into $_SESSION['name'] . I've tried this: $connection = mysqli_connect('localhost', 'root', '', 'user_data'); $id = '10527391670258314752'; $query = "SELECT username FROM user_data WHERE id =

Cookies or Session on Google Apps Script Webservice

核能气质少年 提交于 2020-05-02 04:32:08
问题 I've created websites before where the server-side code has access to either Cookies on the browser or some sort of Session variables. I have not figured out how to do this with GAS. I can host a website with GAS, but I have no way of seeing the login session when a new page is loaded. How do I do this? I would expect to see this information in the doGet() event, like this: function doGet(e){ e.session.userid; //or something like this } NOTE: Anyone can access my site, even anonymous. So I

Cookies or Session on Google Apps Script Webservice

倾然丶 夕夏残阳落幕 提交于 2020-05-02 04:32:04
问题 I've created websites before where the server-side code has access to either Cookies on the browser or some sort of Session variables. I have not figured out how to do this with GAS. I can host a website with GAS, but I have no way of seeing the login session when a new page is loaded. How do I do this? I would expect to see this information in the doGet() event, like this: function doGet(e){ e.session.userid; //or something like this } NOTE: Anyone can access my site, even anonymous. So I

Laravel, getting specific array index from session

妖精的绣舞 提交于 2020-04-30 07:07:06
问题 Currently, I'm dumping an array that is held within my laravel session, which successfully dumps the array: <?php dd(Session::get('Tokens'));?> This dumps an array with three elements, each with its own index array( "userToken":"value", "secondToken":"value", "thirdToken":"value", ); I keep running into errors trying to get specifically the userToken. I've tried get('Tokens[userToken]') but It's expecting a string only How should I change this to be able to access any array key specifically