Discussion:
session expire timeout
hadi
2014-06-29 22:22:20 UTC
Permalink
Hi dear list,

I have session timeout set to 1 with while loop, it well keep looping until
session expire, then it well run my script "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Also I have javascript to keep pulling the script to keep it alive every
interval time. If I close javascript page no more pulling the script then it
well timeout and run my script " file_put_contents('/tmp/phptest1234.txt',
'test');"


When I open javascript page it well call my php script and execute it along
with " file_put_contents('/tmp/phptest1234.txt', 'test');".

What I want here when I open javascript page it should keep pulling my php
script. And if I close the page timeout well happen to my php script and
execute my script " file_put_contents('/tmp/phptest1234.txt', 'test');"

But this doesn't seems to work. How to accomplish this senior. Can somebody
give help here please.

Php code

<?php
session_start();
?>

<?php

$_SESSION['timeout'] = time();

$st = $_SESSION['timeout'] + 1;

while(time() < $st)

{

echo "$st\n";


}

file_put_contents('/tmp/phptest1234.txt', 'test');





?>

Javascript code

<script type="text/javascript" src="jquery-1.11.1.js"></script>



<script type="text/javascript" >

$(function(){
// set interval for 5 minutes
setInterval(function(){
$.ajax({url: "test7.php"

});
}, 10000);
});

</script>
Christoph Becker
2014-06-29 22:41:17 UTC
Permalink
Post by hadi
I have session timeout set to 1 with while loop, it well keep looping until
session expire, then it well run my script "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Also I have javascript to keep pulling the script to keep it alive every
interval time. If I close javascript page no more pulling the script then it
well timeout and run my script " file_put_contents('/tmp/phptest1234.txt',
'test');"
When I open javascript page it well call my php script and execute it along
with " file_put_contents('/tmp/phptest1234.txt', 'test');".
What I want here when I open javascript page it should keep pulling my php
script. And if I close the page timeout well happen to my php script and
execute my script " file_put_contents('/tmp/phptest1234.txt', 'test');"
But this doesn't seems to work. How to accomplish this senior. Can somebody
give help here please.
I hardly can make any sense of your description, but the following
comments might help you a bit.
Post by hadi
Php code
<?php
session_start();
?>
<?php
$_SESSION['timeout'] = time();
$st = $_SESSION['timeout'] + 1;
while(time() < $st)
{
echo "$st\n";
}
Instead of the while loop, you can use sleep
(<http://www.php.net/manual/en/function.sleep.php>).
Post by hadi
file_put_contents('/tmp/phptest1234.txt', 'test');
?>
Javascript code
<script type="text/javascript" src="jquery-1.11.1.js"></script>
<script type="text/javascript" >
$(function(){
// set interval for 5 minutes
setInterval(function(){
$.ajax({url: "test7.php"
});
}, 10000);
10000 doesn't mean 5 minutes, but 10,000 milliseconds (i.e. 10 seconds).
This interval, however, is only an approximation by the nature of
JavaScript's event loop.
Post by hadi
});
</script>
--
Christoph M. Becker
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-29 22:55:18 UTC
Permalink
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script "test7.php"
and keep it alive every interval second. When I close javascript page. My
script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".

Hope im clear here. Did you get what I mean ?
Post by Christoph Becker
Post by hadi
I have session timeout set to 1 with while loop, it well keep looping
until session expire, then it well run my script "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Also I have javascript to keep pulling the script to keep it alive
every interval time. If I close javascript page no more pulling the
script then it well timeout and run my script "
file_put_contents('/tmp/phptest1234.txt',
'test');"
When I open javascript page it well call my php script and execute it
along with " file_put_contents('/tmp/phptest1234.txt', 'test');".
What I want here when I open javascript page it should keep pulling my
php script. And if I close the page timeout well happen to my php
script and execute my script " file_put_contents('/tmp/phptest1234.txt',
'test');"
Post by hadi
But this doesn't seems to work. How to accomplish this senior. Can
somebody give help here please.
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Post by hadi
Php code
<?php
session_start();
?>
<?php
$_SESSION['timeout'] = time();
$st = $_SESSION['timeout'] + 1;
while(time() < $st)
{
echo "$st\n";
}
Instead of the while loop, you can use sleep
(<http://www.php.net/manual/en/function.sleep.php>).
Post by hadi
file_put_contents('/tmp/phptest1234.txt', 'test');
?>
Javascript code
<script type="text/javascript" src="jquery-1.11.1.js"></script>
<script type="text/javascript" >
$(function(){
// set interval for 5 minutes
setInterval(function(){
$.ajax({url: "test7.php"
});
}, 10000);
10000 doesn't mean 5 minutes, but 10,000 milliseconds (i.e. 10 seconds).
This interval, however, is only an approximation by the nature of
JavaScript's
Post by Christoph Becker
event loop.
Post by hadi
});
</script>
--
Christoph M. Becker
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Christoph Michael Becker
2014-06-29 23:09:56 UTC
Permalink
Post by Christoph Becker
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script "test7.php"
and keep it alive every interval second. When I close javascript page. My
script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Hope im clear here. Did you get what I mean ?
I think so. :)

