Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

External date and time check.

Explorer ,
Nov 18, 2023 Nov 18, 2023

Hi!

I'm facing an issue that I thought I could resolve regarding date and time checking. I am currently aiming for an application in which a certain code expires after the period defined by me through the source code.

 

check.addEventListener(MouseEvent.CLICK, check_code);

var date_end:Date = new Date(2023, 10, 6, 10); // year, month, day, hour
var date_now:Date = new Date(); //
var differenceInMilliseconds:Number = date_end.time - date_now.time;

const MILLISECOND_PER_SECOND:int = 1000;
const SECOND_PER_MINUTES:int = 60;
const MINUTES_PER_HOUR:int = 60;
const HOURS_PER_DAY:int = 24;

var differenceInSeconds:Number = differenceInMilliseconds / MILLISECOND_PER_SECOND;
var differenceInMinutes:Number = differenceInSeconds / SECOND_PER_MINUTES;
var differenceInHouse:Number = differenceInMinutes / MINUTES_PER_HOUR;
var differenceInDays:Number = differenceInHouse / HOURS_PER_DAY;

function check_code (e:MouseEvent)
{	
	if(insert_code.text == "newCode")
	{
		if (date_now > date_end) return  error_msg.text = "Error: Invalid code";
		trace(date_now);
		trace("approved"); 
		nextFrame();
	}
	else
	{
		trace("Reject code!");
		error_msg.text = "Error: Código inválido";
	}
}

The problem is the possibility of circumventing the system, as if you change the date and time of the device used to a date earlier than the one configured, it recognizes that the code is within validity. Could you help me resolve this situation, please?

TOPICS
ActionScript , How to
178
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2023 Nov 18, 2023
LATEST

Perhaps, you need not be overly concerned about it. It appears improbable to me that someone would opt to alter their system's date, as doing so could lead to numerous issues with the majority of standard software installed on a modern computer.


In my view, obtaining a reliably accurate date seems impossible without relying on an external server.


- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines