By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Automatic trigger of Reminder in PHP

P: 14
Hello Everyone,

I am banging my head since morning. please help me.. I am not so good at php..i am in learning phase...

My requirement was to generate a popup once you immediately login. windows.alert('please call') then the popup should come for every 2 hrs.

Even though you navigate to different pages on the site..This should still come..

I have started something like this:--
1. Calling this script on everypage.
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">alert_settimer();</script><script type="text/javascript">
  2. alert_settimer();
  3. </script>
And the code in the script is

Expand|Select|Wrap|Line Numbers
  1. function alert_settimer(){    time_stop=2*60*60*1000;    if(time_stop > 0) {         timer= setTimeout("alert_settimer(),window.focus();window.alert('Please call Originator');",time_stop )    }}function alert_settimer(){
  2.     time_stop=2*60*60*1000;
  3.     if(time_stop > 0) {
  4.          timer= setTimeout("alert_settimer(),window.focus();window.alert('Please call Originator');",time_stop )
  5.     }
  6. }
It is able to give me a popup for every 2 hrs. But whenever the user reloads the page after 1 hr. The function is called again and the count starts from 0hrs again. OR for example if 20 mins already passed then if i am going to a new page then the function is called again and so the timer starts again.
I am not getting any idea how to restrict it calling every time. OR send that 1 hr again to the function so that it starts from there. I tried some thing like setting the value in a session variable and then starting the counter from that value. But i am not successful. Please help me in solving this...
Mar 8 '10 #1

✓ answered by Dormilich

cookies are set via document.cookie, more on google

Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
what about a cookie?
Mar 9 '10 #2

P: 14
ok..do u mean to set a cookie for the timer? can we do it from javascript? if so can you send a sample code or link where i can refer? so many questions:-)
Mar 10 '10 #3

Dormilich
Expert Mod 5K+
P: 8,639
cookies are set via document.cookie, more on google
Mar 10 '10 #4

P: 14
Hey that's useful clue...A good food for me to think...The problem is solved..
Mar 11 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.