Jump to content

Search the Community

Showing results for tags 'amfphp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi there, I am new to the forum was really unsure where to post my thread since I have no idea where the issue in my application is actually coming from. I've put a flash game on facebook as a canvas app. Once a user authorizes my application I grab their name and id and then use the id to check if they already exist in my database. If they do I pull their score otherwise I add them into the db. Every browser and 3 different machines I have tried it on, and with multiple user accounts, it always works. I have never been able to reproduce the issue of the user not getting registered in the db, but facebook shows that about 28 people have authorized my app, but only 13 of them have been registered in the db. Some friends I asked to try the game told me they liked the game, and facebook says they played it, but they do not show up in my apps database. 13 out of 28 captured! It makes me wanna cry cause all those uncaptured users are not getting the proper experience. I'm using Amfphp framework to bridge flash and php. The app is hosted for free on Heroku and uses the free pgsql db they provide. The app can be seen here: http://apps.facebook...wordfighterbeta After the flash loads I call the AS3 API for facebook: import com.facebook.graph.Facebook; Facebook.init(APP_ID, onInit); //my app id is correctly set function onInit(result:Object, fail:Object):void { if (result) { Facebook.api("/me", getUserInfoHandler, null, "GET"); loggedIn = true; } else { resultTxt.text = "In order to save your highscores this app requires facebook authentication."; loginBtn.label = 'Facebook Login'; loginBtn.addEventListener(MouseEvent.CLICK, handleLoginClick, false, 0, true); loginBtn.enabled = true; } } //called when they click 'login' function handleLoginClick(event:MouseEvent):void { Facebook.login(onLogin); } function onLogin(result:Object, fail:Object):void { if (result) { Facebook.api("/me", getUserInfoHandler, null, "GET"); } else { resultTxt.text = "Authorization denied."; } } function getUserInfoHandler(result:Object, fail:Object):void { if (result) { userName = result.name; userID = result.id; registerUser(userID, userName); //this is where I try to add the user to the database } else { resultTxt.text = 'fail'; } } function registerUser(id, user):void { if (! local) { _netConnection = new NetConnection(); _netConnection.connect("https://sheltered-plateau-6639.herokuapp.com/Amfphp/"); _netConnection.call("WordFighter/registerUser", new Responder(handleResultArray, null), id,user); } } function handleResultArray(result:*):void { for each (var user:Object in result) { userScore = user.score; //start the game } And here is the registerUser function I wrote in PHP: public function registerUser($id, $name){ $host = "ec2-107-22-161-45.compute-1.amazonaws.com"; $user = "jytgyzybpoqjed"; $pass = "password"; $db = "dbvgstj2v06pit"; $con = pg_connect("host=$host dbname=$db user=$user password=$pass") or die ("Could not connect to server\n"); $query = "SELECT * FROM noobs WHERE fbID='$id'"; $rs = pg_query($con, $query) or die("Cannot execute query: $query\n"); if(pg_num_rows($rs) > 0){ $noobs = array(); $noobs[] = pg_fetch_assoc($rs); return $noobs; } else { $query = "INSERT INTO noobs (fbID, name, score) VALUES ('$id', '$name', '0')"; $rs = pg_query($query) or die("Cannot execute query: $query\n"); $query = "SELECT * FROM noobs WHERE fbID='$id'"; $rs = pg_query($query) or die("Cannot execute query: $query\n"); $noobs = array(); $noobs[] = pg_fetch_assoc($rs); return $noobs; } pg_close($con); } So yea. Who is the genius out there that can tell me why so many users aren't getting saved. The part that really confuses me is that when I look at the actionscript I see no way they can advance and play the game without the php returning an answer to the registerUser call since that's the only place in the code that starts the game, so why are some people playing the game and evading the database?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.