![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
|||||||
| FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Free Broadband Speed Test Questions regarding our Free Speed Tests including the broadband test available for download. |
|
|
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
So I modified logger.php so that it inserts the data into a MySQL database instead of the log file. Its all working fine except its inserting two rows with identical information and timestamps except for the downloadSpeed and uploadSpeed columns. One row has 0 and 0 while the other row has the actual speeds.
If I navigate to logger.php manually, it adds the single row properly (with 0 and 0 for the up/down speeds because the test wasn't run and $_POST is empty) but if I perform the speed test, it behaves as noted above. Here is the modified logger.php file: Code:
<!-- echo -->
<!-- Do not remove the echo comment above or speeds will not be recorded -->
<?
if (isset($HTTP_POST_VARS['testspeeds']))
{
$testspeeds = $HTTP_POST_VARS['testspeeds'];
$speeds = explode("\t", $testspeeds);
$info['downloadSpeed'] = $speeds[0];
$info['uploadSpeed'] = $speeds[1];
} else {
$info['downloadSpeed'] = 0;
$info['uploadSpeed'] = 0;
}
if (isset($_SERVER['REMOTE_ADDR']))
{
$info['ip'] = $_SERVER['REMOTE_ADDR'];
} else {
$info['ip'] = getenv('REMOTE_ADDR');
}
if (isset($_SERVER['HTTP_USER_AGENT']))
{
$info['browser'] = $_SERVER['HTTP_USER_AGENT'];
} else {
$info['browser'] = "";
}
if (isset($_SERVER['PHP_SELF']))
{
$info['page'] = $_SERVER['PHP_SELF'];
} else {
$info['page'] = "";
}
if (isset($_SERVER['HTTP_REFERRER']))
{
$info['referrer'] = $_SERVER['HTTP_REFERRER'];
} else {
$info['referrer'] = "";
}
require('PATHTOFILEWITHUSERNAMES');
require_once('../include/mySQL.php');
$db = new mySQL($logsUser, $logsPass);
$x = 0;
$cols = '(';
$vals = '(';
foreach ($info as $k => $v)
{
$x++;
$last = ($x == count($info)) ? true : false;
$cols .= "`{$k}`";
$vals .= "'{$v}'";
if (!$last)
{
$cols .= ', ';
$vals .= ', ';
}
}
$cols .= ')';
$vals .= ')';
$sql = "INSERT INTO `logs` {$cols} VALUES {$vals}";
$db->selectDatabase('MYDATABASE');
$db->query($sql);
unset($db);
?>
__________________
Keith bloodninja.org duvalltech.com rlpspeedtest.com |
|
|||
|
Oh good, at least I know that its a known issue.
I wonder what is triggering it though.. I'm not a flash developer, but it appears that mostly you just pass the speed results to the $_POST variable. It seems to work fine the way you originally had the logging. What about the modified script is triggering it?
__________________
Keith bloodninja.org duvalltech.com rlpspeedtest.com |
![]() |
| Thread Tools | |
| Display Modes | |
|
|