Jump to content


Photo

Php4games


  • Please log in to reply
83 replies to this topic

#1 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 03:28 AM

I've been away from this community for quite sometime. Due to many requests i'm restoring a URL to the DLL. If It doesn't function correctly with the new Game Maker 7 / PHP, there Isn't much I can do about It as I'm no longer an active game maker user.

I wont be able to support this thread much or at all, so please don't expect help.


Description:
PHP4Games is a wrapper for PHP that gives Gamemaker 5.*, 6.* and 7.* (?) full access to the PHP Compiler, including CGI/CLI compilation, saving compiled scripts straight to file/returning them directly to gamemaker, with great simplicity.

Why PHP in games?
- SQL Access for Highscore tables
- XML capabilities for loading/saving
- Plenty more, see for yourself!

* Accepting suggestions for future updates.

Note: This DLL does not create HTML headers.

Download

*PHP4Games Is no longer supported by the Author. As a result of this you may modify and redistribute this to your hearts consent.
(If you have a mirror you would kindly like to share, please just drop a URL In this thread)

Documentation included in Zip File.

Happy programming.

Edited by ..::Origin::.., 04 May 2008 - 06:12 AM.

  • 0

#2 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 03:42 AM

Although PromaneX's had more functionality, this one seems pretty cool -_-.

XML Reader EXAMPLE: Download (Thanks Celebraces)
-Steve

Edited by Smarttart62, 22 August 2006 - 12:23 PM.

  • 0

#3 Quimp

Quimp

    Pretzel fanatic

  • New Member
  • 275 posts

Posted 02 July 2006 - 03:47 AM

The third argument is where your working directory of PHP-CGI.exe is.

I could not try the DLL, but might I suggest getting rid of argument2? There's a function in GM to get the directory of a file, which if I recall correctly is filename_dir(<file>); so this might be easy to do directly from the DLL.

Regards,
Quimp
  • 0

#4 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 02 July 2006 - 04:08 AM

What function are we supposed to call?
  • 0

#5 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 04:11 AM

READ POST ONE CELEBRACES. I cannot sweat enough that people don't READ.

Thankyou all for the postive comments, and Quimp, i think you mean argument 3? I didn't write an example, i suppose i should.. I'll include that, thanks.

Thankyou SmartArt, i purposely just designed this for the use of PHP for any version. I'll get to work on an example now.
  • 0

#6 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 02 July 2006 - 04:15 AM

global.php_call=external_define("PHPDll.DLL","<< WHAT GOES HERE??? >>",dll_stdcall,0,3,ty_string,ty_string,ty_strin
g);

I read the post a couple of times before I posted
  • 0

#7 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 04:18 AM

Oh, I apologise, i have added it to post one, i am sorry.

It is "ExecuteFileCB" anyway. Will write an example now.

Edit: Examples out.

Please, give me suggestions for what i should add.

Edited by ..::Origin::.., 02 July 2006 - 04:23 AM.

  • 0

#8 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 04:23 AM

You know we really can extend GM into php... I might get working on some small things with php, but i mean we can do things like FTP, MySQL, OGG Vorbis, Mail, etc all from my favorite programming language...
-Steve
  • 0

#9 FreeEverything

FreeEverything

    GMC Member

  • New Member
  • 3 posts

Posted 02 July 2006 - 04:26 AM

i hate to ask... but what is the use of php thorugh gm? this surely isnt a game devoping thing, and if your needing php, i'd just suggest another language -_-
  • 0

#10 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 04:28 AM

Indeed, unfortunatly we wont be able to post them here as its nothing game related for those things you listed. If you want more functions, do tell, i'll kindly add them.

@FreeEverything

I already have quite a few uses. You could use the php functions to host a server, or a client, you can search directories etc for player settings.. List goes on.
  • 0

#11 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 04:28 AM

Did you even read my last post?

PHP is so chock full of things that even games would find usefull. Heres some examples:

