Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router don't work if there is no extension (Normally added automatically by the server) #3

Open
moimadmax opened this issue Dec 4, 2020 · 9 comments

Comments

@moimadmax
Copy link

On the Casual Collective games (specially The Space Game) the flash call php files without their extension. (widget.casualcollective.com/load for widget.casualcollective.com/load.php). So at least on windows it doesn't work.
I've make a dirty thing that work for this game only (I'm not high skilled with php):
Rapidly on the function router_route_pathname($pathname) I test if the file has an extension and if not I add ".php" to the end of $pathname. Yes it's dirty, but it works.
Maybe the solution is to search the scripting tag like '<?php' in the file and add the right extension.
Or add the server configuration on the game database.

Thanks for your works.

@tomysshadow
Copy link
Collaborator

tomysshadow commented Dec 5, 2020 via email

@moimadmax
Copy link
Author

Yes, but the problem comes before the router can route it thru cgi-bin, it cannot take decision because the game call the file without the extension, see logs extract:

INFO  [10:39:52]      The Space Game: The Space Game has been started
INFO  [10:39:52]       Game Launcher: Launch Game "The Space Game" (PID: 11480) [
                                    applicationPath: "FPSoftware\Flash\flashplayer_32_sa.exe",
                                    launchCommand:   "http://storage.cloud.casualcollective.com/games/thespacegamehacked.swf",
                                    command:         ""d:/Flashpoint/FPSoftware/Flash/flashplayer_32_sa.exe" http://storage.cloud.casualcollective.com/games/thespacegamehacked.swf" ]
