View Full Version : How do you make different file type load in different script?

Al Capone
02-12-2006, 12:28 PM
First hello :)

How do I make it so if a file ends in .nes it uses this:


Thanks in advance :)

02-12-2006, 12:56 PM
.swf files won't be able to use those HTML tags. I don't know for .nes files.
What do you mean with your question?

Al Capone
02-12-2006, 01:09 PM
first off thanks for the reply.

Both codes work, they retrieve the files from mySQL, but thats not the thing, .nes wont work in the one loading .swf and .swf wont open in the .nes script.

I want it to use the top script when a file is .nes

and i want it to use the bottom script when the file is .swf

i hope that wasnt confusing. i want it to use the top one when the file ends in .nes and bottom one when it ends in .swf

thanks in advance for any help.

02-12-2006, 01:19 PM
Oh, I think I get it now. You'll have something like page.php?file=something.nes or page.php?file=something.swf?

You could try something like this:

if (strstr($file, ".swf")) {
//.SWF code here
} else if (strstr($file, ".nes")) {
//.NES code here

Hope that helps :)

Al Capone
02-12-2006, 08:34 PM
Thanks, but it didn't work, I am using this right now:

<td><div align="center"><br>

if (strstr($file, ".swf")) {
<param name="movie" value="swf/';
echo $row['file'];
echo '" />
<param name="quality" value="high" />
<embed src="swf/';
echo $row['file'];
echo '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="';
echo $defaultwidth;
echo '" height="';
echo $defaultheight;
echo '"></embed> </TD> </TR>


} else if (strstr($file, ".nes")) {
<applet code=NESCafeApplet

echo $row['file'];
echo '"

<param name=LOADDATAURL value="nescafeload.php"
<param name=SAVEDATAURL value="nescafesave.php?user=user">
<param name=SOUND value="false">
<param name=LIGHTGUN value="false">
</applet><P align=center>

<TABLE cellspacing=0 cellpadding=0>

<TD width=100 colspan=2><FONT face=Tahoma size=1 color=#000000><B>CONTROLS</B></font></TD>

<TD width=100><FONT face=Tahoma size=1 color=#000000>Start Button</font></TD>
<TD align=right><FONT face=Tahoma size=1 color=#000000>ENTER</font></TD>

<TD><FONT face=Tahoma size=1 color=#000000>Select Button</font></TD>
<TD align=RIGHT><FONT face=Tahoma size=1 color=#000000>SPACE</font></TD>

<TD><FONT face=Tahoma size=1 color=#000000>A Button</font></TD>
<TD align=RIGHT><FONT face=Tahoma size=1 color=#000000>X</font></TD>

<TD><FONT face=Tahoma size=1 color=#000000>B Button</font></TD>
<TD align=RIGHT><FONT face=Tahoma size=1 color=#000000>Z</font></TD>

<TD><FONT face=Tahoma size=1 color=#000000>Pause NESCafe</font></TD>
<TD align=RIGHT><FONT face=Tahoma size=1 color=#000000>P</font></TD>

<TD><FONT face=Tahoma size=1 color=#000000>Toggle Sound</font></TD>
<TD align=RIGHT><FONT face=Tahoma size=1 color=#000000>S</font></TD>


</center> }

But for some reason it comes out looking like this (http://www.ewobble.com/game.php?gameid=35)

it just looks like text for some reason

Could someone tell me whats wrong with what I am using? Thanks in advance.

02-12-2006, 08:52 PM
No problem ^_^

Al Capone
02-12-2006, 09:11 PM
I see two windows and text for some reason when I did it (please see my attached screen shot below or the link above in previous post) I thought it worked because I didn't refresh, the code in my preious post is the portion that i think the problem is, if it's nessessary i can post the whole script i am using

I don't know what's wrong, please help, thanks in advance

02-12-2006, 09:25 PM
YOu need to add PHP tags:
in the right places. I'm sorry I can't help you more, I've got to go now. If you still haven't got it figured out yet, I'll help you tomorrow. Good luck!