How to make countdown timer with mysql & php?

How to make countdown timer with mysql & php?

Example,
When Button1 Click Then Count Down Timer Start for 1 or 2 Hours And Timer Data store in mysql database so that countdown timer can’t hack.
Is it possible to make in Niotron?
Please Any Body Help.
Thanks in Advance :smiling_face_with_three_hearts:

1 Like

may be possible using background extension

Do you know how to make.?

You know how to maKe background timer using tiny db

Very simple.
1st create a php file buttonClick.php and write codes to store/update current server time with the deviceid/anyunique id that you are using to identify users. pass this id in queru of this file

Example: https://buttonClick.php?id=USER_ID

Store/Update this info on your mysql table.

Now create another PHP file getClickTime.php and write codes to get stored time with the deviceid/anyunique id that you are using to identify users. pass this id in queru of this file

Example: https://getClickTime.php?id=USER_ID

Insted of returning time write codes to compare stored time with current time. Now if the difference of stored & current time is more then 2/3/4… hrs (as per your need).

Return {"status": true} else return {"status": false}


Please note that, you can do above thing using a single PHP file by updtaing the time in mysql table if status is true (i.e the time difference is more then n hrs)

1 Like

@hridu45 Me and my team are working on this system we are trying hard to do this so that we can make a unhackable button click in which one can click the button once in 1 hour or 2 or 24 as per developer’s choice

1 Like

I am also trying hard but can’t do this.

@tanishraj given method not working perfectly because php diff time can’t calculate time interval perfectly :disappointed_relieved:

You can try this php code

<?php
date_default_timezone_set('Asia/Dhaka');

$date_1 = new DateTime('2021:08:19 00:00:00');

$nowDate = new DateTime(date('y-m-d h:m:s'));

$interval = $nowDate->diff($date_1);
echo $interval-> format ('%h:%i:%s');


?>

May be I can make it with firebase & web only…

This work can be done easily with api and firbase or any other fast data base :wink::wink:

Very simple man…

Just with the help of tinydb you can do it

Once user click start timer, just get current online time. Convert it into milli. To this just add the final timer in milli… (say , for 1 HR timer mean add 3600000 milli) and save this final timer in any database like tinydb, firebase, gsheet or anything)

And with the help of this final timer just find the difference between current time and final timer. It wiil give you the remaining values

After the timer starts if user restarts the app, just check tinydb have value or not. If it have get online time and compare the milli… if the difference is + then start counting.else set tinydb to zero (also once timer over set it to zero).

Just test this…

Just test this. It works with 50s timer
TestingTimer.apk (5.5 MB)

I used tinydb so after timer trigger and user clears data timer too will clear. If you use anydb we can interpret the data

1 Like

Test apk working Fine :fire:
Can you share the aia file ,Boss ?:fire:

(post deleted)

It was created in another platform. I will make it in niotron and will send you. And I will try to reduce blocks

1 Like

Okay,Sir I waiting for you. :slightly_smiling_face:

Waiting is over. Just go through with this link