INFO  [10:39:55]              Server: [Sat Dec  5 10:39:55 2020] 127.0.0.1:55614 Accepted
INFO  [10:39:55]                      Routing Pathname: widget.casualcollective.com/**load**
INFO  [10:39:55]                      Serving File From Base URLs: /widget.casualcollective.com/load
INFO  [10:39:55]                      	Using Base: Dri0m
INFO  [10:39:55]                      	Creating File Pointer Resource From URL: http://infinity.unstable.life/Flashpoint/Legacy/htdocs/widget.casualcollective.com/load
INFO  [10:39:55]                      	Failed to Open File
INFO  [10:39:55]                      	Using Base: Archive.org
INFO  [10:39:55]                      	Creating File Pointer Resource From URL: http://archive.org/download/FP90Data/FP90Data.zip/htdocs/widget.casualcollective.com/load
INFO  [10:39:56]                      	Empty File
INFO  [10:39:56]                      Serving File From Base URLs: /widget.casualcollective.com/load
INFO  [10:39:56]                      	Using Base: Dri0m
INFO  [10:39:56]                      	Creating File Pointer Resource From URL: http://infinity.unstable.life/Flashpoint/Legacy/htdocs/widget.casualcollective.com/load/index.html
INFO  [10:39:56]                      	Failed to Open File
INFO  [10:39:56]                      	Using Base: Archive.org
INFO  [10:39:56]                      	Creating File Pointer Resource From URL: http://archive.org/download/FP90Data/FP90Data.zip/htdocs/widget.casualcollective.com/load/index.html
INFO  [10:39:58]                      	Empty File
INFO  [10:39:58]                      Serving File From Base URLs: /widget.casualcollective.com/load
INFO  [10:39:58]                      	Using Base: Dri0m
INFO  [10:39:58]                      	Creating File Pointer Resource From URL: http://infinity.unstable.life/Flashpoint/Legacy/htdocs/widget.casualcollective.com/load/index.htm
INFO  [10:39:58]                      	Failed to Open File
INFO  [10:39:58]                      	Using Base: Archive.org
INFO  [10:39:58]                      	Creating File Pointer Resource From URL: http://archive.org/download/FP90Data/FP90Data.zip/htdocs/widget.casualcollective.com/load/index.htm
INFO  [10:39:59]                      	Empty File
INFO  [10:39:59]                      Serving File From Base URLs: /widget.casualcollective.com/load
INFO  [10:39:59]                      	Failed to Route Pathname
INFO  [10:39:59]                      [Sat Dec  5 10:39:59 2020] 127.0.0.1:55614 Closing

As you see the flash game call the file widget.casualcollective.com/load without the php extension. I think the extension is added automatically by the server with a rewrite rule.

So I've add this (shitty) piece of code just before the comment (// in situations ...) :

	$temp = pathinfo($pathname);	
	if($temp['extension'] == false) {
		$pathname = $pathname . '.php';
		router_output('Routing Pathname: ' . $pathname);
	}
	// in situations where we need a trailing slash, this will be appended to the pathname

And this game work. see the log :

INFO  [11:02:55]       Game Launcher: Launch Game "The Space Game" (PID: 7224) [
                                    applicationPath: "FPSoftware\Flash\flashplayer_32_sa.exe",
                                    launchCommand:   "http://storage.cloud.casualcollective.com/games/thespacegamehacked.swf",
                                    command:         ""d:/Flashpoint/FPSoftware/Flash/flashplayer_32_sa.exe" http://storage.cloud.casualcollective.com/games/thespacegamehacked.swf" ]
INFO  [11:02:55]              Server: [Sat Dec  5 11:02:55 2020] 127.0.0.1:55672 Accepted
INFO  [11:02:55]                      Routing Pathname: widget.casualcollective.com/load
INFO  [11:02:55]                      Routing Pathname: /widget.casualcollective.com/load.php
INFO  [11:02:55]                      Serving File From CGI-BIN: cgi-bin/widget.casualcollective.com/load.php
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55672 Closing
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55673 Accepted
INFO  [11:02:55]                      Routing Pathname: widget.casualcollective.com/pub/session/setup
INFO  [11:02:55]                      Routing Pathname: /widget.casualcollective.com/pub/session/setup.php
INFO  [11:02:55]                      Serving File From CGI-BIN: cgi-bin/widget.casualcollective.com/pub/session/setup.php
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55673 Closing
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55674 Accepted
INFO  [11:02:55]                      Routing Pathname: sessions.casualcollective.com/session/start
INFO  [11:02:55]                      Routing Pathname: /sessions.casualcollective.com/session/start.php
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55674 Closing
INFO  [11:02:55]                      Not A File From CGI-BIN: cgi-bin/sessions.casualcollective.com/session/start.php
INFO  [11:02:55]                      	Failed to Route Pathname
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55675 Accepted
INFO  [11:02:55]                      Routing Pathname: sessions.casualcollective.com/session/levelStart
INFO  [11:02:55]                      Routing Pathname: /sessions.casualcollective.com/session/levelStart.php
INFO  [11:02:55]                      [Sat Dec  5 11:02:55 2020] 127.0.0.1:55675 Closing
INFO  [11:02:55]                      Not A File From CGI-BIN: cgi-bin/sessions.casualcollective.com/session/levelStart.php
INFO  [11:02:55]                      	Failed to Route Pathname
INFO  [11:03:03]                      [Sat Dec  5 11:03:03 2020] 127.0.0.1:55676 Accepted
INFO  [11:03:03]                      Routing Pathname: x.mochiads.com/srv/1/8b88fbe9eb9f092f.swf
INFO  [11:03:03]                      Serving File From Base URLs: /x.mochiads.com/srv/1/8b88fbe9eb9f092f.swf
INFO  [11:03:03]                      	Using Base: Dri0m
INFO  [11:03:03]                      	Creating File Pointer Resource From URL: http://infinity.unstable.life/Flashpoint/Legacy/htdocs/x.mochiads.com/srv/1/8b88fbe9eb9f092f.swf
INFO  [11:03:03]                      	Failed to Open File
INFO  [11:03:03]                      	Using Base: Archive.org
INFO  [11:03:03]                      	Creating File Pointer Resource From URL: http://archive.org/download/FP90Data/FP90Data.zip/htdocs/x.mochiads.com/srv/1/8b88fbe9eb9f092f.swf
INFO  [11:03:04]                      	Empty File
INFO  [11:03:04]                      	Failed to Route Pathname
INFO  [11:03:04]                      [Sat Dec  5 11:03:04 2020] 127.0.0.1:55676 Closing
INFO  [11:03:12]      The Space Game: The Space Game exited with signal null

On the logs, it seems to miss some files (levelStart, start and the mochiads.com one) but the games seems to works fine with savegames too.

@tomysshadow
Copy link
Collaborator

tomysshadow commented Dec 5, 2020 via email

@moimadmax
Copy link
Author

Ok, so why it doesn't work ?
I'm pretty sure my modification isn't the right way to repair that.
But without that, the game just don't work, the first windows appear, and then there is an error saying that it doesn't succed to access casualcollective server.

@tomysshadow
Copy link
Collaborator

tomysshadow commented Dec 5, 2020 via email

@tomysshadow
Copy link
Collaborator

tomysshadow commented Dec 5, 2020 via email

@moimadmax
Copy link
Author

If you remove the extension on the file, how you will recognize the file type to route it thru the right directory (cgi-bin or htdocs) ?
Because when I've had a look on the router.php code, the choice is made based on extension. :
line 26 $router_script_extensions = array('php', 'php5', 'phtml');

Maybe if the file is not found, look on htdocs and cgi-bin directory without looking the extension and if their is a match restart the routing process with the full file name.

@tomysshadow
Copy link
Collaborator

tomysshadow commented Dec 7, 2020 via email

@moimadmax
Copy link
Author

moimadmax commented Dec 7, 2020

Ok. I've forgot the fact that's an human who place the file in cgi-bin or htdocs. Thanks for your time. It is to me to closed this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants