I just created a functional generator, that generates the embed code for a custom "Flash Mp3 Player". Three files are used: 1 HTML, and 2 PHP, and they're hosted in a writable (CH MOD 777) folder, on a Linux server. The "
Index.html" has an actual XML playlist in the form that can be edited by the user. Once the user submits that, it goes to "
prot01.php", which writes it to a file on the server, with a unique name (i.e.,
12-m2512-e12th) that has the date and minute in it. And then, that same filename is sent to "
prot02.php", where it's displayed in the embed code. I'm still new to writing in PHP, and would like to know some ways that I can improve the function of this generator. It has a 2% failure rate as it is right now. Feel free to test it on my site.
index.html
Code:
<p align="center">
<form name="form1" method="post" action="prot01.php">
<TEXTAREA NAME=usertxt COLS=60 ROWS=20>
<?xml version="1.0" encoding="UTF-8"?>
<player showDisplay="yes" showPlaylist="yes" autoStart="no">
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 01"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 02"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 03"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 04"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 05"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 06"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 07"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 08"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 09"/>
<song path="http://realbadinc.com/123/sample1.mp3" title="Sample - Track 10"/>
</player>
</TEXTAREA>
</p>
<p align="center">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
prot01.php
PHP Code:
<?
$fp=fopen(date("m\-\min\-\ejS"), "w");
fwrite($fp,stripslashes($usertxt));
fclose($fp);
Header("location: prot02.php");
exit();
?>
prot02.php
Code:
<center>
<b><font color="red">Fubar (and other) Code</font></b>
<br />
<form name="test">
<br />
<textarea name="textarea1" cols=40 rows=7 onClick="this.focus();this.select()">
<embed allowscriptaccess="never" allownetworking="internal" src="http://www.realbadinc.com/players/mp3playerDevilgirl.swf" align="baseline" border="0" width="300" height="320" enablejavascript="false" menu="false" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="playList=http://www.realbadinc.com/ip/generator/<?echo date("m\-\min\-\ejS");?>&ShowEQ=1&initVol=100" wmode="transparent"></embed>
</textarea></form>
</center>
<br />
<br />
<center>
<b><font color="red">Myspace Code</font></b>
<br>
<form name="test">
<br />
<textarea name="textarea1" cols=40 rows=7 onClick="this.focus();this.select()">
<object type="application/x-shockwave-flash" allowScriptAccess="never" allowNetworking="internal" height="320" width="300" data="http://www.realbadinc.com/players/mp3playerDevilgirl.swf"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="movie" value="http://www.realbadinc.com/players/mp3playerDevilgirl.swf" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="flashvars" value="playList=http://www.realbadinc.com/ip/generator/<?echo date("m\-\min\-\ejS");?>&ShowPlaylist=1&ShowEQ=1&firstTrack=1&initVol=100" /><param name="wmode" value="transparent" /></object>
</textarea></form>
</center>