Search Help Board

PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help

C# Help

 PHP and Flash
Author:  (
Date:   06-09-03 21:55

Okay, I'm at school right now so I can't test this with my Flash file, but here is a PHP script I wrote. Since I don't know PHP, I am 153% certain I did something wrong. (Yes, 153% No more, no less.)

Here's the jest of it. I'm making a game that will save a replay of what the user has done (something like Starcraft), which anybody can watch. The replay will be a single string called "replayData". This replay will be saved to the server and be associated with their high score. As the high score list changes, new replays will appear and old replays will be removed. Hence, I need a unique ID for each replay that will be saved along with each high score, giving the appropriate reference to this replay. So here is what I came up with...

The flash script is sending the variable replaydata as a GET string.

// load replayData
// Get the unique ID
$filename = "turret/unique.sco";
$file = fopen($filename, "w+");
if ($file == null)
fputs($file, 0);
// Create a file for the replay
$replay = fopen("turret/replay".$id.".rep", "w")
fputs($replay, $replayData);
fclose ($replay);
// return the ID to Flash
echo ($file);
// Increase the unique ID
fputs($file, $file);

Since I don't know PHP at all (I mostly took clues from an existing file), I know I did something (or probably most things) wrong. Will someone please be kind enough to correct all my obscene errors? Many thanks.

 Topics Author  Date
 PHP and Flash  new
Marshall Beachy 06-09-03 21:55 
Go to Top  |  Go to Topic  |  Flat View  |  Search 
New Topic
 Reply To This Message
 Your Name:
 Your Email:
Email replies to this thread, to the address above.

Provided By