okay I made the whoami.php and it said my usr name
I am not sure what you mean for me to do with this:
:confused:Code:$ chown -R `php whoami.php` scores
Printable View
okay I made the whoami.php and it said my usr name
I am not sure what you mean for me to do with this:
:confused:Code:$ chown -R `php whoami.php` scores
It's a shell command. Run it as the user that currently owns the files. It will change the ownership of scores and all files under it to the user output by whoami.php.
using putty I did that command..
it responded with:
chown 'php whoami.php' :invalid user
:confused: :cry: :whine: :cry:
Those are backticks (`) not apostrophes ('). I only used them for simplicity; you could just as well substitute the output of the whoami.php file for `php whoami.php`.
I am back after a long delay of this stupid thing called real life...
I have verified with the host, and the folders are most definetly mine. It is something in this php code I am sure... I just don't know what.
here is the complete script:
the error I get is:Code:<?php
$winscore = (int)$winscore;
// Create a Blank File if it doesn't already exist
if (!file_exists($filename))
{
$file=fopen($filename, "w");
fclose ($file);
}
// Read the file in
$oscores = file ($filename);
$numreadin = count($oscores);
// Break out the data into a new 2-d array called $tscores
for ($i = 0; $i < $numreadin; $i++)
{
$g = unserialize($oscores[$i]);
$tscores[$i][0] = $g[0];
$tscores[$i][1] = $g[1];
}
// Fill in any missing data with none/0
for ($i = $numreadin; $i < $scoresize; $i++)
{
$tscores[$i][0] = 0;
$tscores[$i][1] = "";
}
// Process the actions
// Insert a score/name
if ($action == "INSERT")
{
// Add name to end of list, and sort
$tscores[$scoresize + 1][0] = $winscore;
$tscores[$scoresize + 1][1] = $winname;
rsort ($tscores);
$file=fopen($filename, "w");
// Write them out
for ($i = 0; $i < $scoresize; $i++)
{
$st = serialize($tscores[$i]) . "\n";
fputs($file, $st);
}
fclose($file);
}
// Clear the list
if ($action == "CLEAR")
{
$k[0] = 0;
$k[1] = "no-one";
$ser = serialize($k);
$file=fopen($filename, "w");
for ($i = 0; $i < $scoresize; $i++)
{
$st = $ser . "\n";
fputs($file, $st);
}
fclose($file);
}
// Process the OUTPUT options
if ($viewtype == "HTML")
{
// HTML PAGE CREATED HERE
?>
<table cellpadding=2 cellspacing=2 border=0 width="330">
<tr align=center>
<th bgcolor="#663300" width="80"><font color="#ffff00" face="Arial, Helvetica, sans-serif" size="1">Rank</font></th>
<th bgcolor="#663300" width="126"><font color="#FFFF00" face="Arial, Helvetica, sans-serif" size="1">Name</font></th>
<th bgcolor="#663300" width="104"><font color="#FFFF00" face="Arial, Helvetica, sans-serif" size="1">Score</font></th>
</tr>
<?
for ($i = 0; $i < $scoresize; $i++)
{
echo ("<tr bgcolor='#669933' align='center'><td><font size='1' face='Arial, Helvetica, sans-serif'>");
echo ($i + 1);
echo ("</font></td><td><font size='1' face='Arial, Helvetica, sans-serif'>");
echo ($tscores[$i][1]);
echo ("</font></td><td><font size='1' face='Arial, Helvetica, sans-serif'>");
echo ($tscores[$i][0]);
echo ("</font></td></tr>");
}
?>
</table>
<?
}
// FLASH DATA CREATED HERE
if ($viewtype == "FLASH")
{
for ($i = 0; $i < $scoresize; $i++)
{
echo ("name" . $i . "=");
echo ($tscores[$i][1]);
echo ("&score" . $i . "=");
echo ($tscores[$i][0]);
echo ("&");
}
}
?>
Any ideas? I am just befuddled with this whole thing.Code:[09-May-2006 15:55:27] PHP Warning: fclose(): supplied argument is not a valid stream resource in /path/to/the/folder/scores.php on line 9
I really do not want to have to code 6000 lines of action script again just to make an external high scores list for Flash... sigh.. anything? anyone?
Thanks guys!
Is $filename defined?
in the Flash file I have it defined as this:
This tells the flash file that scores/highscores.sco is the file name to use everytime "scoreFile" is calledCode:_global.scoreFile = "scores/highscores.sco";
In the 2 places I call the script (load and submit) I have this:
Code:_root.filename = _global.scoreFile;
As far as in the php file itself, I guess not, if it's not in there. All I do know about this php file (I didn't write it, obv. ) is that it is to open highscores.sco, if it is already there, and create it if it does not yet exist.
Well, that's probably your problem, then :) Define $filename = "scores/highscores.sco"; somewhere before calling that code.
I will give that a try and let you know!
Thanks Twey!
Well, that ALMOST worked! LOL
I added the definition and now it created the highscores.sco file like it was supposed to.
That tells me everything is reading and sending just fine.
I don't get an error log either!
The only problem now, is that it doesn't write to the sco file. It stays blank.
I CHMOD to 777 on virtually every file there, and still nothing.
I think I need another break. I can't afford to throw another computer out the window.
If you have any ideas about the writing thing though I would love to hear them.
I have a feeling I am going to have to re-do the Flash portion now though. greeeaaat... sigh.