Davidja85 Posted February 5, 2007 Share Posted February 5, 2007 Im thinkin about making an online chess game where 2 user's can play head to head togeather. the problem i have is trying to pass the data between the 2 user's. i thinking about using a Sql database to pass the data but just wondering if you can get 2 user's to share the same session. if so how would you go about doing this. thx all Link to comment https://forums.phpfreaks.com/topic/37142-2-users-on-1-session/ Share on other sites More sharing options...
SharkBait Posted February 5, 2007 Share Posted February 5, 2007 The only way i can see someone using the same session if they are using the same computer with the same browser with the same window open. You'd just have to ask them for playername1 and playername2 I guesss and make sure that the session matches both of those names? I don't see the session being the same if they were on different computers or even the same computer but difference browser window... Link to comment https://forums.phpfreaks.com/topic/37142-2-users-on-1-session/#findComment-177395 Share on other sites More sharing options...
janroald Posted February 5, 2007 Share Posted February 5, 2007 Two users cant share the same session. That would compromize security. You must use a database or a flat file to store the session data they should share, and load the data into their sessions whenever the data is altered. Some ajax would be advised to make such an application workable. Another solution would be to store the data in hidden fields on the webpage and ensure that the two users get the same page with the same data at all times. Link to comment https://forums.phpfreaks.com/topic/37142-2-users-on-1-session/#findComment-177426 Share on other sites More sharing options...
Destruction Posted February 5, 2007 Share Posted February 5, 2007 "Another solution would be to store the data in hidden fields on the webpage" Depending on the data of course, otherwise this is just as bad for security as it can be altered and reposted and if there isn't sufficient processing, would cause possible exploits. Dest Link to comment https://forums.phpfreaks.com/topic/37142-2-users-on-1-session/#findComment-177473 Share on other sites More sharing options...
Xinil Posted February 5, 2007 Share Posted February 5, 2007 Simple. Store the game data in a table in a MySQL database. Basically you have the user log in, and the other user log in. When they create a game, a row is entered into the database with this game information. So long as their session is active, it will authenticate against this row and any relevant game data should point/update it or other tables. Sessions typically should not be used to authenticate anything other than login information. Any other sensitive information should be stored elsewhere and beyond a client's control. Link to comment https://forums.phpfreaks.com/topic/37142-2-users-on-1-session/#findComment-177511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.