However, this is not how HTTP works. I suggest you get a basic overview
by reading <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs 7230-7235
obsoleting this RFC), as necessary.
--
Christoph M. Becker
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-29 23:23:51 UTC
Permalink
Post by Christoph Michael Becker
I think so. :)
However, this is not how HTTP works. I suggest you get a basic overview
by
Post by Christoph Michael Becker
reading <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs 7230-7235
obsoleting this RFC), as necessary.
Its ok with me. can you help me fixing my script please ?
Post by Christoph Michael Becker
Post by Christoph Becker
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script "test7.php"
and keep it alive every interval second. When I close javascript page.
My script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Hope im clear here. Did you get what I mean ?
I think so. :)
However, this is not how HTTP works. I suggest you get a basic overview
by
Post by Christoph Michael Becker
reading <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs 7230-7235
obsoleting this RFC), as necessary.
--
Christoph M. Becker
Maciek Sokolewicz
2014-06-30 09:19:31 UTC
Permalink
Post by Christoph Michael Becker
Post by Christoph Becker
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script "test7.php"
and keep it alive every interval second. When I close javascript page. My
script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Hope im clear here. Did you get what I mean ?
I think so. :)
However, this is not how HTTP works. I suggest you get a basic overview
by reading <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs 7230-7235
obsoleting this RFC), as necessary.
Don't bother trying to tell him he should learn some basics first. In
the last 5 threads he started, he has had a ton of help with a lot of
people trying to teach him the basics of PHP and HTTP. But he doesn't
care. He just wants free scripts doing exactly what he thinks they
should be doing, and absolutely does not want (or accept) any advice or
help that would lead to him having to even bother doing anything himself.

My advice: don't bother with this hadi fellow; most people who usually
attempt their best to help everyone here, have given up by now.

- Tul

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-30 21:51:25 UTC
Permalink
Don't bother trying to tell him he should learn some basics first. In the
last 5
threads he started, he has had a ton of help with a lot of people trying
to
teach him the basics of PHP and HTTP. But he doesn't care. He just wants
free scripts doing exactly what he thinks they should be doing, and
absolutely does not want (or accept) any advice or help that would lead to
him having to even bother doing anything himself.
My advice: don't bother with this hadi fellow; most people who usually
attempt their best to help everyone here, have given up by now.
Im new to php and doing my level best to learn php. I stay a hours and hours
to learn the codes. So little help here im appreciated.
Post by Christoph Michael Becker
Post by Christoph Becker
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script "test7.php"
and keep it alive every interval second. When I close javascript
page. My script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Hope im clear here. Did you get what I mean ?
I think so. :)
However, this is not how HTTP works. I suggest you get a basic
overview by reading
<http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs 7230-7235
obsoleting this RFC), as necessary.
Don't bother trying to tell him he should learn some basics first. In the
last 5
threads he started, he has had a ton of help with a lot of people trying
to
teach him the basics of PHP and HTTP. But he doesn't care. He just wants
free scripts doing exactly what he thinks they should be doing, and
absolutely does not want (or accept) any advice or help that would lead to
him having to even bother doing anything himself.
My advice: don't bother with this hadi fellow; most people who usually
attempt their best to help everyone here, have given up by now.
- Tul
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
--
http://www.php.net/unsub.php
Aziz Saleh
2014-06-30 22:03:38 UTC
Permalink
Post by Maciek Sokolewicz
Don't bother trying to tell him he should learn some basics first. In the
last 5
threads he started, he has had a ton of help with a lot of people trying
to
teach him the basics of PHP and HTTP. But he doesn't care. He just wants
free scripts doing exactly what he thinks they should be doing, and
absolutely does not want (or accept) any advice or help that would lead
to
him having to even bother doing anything himself.
My advice: don't bother with this hadi fellow; most people who usually
attempt their best to help everyone here, have given up by now.
Im new to php and doing my level best to learn php. I stay a hours and hours
to learn the codes. So little help here im appreciated.
Post by Christoph Michael Becker
Post by Christoph Becker
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script
"test7.php"
Post by Christoph Michael Becker
Post by Christoph Becker
and keep it alive every interval second. When I close javascript
page. My script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Hope im clear here. Did you get what I mean ?
I think so. :)
However, this is not how HTTP works. I suggest you get a basic
overview by reading
<http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs 7230-7235
obsoleting this RFC), as necessary.
Don't bother trying to tell him he should learn some basics first. In the
last 5
threads he started, he has had a ton of help with a lot of people trying
to
teach him the basics of PHP and HTTP. But he doesn't care. He just wants
free scripts doing exactly what he thinks they should be doing, and
absolutely does not want (or accept) any advice or help that would lead
to
him having to even bother doing anything himself.
My advice: don't bother with this hadi fellow; most people who usually
attempt their best to help everyone here, have given up by now.
- Tul
---
This email is free from viruses and malware because avast! Antivirus
protection is active.
http://www.avast.com
--
http://www.php.net/unsub.php
The issue I think is not that you are not trying enough, but the language
barrier. If you tell us what is your first language, some of us might be
able to recommend some PHP resources that you can get better help.
Personally, I barely understood any of your questions that you have posted,
which makes it harder for me to know what you are trying to convey. If my
hunch is correct and your first language is Arabic, try posting the issues
you have in Arabic on the following forums:

