PHP Code:
PHP Warning: file_get_contents(player_56860.txt): failed to open stream: No such file or directory in /home/HIGHJUMP/stats.php on line 24
I get this for every file.
PHP Code:
<?php
echo "scriptdata2mysql by 123123231 29.05.2013\n";
define('MYSQL_HOST', '..');
define('MYSQL_DBNAME', '..');
define('MYSQL_DBUSER', '..);
define('MYSQL_DBPASS', '.');
define('MYSQL_DBPORT', '..');
$mysqli = new mysqli(MYSQL_HOST, MYSQL_DBUSER, MYSQL_DBPASS, MYSQL_DBNAME, MYSQL_DBPORT);
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$numFiles = 0;
$numStats = 0;
$numErrors = 0;
$files = scandir('/home/.callofduty2/sd2/scriptdata/stats');
foreach($files as $filename)
{
$guid = substr($filename, 7,-4);
$content = file_get_contents($filename);
$stats = explode("\n", $content);
foreach ($stats as $stat)
{
$tmp = explode(",", $stat);
$n = count($tmp) . " ";
if ($n != 3)
continue;
$kills = $tmp[0];
$headshots = $tmp[1];
$bash = $tmp[2];
$name = $tmp[3];
//echo "$n $guid $key => $value\n";
$sql = "
INSERT INTO
stats
(name, kills, headshot, bash, guid)
VALUES
('$name', '$kills', '$headshots', '$bash', '$guid')
";
$mysqli->query($sql);
if (mysql_error())
{
echo mysql_error() . "\n";
$numErrors++;
}
$numStats++;
}
$numFiles++;
}
echo "Done! Files=$numFiles Stats=$numStats Errors=$numErrors\n";