How to track free trial in programming? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
The community reviewed whether to reopen this question 10 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I have an application that users can use it 14 days without paying. However, after 14 days users will not be able to use the application unless s/he pays for it.
I don't know how to track the remaining time for the free trial. I'm thinking of setting an cronjob 14 days later when the users is created but I think it is a bit hard to manage (?).
The second thought would be checking the remaining time for every user at a specific time every day but timezone and server loading might be problem in this case.
I'm using MongoDB and Node.js for back-end and HTML, CSS, JS for front-end. How can I design my database and code to overcome this problem?
Thanks in advance.
I believe this question have enough detail please warn before closing.

You could possible save time of register of user and then every time on request of users that don't pays calculate the remaining time?

Related

How to validate user logged in web application (php)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Good day.
Could someone please tell me how I can control that a user does not enter a web application more than once?
Currently I am controlling it by storing the session that is created in php in a field of a table and through javascript using ajax I consult it every 10 seconds. I think there must be a better way ... thanks !!!
And finally solved it by validating that the session created is different from the previous one, thus updating it and the previous user wanting to validate his session in order to make any request will realize that it does not exist and this will remove him from the application .

How can I keep my database updating itself while no one is online (firebase)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Imagine a browser game that users have their resources to build an army/walls etc., and those resources should be updated based on their buildings even when they're offline. How can I update this data when they're off (I'm using Firebase)?
Consider Firebase as strictly a storage medium - not a service which is running all the time.
That being said, have your app "calculate" the state changes which would have theoretically transpired while the user was "offline" when the user connects.
Besides, if you did have your app continually update the Firebase backend while the user was offline, you would likely incur some surprising costs: Firebase Pricing.
Maybe there is a better way - I havent used Firebase for a while, but simplest way could be just as in Javascript - check the current day and calculate needed changes accordingly when some user access some resource. Say UserA builds an army and it reaches 100% in 10 days, so if UserB attacks UserA army after 5 days, just calculate UserA army strength and update its database. Maybe its even more efficient than doing some background jobs - do it when its needed and server will cost less.

Reload page if Database changes [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I can't set a javascript timer to reload the page every X seconds. It must be a perfect loop with no wait times.
I can't use AJAX. When the database changes a full screen video must be played, and there's no way I can load an "auto-fullscreen" HTML5 video from AJAX method through someotherfile.php
I spent 6 hours today trying to find a way to do this. Apparently I can't put PHP in a loop to 'listen' by doing sql queries every now and on. Weak language I guess.
It has nothing in common with PHP weaknesses it's about server side and client side.
Answering your question. You should try using HTML5 server sent events check these links it should clarify you how to do it. There are examples given:
http://www.w3schools.com/html/html5_serversentevents.asp
https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events
BTW you don't need reload page with JavaScript just simple meta referesh does this.
Note: using EventSource is not supported by all browsers.

Facebook automatic Birthday wish [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i want to write a script which send automatically an friend birthday wishes. My base idea was to write a php script which called every day by a cronjob. All solution which i found was deprecated by facebook.
Actually my idea is to export my facebook calender and let a script run over the "export-list" that import the birthdays into a database. Then I have to call every day the javascript that popup a send-dialog if someone have birthday. But that is not comfortable.
Did somebody know a better solution?
You cannot get the friends' birthdays anymore, because all the friends_* permissions have been removed with v2.0 of the Graph API. Only if they are also users of the same app and give the app the permissions.

How often should AJAX reload specific content on the page? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm constructing an app where users can insert their preferences in a table. It is possible to load an updated version of the table via AJAX. I would like to load these updated versions from time to time, so the users will see almost always the newest version of the table, without reloading the page by themself. My questions regarding that are:
How often should the browser of the user request via AJAX a new version of the table?
Is that a bad approach? Maybe users want to reload the page manually.
Thank you for any answer in advance. Let me know how I can improve my question.
You should probably do it anywhere between 5 and 15 seconds. It's not a bad approach, and you can add a "refresh" button for manual refreshing. If your server is shared or there's lots of traffic, you can increase the duration to 30 seconds.
Note: This answer is based on my experience with web apps and previously built applications and web sites. There are no set standards for this behaviour.

Categories

Resources