http://forum.montadaphp.net
http://ar.html.net/forums/viewforum.php?f=66
http://www.linuxac.org/forum/forums/91/
http://arabteam2000-forum.com/index.php/forum/38-%D9%85%D9%86%D8%AA%D8%AF%D9%89-%D8%AA%D8%B7%D9%88%D9%8A%D8%B1-%D8%A7%D9%84%D9%85%D9%88%D8%A7%D9%82%D8%B9-%D8%A8%D9%80-php/
hadi
2014-06-30 23:06:50 UTC
Permalink
Post by Aziz Saleh
The issue I think is not that you are not trying enough, but the language
barrier. If you tell us what is your first language, some of us might be
able to
recommend some PHP resources that you can get better help.
Personally, I barely understood any of your questions that you have posted,
which makes it harder for me to know what you are trying to convey. If my
hunch is correct and your first language is Arabic, try posting the issues
you
Yes you right my first language is Arabic.
Im not interested in Arabic forum. Next time I'll do my best to be clear in my
questions.
Post by Aziz Saleh
Post by Maciek Sokolewicz
Don't bother trying to tell him he should learn some basics first. In the
last 5
threads he started, he has had a ton of help with a lot of people trying
to
teach him the basics of PHP and HTTP. But he doesn't care. He just
wants free scripts doing exactly what he thinks they should be
doing, and absolutely does not want (or accept) any advice or help
that would lead
to
him having to even bother doing anything himself.
My advice: don't bother with this hadi fellow; most people who
usually attempt their best to help everyone here, have given up by now.
Im new to php and doing my level best to learn php. I stay a hours and
hours to learn the codes. So little help here im appreciated.
Post by Christoph Michael Becker
Post by Christoph Becker
Post by Christoph Becker
I hardly can make any sense of your description, but the following
comments
Post by Christoph Becker
might help you a bit.
Look when I open javascript page I will keep pulling my script
"test7.php"
Post by Christoph Michael Becker
Post by Christoph Becker
and keep it alive every interval second. When I close javascript
page. My script "test7.php" should timeout and execute "
file_put_contents('/tmp/phptest1234.txt', 'test');".
Hope im clear here. Did you get what I mean ?
I think so. :)
However, this is not how HTTP works. I suggest you get a basic
overview by reading
<http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>,
and to deepen that by reading RFC 2616 (or better the RFCs
7230-7235 obsoleting this RFC), as necessary.
Don't bother trying to tell him he should learn some basics first. In the
last 5
threads he started, he has had a ton of help with a lot of people trying
to
teach him the basics of PHP and HTTP. But he doesn't care. He just
wants free scripts doing exactly what he thinks they should be
doing, and absolutely does not want (or accept) any advice or help
that would lead
to
him having to even bother doing anything himself.
My advice: don't bother with this hadi fellow; most people who
usually attempt their best to help everyone here, have given up by now.
- Tul
---
This email is free from viruses and malware because avast! Antivirus
protection is active.
http://www.avast.com
--
http://www.php.net/unsub.php
The issue I think is not that you are not trying enough, but the language
barrier. If you tell us what is your first language, some of us might be
able to
recommend some PHP resources that you can get better help.
Personally, I barely understood any of your questions that you have posted,
which makes it harder for me to know what you are trying to convey. If my
hunch is correct and your first language is Arabic, try posting the issues
you
http://forum.montadaphp.net
http://ar.html.net/forums/viewforum.php?f=66
http://www.linuxac.org/forum/forums/91/
http://arabteam2000-forum.com/index.php/forum/38-
%D9%85%D9%86%D8%AA%D8%AF%D9%89-
%D8%AA%D8%B7%D9%88%D9%8A%D8%B1-
%D8%A7%D9%84%D9%85%D9%88%D8%A7%D9%82%D8%B9-
%D8%A8%D9%80-php/
Loading...