firewall Spyware removal internet speed test web security service free software and tips


Go Back   Web Security > Our Free Tools > Free Broadband Speed Test
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.

Advertisements

Inserting rows twice

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2008,
Junior Member
 
Join Date: May 2008
Posts: 3
Default Inserting rows twice

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);
?>
Any insight would be greatly appreciated.
__________________
Keith

bloodninja.org
duvalltech.com
rlpspeedtest.com
Reply With Quote
  #2 (permalink)  
Old 05-12-2008,
AMPC's Avatar
Administrator
 
Join Date: Jan 2007
Posts: 1,415
Default Flash speed test open source

Hi Keith,

I am aware of the problem and don't have a solution as of yet. I'm considering releasing the flash speed test as open source as I don't have time to care for it like I should, but this is just a thought.

I'll try to take a look at this when I get a little time.

Best regards,

Jim.
Reply With Quote
  #3 (permalink)  
Old 05-12-2008,
Junior Member
 
Join Date: May 2008
Posts: 3
Default

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
Reply With Quote
  #4 (permalink)  
Old 05-17-2008,
AMPC's Avatar
Administrator
 
Join Date: Jan 2007
Posts: 1,415
Default On my list.

It's on my list and good question!

Thanks,

Jim.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is .


Powered by a CPU
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.3.2 © 2009, Crawlability, Inc.