/    Sign up×
Community /Pin to ProfileBookmark

How do I link two users on a site together?

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 [B]greatly[/B] appreciated. If it can’t be done in PHP, a recommendation as to how it could be done would be great.

    to post a comment
    PHP

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @JeremyAJul 25.2008 — 
  • 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.
    Copy linkTweet thisAlerts:
    @rootJul 26.2008 — 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.
    ×

    Success!

    Help @jake_d spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.15,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...