Jump to content


Photo

phpFunction


  • Please log in to reply
11 replies to this topic

#1 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 24 April 2012 - 12:08 AM

Updated 1/12/2013

What does this do?
This extension allows you to call php functions from a server-side php file, in an easy and seamless fashion.

Why would I want to do that?
PHP is a versatile language that is useful for doing server-side tasks, such as manipulating databases, and storing large amounts of data for extended periods of time.

Give me an example
Direct MYSQL database functionality for login systems, scoreboards, etc.

Use
phpFunction(url,0) or phpFunction(url,1) depending on whether to use async or not.

I've included a basic and advanced install guide. There is also a tutorial on how to use this plugin to create a login system HERE

Edited by stoneyftw, 13 January 2013 - 04:22 AM.

  • 1
Posted Image

#2 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 30 April 2012 - 09:40 PM

I now have a tutorial out that walks you through the setup of a PHP and MYSQL based login system. It uses this extension heavily, and is available HERE.

Also changed the download link to a different host that does not require https.

Edited by stoneyftw, 30 April 2012 - 10:21 PM.

  • 1
Posted Image

#3 junhalestone

junhalestone

    GMC Member

  • GMC Member
  • 457 posts
  • Version:GM8.1

Posted 02 May 2012 - 07:15 PM

Looks great!
Do you happen to know if this is compatible with the Webs.com login system? If so, I'll definitely use it!
  • 0

> PlanIt (WIP restarting June 12th. Need feedback and suggestions if you have them).
       - Feedback (GMC)
       - Game News + Comments (GameJolt)

> GameJolt Profile
> SoundCloud Stream


#4 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 02 May 2012 - 08:13 PM

Looks great!
Do you happen to know if this is compatible with the Webs.com login system? If so, I'll definitely use it!


Edit: Webs.com does not allow PHP or MYSQL access.

The short answer is that if you can upload php files to the same directory that your game is hosted into, then you should be able to use this plugin. I've never tried to incorporate a gm:html5 game into a wysiwyg site editor though, so I'm not 100 percent sure. Would love to know though.

Edited by stoneyftw, 09 May 2012 - 10:16 PM.

  • 0
Posted Image

#5 GenoDoucette

GenoDoucette

    g e n o d o

  • GMC Member
  • 1008 posts
  • Version:GM:Studio

Posted 19 May 2012 - 03:54 PM

Does it work with GM8.1? I it does, I'll for sure download it :)
  • 0

ALWAYS >b3v6o7.jpg< ALWAYS


#6 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 20 May 2012 - 01:27 AM

I haven't tested in with 8.1, but I can't see why it wouldn't work.
  • 0
Posted Image

#7 iotech

iotech

    GMC Member

  • New Member
  • 6 posts
  • Version:GM:Studio

Posted 22 June 2012 - 05:52 AM

Download seems to be borked. How about a new link? Or maybe someone who already downloaded this will re-share?
  • 0

#8 locohost

locohost

    GMC Member

  • GMC Member
  • 459 posts
  • Version:GM:Studio

Posted 02 November 2012 - 08:43 PM

@stoneyftw: None of your download links work so I'm assuming you're using the PHP eval function, which is very dangerous.

In fact it's so dangerous this forum app filters out the word eval with parens after it! :blink:

Edited by locohost, 02 November 2012 - 09:14 PM.

  • 0

#9 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 13 January 2013 - 04:11 AM

@stoneyftw: None of your download links work so I'm assuming you're using the PHP eval function, which is very dangerous.

In fact it's so dangerous this forum app filters out the word eval with parens after it! :blink:/>


That's an incredibly ridiculous thing to assume, especially because a download link has nothing to do with using the eval function. The hosting I had simply ceased to exist and I never updated it. Simple as that.

At any rate, I've re-upped this with working links, for all the people that have messaged me asking for this. Cheers!
  • 0
Posted Image

#10 locohost

locohost

    GMC Member

  • GMC Member
  • 459 posts
  • Version:GM:Studio

Posted 13 January 2013 - 05:25 PM

Ok, I see. I misunderstood the claimed capability of this extension. I read this as saying you can call any php function from GameMaker. Which is misleading and not what this does. You can execute some php code in a switch block via a string switch key. So you can't actually reference/call any arbitrary php function, which is why I assumed "eval" so sorry about that.

Your extension can only handle synchronous (blocking) XmlHttpRequest calls. Your forcing the GameMaker code to wait (blocking) for the server to respond so you could never use this in a Step event. It could still be useful for quick server calls with short string responses or true/false like in your example.

But regardless, it's interesting. I'm thinking about it some more. Thanks for the updated link :smile:
  • 0

#11 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 13 January 2013 - 05:38 PM

Yea I was envisioning a MYSQL based high score system, as well as a simple mysql based chat system. No problem mate. Honestly though, I coded this so long ago, that I'd have to open the code up and look at it to remember how it works. I've been out of the GM community for a while. I think I'm going to code my next iOS project with it though.
  • 0
Posted Image

#12 locohost

locohost

    GMC Member

  • GMC Member
  • 459 posts
  • Version:GM:Studio

Posted 13 January 2013 - 06:53 PM

Yea I was envisioning a MYSQL based high score system, as well as a simple mysql based chat system. No problem mate. Honestly though, I coded this so long ago, that I'd have to open the code up and look at it to remember how it works. I've been out of the GM community for a while. I think I'm going to code my next iOS project with it though.


If you haven't yet, you should really take a look at GameMaker's built in asynch http/callback functionality. It's a bit convoluted to implement (sadly, like a lot of GM "low priority" functionality) but it works very well with a ds_list and a bit of custom code managing the callbacks. If you ever decide to look at it, I'm happy to lend a hand :-)
  • 0