1. XML Reader/Writer (Make save files games in XML)
2. OGG Vorbis (Decode OGG files and show information about them in game)
3. MySQL (MySQL connectivitiy to store stats on the player

... Must i continue?
-Steve
  • 0

#12 FreeEverything

FreeEverything

    GMC Member

  • New Member
  • 3 posts

Posted 02 July 2006 - 04:29 AM

but the client will very RARELY have php installed so... yeah... i love php myself im just finding it hard to see the functionality of it...
  • 0

#13 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 04:30 AM

Err... Yet again have you read anything?

Include the CGI version of php (the executable) packaged with your game. Thats all you need for PHP functionality.
-Steve
  • 0

#14 FreeEverything

FreeEverything

    GMC Member

  • New Member
  • 3 posts

Posted 02 July 2006 - 04:31 AM

ugh... i dont want to argue... i know what you mean.... but im not sure how to say what i mean :S
  • 0

#15 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 04:33 AM

(Whoa we're nearly at page 2)

I could try include it in the dll, but is it even legal to do this? If so, i'll have a go at it. The CGI version is only 36 KB so i don't think it would hurt to include it.
  • 0

#16 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 02 July 2006 - 04:34 AM

It's not returning anything for me -_-

I set up my own, then tried your example, they both return nothing. BTW, want another host?

PS: I know it works, it performs a system() call.

Edited by celebraces, 02 July 2006 - 04:35 AM.

  • 0

#17 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 04:34 AM

Its fine to just include it with the game. Why package it with the dll?
-Steve
  • 0

#18 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 04:47 AM

Celebraces, yes another host would be cool. I just use wormholes as its easy to upload, and its not bad for speed.

If your using my example, update your scripts, i screwed the return type up.

Everyone update your DLL, i fixed it.

Sorry for the issues, don't know why it worked when i first tried it.

@SmartArt

Well, i thought it would save some loading time (not much) and would get extracted quicker(not much). Hmm, maybe your right.

I'm now adding write to file to the DLL. This will still support the output returned to GM, i will also add CLI to the dll.

Thanks for the comments, Origin.
  • 0

#19 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 02 July 2006 - 04:55 AM

Version 1 Mirror
Version 1.1 Mirror

Smarttart62' XML Example

EDIT: Sorry the links were broken, got banned by host. They're back up now :blink:

Still not returning anything -_-

Edited by celebraces, 20 August 2006 - 08:21 AM.

  • 0

#20 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 05:18 AM

You didn't download php.dll, phpdll.dll is the old one. Re-download it, delete phpdll.dll, and add php.dll, then modify your coding.

- Origin
  • 0

#21 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 02 July 2006 - 05:22 AM

OK, thanks, fixed and re-uploaded -_-
  • 0

#22 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 06:11 AM

Ok so this is nothing special, but it shows you how to create a simple XML reader with php.

Click to download (THANKS Celebraces)

Pretty basic stuff.
. testXML.php is the XML document
. xmlread.php is the php code for reading the XML data

Oh and BTW i made your code more nicer in the GM document -_- lol.

EDIT: Ugh, i should have used "simplexml_load_file()" instead of making it into a php file :blink:. Oh well...
-Steve

Edited by Smarttart62, 22 August 2006 - 12:21 PM.

  • 0

#23 FredFredrickson

FredFredrickson

    Artist

  • Global Moderators
  • 9225 posts
  • Version:GM:Studio

Posted 02 July 2006 - 06:39 AM

One thing confuses me, if you have PHP installed on your computer, why would you need to route it through GM in the first place?

Edited by FredFredrickson, 02 July 2006 - 06:39 AM.

  • 0

#24 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 06:40 AM

A new version is available,

This fixes the last bug involving the compiling.
Also adds output to file
Responds with an error if it must
You now define the php compiler directory on startup.
Easyier use for CLI (yes it functions, i checked) and CGI

Downloads on post 1. Enjoy.
  • 0

#25 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 03:21 PM

@Fred
You mean the php-cgi.exe file?
-Steve
  • 0

#26 Cynical

Cynical

    Inside the Cynic

  • New Member
  • 423 posts

Posted 02 July 2006 - 03:42 PM

Too bad the end user would need to have PHP installed... I would say just distribute PHP with your game, but I don't know if that is 100% legal.

Nice work -_- .
  • 0

#27 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 03:48 PM

Yes it is legal to distibute it with your game.

--------------------------------------------------------------------
                  The PHP License, version 3.01
Copyright © 1999 - 2006 The PHP Group. All rights reserved.
--------------------------------------------------------------------


Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:

  1. Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
     distribution.


  3. The name "PHP" must not be used to endorse or promote products
     derived from this software without prior written permission. For
     written permission, please contact group@php.net.
 
 4. Products derived from this software may not be called "PHP", nor
     may "PHP" appear in their name, without prior written permission
     from group@php.net.  You may indicate that your software works in
     conjunction with PHP by saying "Foo for PHP" instead of calling
     it "PHP Foo" or "phpfoo"

  5. The PHP Group may publish revised and/or new versions of the
     license from time to time. Each version will be given a
     distinguishing version number.
     Once covered code has been published under a particular version
     of the license, you may always continue to use it under the terms
     of that version. You may also choose to use such covered code
     under the terms of any subsequent version of the license
     published by the PHP Group. No one other than the PHP Group has
     the right to modify the terms applicable to covered code created
     under this License.

  6. Redistributions of any form whatsoever must retain the following
     acknowledgment:
     "This product includes PHP software, freely available from
     <http://www.php.net/s...et/software/>".


THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------

This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.

The PHP Group can be contacted via Email at group@php.net.

For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.

PHP includes the Zend Engine, freely available at
<http://www.zend.com>.

-Steve

Edited by Smarttart62, 02 July 2006 - 03:50 PM.

  • 0

#28 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 10:21 PM

Then its settled.. The php cgi/cli can be with the game, don't think further discussion about this is needed.

Still looking for idea's to shove in the DLL, though i don't think theres any now.

Hope its all working out for you, ..::Origin::..
  • 0

#29 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 10:38 PM

Allow us to send a string to the dll instead of JUST files.
-Steve
  • 0

#30 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 July 2006 - 10:40 PM

I said i added CLI support in the newest version.. Which is text instead of files BTW, just change the compiler your using from php-cgi to php-cli.

Hope that helps.
  • 0

#31 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 July 2006 - 10:41 PM

Oh. I havent tested the newest version :rolleyes:. Well thanks :huh:.
-Steve
  • 0

#32 Arion

Arion

    GMC Member

  • New Member
  • 16 posts

Posted 22 August 2006 - 03:56 AM

Err... Yet again have you read anything?

Include the CGI version of php (the executable) packaged with your game. Thats all you need for PHP functionality.
-Steve

<{POST_SNAPBACK}>


PHP 5.x is about 6-7 Megs....if you want to make something truly useful, make better ways for GML and PHP to communicate. There really is no reason to have a third level compiler. I like the idea, but as I said, the functionality would be limited to what you decide to add to it instead of what the PHP team decides to add, which really downgrades the entire idea.
  • 0

#33 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 05 January 2007 - 09:54 AM

Include the CGI version of php (the executable) packaged with your game. Thats all you need for PHP functionality.


But you have to include mysql.dll to get MySQL functionality.
  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#34 tuntis

tuntis

    GMC Member

  • New Member
  • 1839 posts

Posted 29 January 2007 - 06:37 PM

Include the CGI version of php (the executable) packaged with your game. Thats all you need for PHP functionality.


But you have to include mysql.dll to get MySQL functionality.

<{POST_SNAPBACK}>

Ya think!?
  • 0

#35 YopYop

YopYop

    GMC Member

  • New Member
  • 120 posts

Posted 29 January 2007 - 10:32 PM

Include the CGI version of php (the executable) packaged with your game. Thats all you need for PHP functionality.


But you have to include mysql.dll to get MySQL functionality.

<{POST_SNAPBACK}>

Ya think!?

<{POST_SNAPBACK}>

You don't need mysql.dll...
But is that secure to execute a sql request.
Because you need to put your login/pass ... in a temp.php file, and delete it after... But if someone see it ? He will be able to read all this secrets informations...

Is there a secure way to create a sql request thanx to this method ?
  • 0

#36 YopYop

YopYop

    GMC Member

  • New Member
  • 120 posts

Posted 31 January 2007 - 06:22 PM

No solutions ? <_<
  • 0

#37 Smarttart62

Smarttart62

    designFUSIONô

  • New Member
  • 2619 posts

Posted 02 February 2007 - 05:40 PM

NO.

MySQL passwords can easily be sniffed with a network analyzer and stolen. MySQL was made to be server-side only, therefore no real encryptions have taken place.
-Steve
  • 0

#38 YopYop

YopYop

    GMC Member

  • New Member
  • 120 posts

Posted 02 February 2007 - 08:36 PM

MySQL was made to be server-side only

I know but it'sn't ur dll topic...
Is that the same for this dll ?
  • 0

#39 celebraces

celebraces

    GMC Member

  • GMC Member
  • 956 posts

Posted 03 February 2007 - 01:56 AM

MySQL was made to be server-side only

I know but it'sn't ur dll topic...
Is that the same for this dll ?

<{POST_SNAPBACK}>

He still knows what he's talking about. It's true, you can't access a MySQL database directly with any kind of encryption. You'll need to use PHP on the server side to securely access the database.
  • 0

#40 YopYop

YopYop

    GMC Member

  • New Member
  • 120 posts

Posted 04 February 2007 - 02:02 PM

He still knows what he's talking about. It's true, you can't access a MySQL database directly with any kind of encryption. You'll need to use PHP on the server side to securely access the database.

Oki :(
So thanx a lot to both of you :P
  • 0

#41 tdmgames

tdmgames

    GMC Member

  • New Member
  • 1641 posts

Posted 05 February 2007 - 09:30 PM

ok:
Build an exampel tihn of the people who would find this useful!
  • 0
OH Balls!

Domain change: If any of my links do you not, please PM me and I will send you a working link :)

t3mp3st+Me+BMG = t3mp3st's edited avatar with changing colour effect.

#42 PromaneX

PromaneX

    Fixer of broken web things

  • New Member
  • 489 posts

Posted 09 February 2007 - 04:17 PM

It amazes me how many people still dont see how great being able to execute php code in your game is.. It opens up so many new features in just one add on! Im glad someone else has made a new php DLL good luck with it i hope it turns out well!
  • 0

#43 digitalwar

digitalwar

    GMC Member

  • New Member
  • 321 posts

Posted 01 March 2007 - 10:10 PM

Hello, why is it that if I call a script like :

./whois/phpwhois/example.php?query=sodevrom.com

IT says that there is no input ?

And if I only use ./whois/phpwhois/example.php it shows me ok ?

When I try to run the script from my server, it works, but with the dll, as I sayed , it gives me error that there is no input .. Please help

EDIT : TO view how the script works online , please check :
www.sodevrom.com/whois/phpwhois/example.php
O copyed all content to the folder of my game, I added php-cgi.exe php5ts.dll and php.dll in the folder of my game .

Edited by digitalwar, 01 March 2007 - 10:21 PM.

  • 0
... ... ...

#44 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 02 March 2007 - 05:36 AM

I see my Php dll is still being used. Unfortunatly i have lost the source code for it however it is no problem to restore it. Thanks everyone for using it and supporting it.

@Digitalwar
That is unusual and i do not understand why it will not work.

I can't pinpoint this issue at this current moment. I shall work on restoring the PHP DLL shortly.
  • 0

#45 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 08 April 2007 - 07:58 PM

cool could you make an example?
  • 0
"The world will soon see the most successful game ever."

#46 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 15 June 2007 - 02:25 PM

Alright, so my version of "Shortly" is a little bit longer then what everyone's normally is... (And apparently so is my "little bit" too)

Anyway, Version 1.2 is released, check first post. The DLL also adopted a name, "PHP4Games", Very thoughtful, isn't it?

Help Requests/Bugs/Suggestions/Feedback(Flames accepted) appreciated.
  • 0

#47 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 16 June 2007 - 11:07 AM

Sorry to stale the idea but,
I'm working on a php editor, which runs php normally and debug mode, simply by using TGMG silent dos and php's cgi. It works perfectly (parts of my new site are built in php handled from my program)

@ digitalwar - I had that problem with my program, it is because php isn't run from a server, in fact some global variables doesnt work at all, ie UserAgent. There is a php directive to set php variables (acting as a server), but i don't know how to use it yet.

For future refernces, it works by running DOS commands like "php source.php > result.htm", the ">" makes php's result writen to a file. Php directives/arguments are put between 'php' and 'source.php'. I can't complain about speed matters as TGMG's SD is lightining fast.

Edited by uuf6429, 16 June 2007 - 11:48 AM.

  • 0

#48 ..::Origin::..

..::Origin::..

    GMC Member

  • New Member
  • 435 posts

Posted 16 June 2007 - 12:15 PM

@uuf6429
I suggest you read my last post, as anything before it is out of date. Also read post one. Version 1.2 fixes certain issues revolving around that. Also, my php dll does both CGI and CLI.. AND can save to a file. So i don't see how using a DOS function would be any different to this.
  • 0

#49 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 16 June 2007 - 12:50 PM

I'm not going against anything, but look at it the other way round, why would I need a dll if DOS could do it?
Well if some problems I found inusing DOS are solved, I will definately use this.
  • 0

#50 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9603 posts
  • Version:GM:Studio

Posted 18 June 2007 - 07:35 PM

This would have been perfect for my SSG Server...too bad it wasn't around back then :) . haven't tested it, but if it works like it's supposed to, then congratulations, because I'll give it a 10/10.

Snyone using GM as any type of server will benefit from this.

-IMP ;) :lol:
  • 0

:GM123: Are you an artist who likes creating original creature designs? Maybe you can help out with Elementa here! Give it a look; you might like the idea :)

:bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: :excl: :bunny: