Fincikas Posted August 6, 2011 Share Posted August 6, 2011 How to do that time()'s numbers from increasing just stops after someone press the link and that resould saves into variable. Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/ Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 6, 2011 Share Posted August 6, 2011 sorry, but can you explain clearer what you are trying to achieve? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253363 Share on other sites More sharing options...
Fincikas Posted August 6, 2011 Author Share Posted August 6, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253366 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 6, 2011 Share Posted August 6, 2011 i still dont get you. o.0 Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253370 Share on other sites More sharing options...
voip03 Posted August 6, 2011 Share Posted August 6, 2011 do u want the button to change the time OR deete the link/time? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253371 Share on other sites More sharing options...
Fincikas Posted August 6, 2011 Author Share Posted August 6, 2011 ...... 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.) Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253372 Share on other sites More sharing options...
Fincikas Posted August 6, 2011 Author Share Posted August 6, 2011 I just wanna know, is it even posible to do, or maby you know better sulution? because all this day i can find the sulution.... Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253374 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 6, 2011 Share Posted August 6, 2011 so basically you want to create a script which makes a user upgrade his level after he click a button with 5 minute time delay? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253375 Share on other sites More sharing options...
Fincikas Posted August 6, 2011 Author Share Posted August 6, 2011 basicly.... Later will be other times to upgrade and ect. but now i wanna know that, wanna know how to upgrate level with time. And i think i get one of sulutions that I cant explain to you... Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253377 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 6, 2011 Share Posted August 6, 2011 what you mean you cant explain? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253378 Share on other sites More sharing options...
Fincikas Posted August 6, 2011 Author Share Posted August 6, 2011 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..... Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253379 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 6, 2011 Share Posted August 6, 2011 this is wad i have for you <?php date_default_timezone_set('Asia/Singapore'); //change the timezone to yours. $nextWeek = time() + (300); echo 'Now: '. date('h:i:s d/m/y') ."</br>"; echo 'Five Minute: '. date('h:i:s d/m/y', $nextWeek) ."</br>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253381 Share on other sites More sharing options...
mikesta707 Posted August 6, 2011 Share Posted August 6, 2011 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) Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253485 Share on other sites More sharing options...
Fincikas Posted August 7, 2011 Author Share Posted August 7, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253612 Share on other sites More sharing options...
Fincikas Posted August 7, 2011 Author Share Posted August 7, 2011 have a table that stores that time stamp when they pressed the button, This is almost what my idea was. Can anyone tell me how to do it? How to store simestamp in the table? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1253615 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 19, 2011 Share Posted August 19, 2011 how is the project coming? still need help? Quote Link to comment https://forums.phpfreaks.com/topic/244061-moving-timestamp-converting-to-timestamp/#findComment-1259298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.