Click to See Complete Forum and Search --> : How do I link two users on a site together?


jake_d
07-21-2008, 01:21 AM
Hi guys, I'm wondering how I would make a simple game using javascript and PHP and to do that I would need to somehow link two users together. To do this I would need to

1. Be able to show a list of every active session (like a lobby) so people could choose their opponent.

2. Have a place to store game data that would be shown to both user's simultaneously. I was thinking I could reserve a blank database for this that would clear itself after every game, but that seems both inefficient and hard on the server.

Any help on those two fronts would be greatly appreciated. If it can't be done in PHP, a recommendation as to how it could be done would be great.

JeremyA
07-25-2008, 11:44 AM
1. Well you would need to use a DB store all the sessions then use a loop to display them all.

2. you can write the information to .txt files if you don't want to use a DB using fopen() fclose() fwrite() commands. and depending on how you open it you can either create or overwrite existing files.

how are you wanting this information to be show? real time?

if so this cant be done with php due to the fact that php is server side, if you do want it realtime i would suggest working with javascript.

with php you would have to refresh.

\\.\
07-26-2008, 10:02 AM
Ajax would do you better than having to set a page refresh, using Ajax moves the process to behind the scenes action and is more efficient.