Jump to content

Moving timestamp converting to timestamp


Fincikas

Recommended Posts

sorry. I want something like that. Then i press the link i get current timestamp in variable and it wont change it saves what it was then i press the button. So that variable i can you later in other files and etc.

 

So i want from time() (there is just numbers)  numbers put in variable and save it that they wont change for lets say 10minutes and later they automaticly deletes and then it deletes i can press the link again. I hope you understood what i mean, because i dont know how to explain everything exactly. Most off all i need only part one, to get into variable, automaticly delete maby i do it on my own MABY :D

Link to comment
Share on other sites

...... :D

 

I just got idea how to make what i want: 2. How to do something like this, if someone press the link, in database or somewhere should start to count the time. After that time counts down, something should automaticly inserts into database. Exaple:

 

I press link to upgrade level. Level takes 5mins to upgrade. After 5min my level should become 2 from 1. And that should change that level 1from database and add level to2.

 

So if i press the link i get timestamp numbers, then i will add 5min. and than time target will be (time then the link was presssed +5mins) and then time reach the target, i can start to do something with mysql... I hope now it is clear :)

 

(then, then, then, then....... Sorry for bad english.)

Link to comment
Share on other sites

So if i press the link i get timestamp numbers, then i will add 5min. and than time target will be (time then the link was presssed +5mins) and then time reach the target, i can start to do something with mysql...

 

I cant explain all this stuff.....

Link to comment
Share on other sites

Ok well a couple of questions I want to ask about this thing you want to implement. You could code it a few different ways depending on what you want. Do you want the user to be able to press a button, and then the timer starts, and they can navigate away from the page or close the browser or whatever, and they are still leveled up after 5 minutes?

 

Or do you want it so that they click a button, and have to stay on the page watching the counter (or whatever other activity they can do) until 5 minutes have passed, and then their level or whatever is updated.

 

For the former, The simplest way I can think of would be to have a table that stores that time stamp when they pressed the button, and whenever they navigate to a new page, you check that table to see if enough time has passed (if so, update the table, otherwise don't). The only downside to this is that the table isn't updated at exactly 5 minutes. They could press the button, and go on vacation, and the table wouldn't be updated until they login again. You could also have some sort of Cron job that checks the table every xxx amount of time, and updates accordingly (or a combination of the two), but this could severly slow down your system if you have a lot of users in your table.

 

If the latter, you could use a combination of Javascript and AJAX to show a counter, and have the AJAX send a request to an update script once the count down is finished. The downside to this is you force the user to basically watch a counter for 5 minutes (assuming they can't do anything else on the page)

Link to comment
Share on other sites

Ok well a couple of questions I want to ask about this thing you want to implement. You could code it a few different ways depending on what you want. Do you want the user to be able to press a button, and then the timer starts, and they can navigate away from the page or close the browser or whatever, and they are still leveled up after 5 minutes?

 

 

Yes thats exeactly what I want, but i dont now anything about cron job. Are here any tutorials or reviews on these forums, maby someone could link me there?

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.