1
Anonymous
Milliseconds in flashgames
  • 2009/1/7 19:18

  • Anonymous

  • Posts: 0

  • Since:


Hello,

How I can store the score with milliseconds in flashgames module ?

$timestamp strtotime($score);
$formatedTime strftime("%H:%M:%S"$timestamp);
$hours substr($formatedTime02);
$minutes substr($formatedTime32);
$seconds substr($formatedTime62);
$numSeconds = (($hours 60) * 60) + ($minutes 60) + $seconds;
$score $numSeconds;



2
trabis
Re: Milliseconds in flashgames
  • 2009/1/8 0:57

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


What is the value of $score in the beginning?

3
ghia
Re: Milliseconds in flashgames
  • 2009/1/8 1:32

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


function fmicrotime() 
{
    
$now explode' 'microtime() );
    return (float)
$now[0] + (float)$now[1];
}
$t_start fmicrotime();

// Do some actions

$t_stop fmicrotime();
$score $t_stop $t_start;

4
Anonymous
Re: Milliseconds in flashgames
  • 2009/1/8 2:09

  • Anonymous

  • Posts: 0

  • Since:


This is whole file functions.php


5
ghia
Re: Milliseconds in flashgames
  • 2009/1/8 2:47

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


If the value is passed as a time string, then there are no milliseconds in the score. The smallest division is second.
You may try to make the returned raw score visible by :
if(strstr($score":") !== false){
  print 
"|".$score."|<br />";


6
noo-b
Re: Milliseconds in flashgames
  • 2009/1/8 4:12

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


may i know what is the latest version of flashgame module which is safe..and where can i download it

the last time i heard, the last version has sql injection vulnerability

TQ
I Love Xoops

7
Anonymous
Re: Milliseconds in flashgames
  • 2009/1/8 15:09

  • Anonymous

  • Posts: 0

  • Since:


Downlad last version of flashgames with security fix from here.

I just talked with oliver ( flashgames developer ) and he said:

"I was not aware that the milliseconds will not be considered .. The scoring routine is in file flashgames/include/functions.php
function pnFlashGames_storeScore
.....
// a formated time string was passed... convert it to seconds
$timestamp = strtotime($score);
$formatedTime = strftime("%H:%M:%S", $timestamp);
$hours = substr($formatedTime, 0, 2);
$minutes = substr($formatedTime, 3, 2);
$seconds = substr($formatedTime, 6, 2);
$numSeconds = (($hours * 60) * 60) + ($minutes * 60) + $seconds;
$score = $numSeconds;

You have to extend the strftime but I don't know if it supports milliseconds.
Maybe you have to use another function to convert the score.

Another option is to switch to highest or lowest score. If you do this the time score will be converted into a numeric score.Not the best solution, I know
".

8
ALOOoo
Re: Milliseconds in flashgames
  • 2009/1/13 4:48

  • ALOOoo

  • Just popping in

  • Posts: 41

  • Since: 2004/10/9


Dear support/coding team .. This issue is very imporatant.

Your attention and support are highly appreciated here.

Thanks

9
yyvonne
Re: Milliseconds in flashgames
  • 2009/1/13 5:39

  • yyvonne

  • Just popping in

  • Posts: 38

  • Since: 2008/4/4 2


When I tried to install Flashgames, it prompt me error: Invalid default value for 'res_x'

How to fix this?

10
Anonymous
Re: Milliseconds in flashgames
  • 2009/1/13 6:10

  • Anonymous

  • Posts: 0

  • Since:


Edit flashgames/sql/mysql.sql file and replace:
res_x int(11NOT NULL default '',
res_y int(11NOT NULL default '',

with:
res_x int(11NOT NULL default '0',
res_y int(11NOT NULL default '0',




Login

Who's Online

180 user(s) are online (108 user(s) are browsing Support Forums)


Members: 0


Guests: 180


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits