Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Executing Code On Session Timeout


is it possible to execute some code on the session timeout event?
i.e. clear all db information and other stuff when the php session is
destroyed through the gc_maxlifetime timeout.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Command-line Php Displays Code Instead Of Executing Code
I am using CLI PHP to run a PHP script, c:wampphpphp.exe, but
instead of executing my script, it's actually displaying the raw code
instead.

How can I run my code using CLI PHP? I installed WAMP5 on WinXP.

Auto Executing PHP Code
Right now i am on a matrimonial site. i wanna do an auto match finder. ie; there may be many registrations in the site. i wanna findout all those matched profiles on a daily basis, say by 12 midnight each day. i wanna get that list as a mail even if i didn't checked the admin screens. ie; the script should execute on 12 midnight each day automatically. is there any way. can i do it using PHP.

Executing Code Within A Hyperlink
I am writing a photo gallery and suppose 8 photos are displayed. When the
user clicks on a button under the picture, I want it to add that picture
name to a "favorites" list within the session data, but NOT leave the page
the user is on. How could I do this?

Executing PHP Code At A Given Time
I was wondering how it would be possible to execute some PHP code every minute for example.. or every hour or on a given date.

Executing Php Code With JAVASCRIPT
i have this sample code:

<?php
<a href="linkurl" target="_self" onmouseover="<?php
echo '<a href="linkurl" target="_self">The link title</a>';
echo '<br>';
echo "Original text:";
echo '<br>';
echo "bla bla bla text in its original language";
?>">The link title</a>
?>

as you can see I am attempting to execute php code with javascript "onmouseover"
well the problem is the php code is always being executed, i need to make some kind of check statement to ensure that it will only be executed "onmouseover"

how would I do that? and is this possible to do this with php and javascript?

Returning Value While Still Executing Code
Anyone know of a way to return data to a browser and then continue processing code. For example in classic ASP they have:

<%
Response.write('THE BROWSER CAN SEE THIS');
// sending final response to the browser
Response.end;
// this will still execute even though the browser no longer is waiting for a response
my_function();
%>

I would like to immediately return a value to the browser and then run cleanup code without the browser having to wait. When I use the exit() or die() or return() functions in PHP it will end the code right at that point which is great because the browser gets a response back quickly but the remaining code never gets executed.

Executing Code Only If Certain Word Is Found
i have a php code that opens a text file and makes some changes to it. but i only want the code to execute if the following word is found somewhere in the file: "xq33XSDs"

Session Timeout
In ASP I can use the various Session event handlers inside an global.asa file to make an action when the session expires.

Is there a way I can do the same with PHP?? I mean, I set a session to expore after 30 mins, and I want to do some cleanup (database related) work after it has timed out?

Session Timeout
I am using following statements in my file for keeping my session live for 24 hours

session_start();
session.gc_maxlifetime = 86400;

but is giving parse error on line 2. what could be the problem and what is the solution for keeping the session live for 24 hours ?

Session Timeout
I am implementing a site which will be used in an intranet by a limited
number of users. The web server i am using is WIN2003 / IIS 6.0 / PHP 5. I
want to enable sessions that will not timeout even after a long time (3-4
hours).

Having read some of the documentation i concluded that i should set
session.gc_maxlifetime and session.cookie_lifetime in my php.ini
appropriately, i.e. session.gc_maxlifetime=14400 and
session.cookie_lifetime=0. Am i right at this?

Furthermore, i am wondering if i should set IIS appropriately, does it
intervene with session data(sent session cookies)? I think that Apache does
not but i am not sure about IIS.

PHP Session Timeout
Is it possible to set x seconds interval for the "Garbage Collection"? So the PHP deletes inactive session files after x seconds rather than waiiting for session triggering to start the garbage colletction.

PHP Session Timeout
I've modify the php.ini the session.gc_maxlifetime to reduce
the time of timeout of the session variabiles.
But it not seems to go. In fact the session variabile remain
also when after the timeout that i've set.

Session Timeout
How long does it take for a session to timeout,if I have a user logged in on my site, how much time of inactivity will it take before the session is automatically destroyed and they become logged out,i do not use cookies,I have these values in my php info

session.cache_expire   180
session.gc_maxlifetime   1440
session.gc_probability   1

from what I understand the session is destroyed after 180 minutes of inactivity,but the session has a 1% chance of being garbage collected after 1440 seconds of inactivity (is this destroyed?)

so if I wanted all sessions destroyed after the 1440 seconds, should i set the probability to 100

or should i change the
session.cache_expire   180

to something that would suit me better, i.e. the 1440 seconds,

i.e.
session.cache_expire   24,

would this always delete the session after 24 minutes,or do both values have to correspond etc,

Session Timeout...
I want sessions to time out and get destroyed if the user has been idle for more than x time...

I already have it so a timestamp is created and sent to the database per user every time they visit a page... so I have this timestamp available...

I know you use session_destroy() to destroy a user's session if they visit the link but is there anyway to have a script that say mass destroys sessions based on how old the timestamp is?

Using Session Timeout Without Cookies
I am working on a PHP project where the client is telling me to make a session timeout after 1 hour. I am not using cookies in my site. But as per the php.ini file on the server the timeout had been set to 180 secs (by default), hence the page expires after 3 minutes. Now I need to make this work by setting the session timeout upto 1 hour.

Session Timeout, Use Of Sleep Ect...
I have a custom script that uses sessions to track UID's. The only problem I have with the script is that the session times out in 1440 (min?) which I believe is 24 min. I was thinking that I could use php's sleep to hold off from doing a refresh until minute 20.

Unfortunately, I have also read that using sleep can leave a server open to a DoS attack.
I do not have access to the php.ini file to be able to change the timeout variable for the session. What is the best way to keep a session open without changing the .ini variable. Is sleep a good way do go about it, and if so, are there significant security risks in using sleep()?

Session Timeout Question
Can I adjust the PHP session timeout on my web site? Users are
reporting timeout errors when they leave their computer for a period
of time and then come back to resume using the site - is there some
kind of global session timeout in PHP that I can set?

PHP Session Default Timeout
what is the default Session Timeout for php...is there a way to increase this on the web server I am hostign my php scripts on..

Stupid Simple Session Timeout......?
Is there a stupid simple way to end sessions automatically after a certain amount of inactivity-time?

How To Session Timeout For Specific WebPage ?
I would like to know how to set the session timeout time
locally and not globally in the php.ini file.
I do that as it is ine www.php.net but doesn't seem to do anything
/***************************/
/* set the cache limiter to 'private' */

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

/* set the cache expire to 1 minutes */
session_cache_expire(1);
$cache_expire = session_cache_expire();
/******************************/
I enter 1 minute for testing purposes....
- Also It would be helpfull to let me know how I am going to verify that
the session has been expired....
- Is there any way to automatically refresh the page when the session has
expired and let the user know ?
- Is there any good site that I can find tutorials or examples for this
purpose?

Session Timeout Suggestions Wanted
I have a form where users logged in using sessions can edit articles in
a WYSIWYG editor. Some of them take their time and don't like to save
their work very often and occassionally the sessions expire and their
work goes poof. (I've suggested editing off-line and simply copy+paste
but they prefer the editor.)

After a lot of searching I've found the main culprit is
session.gc_maxlifetime and I can set it longet like...

ini_set('session.gc_maxlifetime', 7200); // 2 hour inactive session
timeout

Are there other timeouts I should worry about with Apache/Linux?
(Caches, etc..?) My other php.ini settings are...

session.cache_expire180 -> 3 hours shouldn't be a problem
session.cookie_lifetime0 -> this is don't expire while browser open
right?

Now a few of my Google searches came up with a scenario for timeouts
where the timezone of server and client have to be considered. i.e. If
server is ahead of client by 1 hour, is the session timeout reduced by 1
hour for that client. Can this be true??

Also are there any other problems with a php session lasting 2 hours?
Small site, not a lot of users with these priviledges or accessing the
editor.

How To Implement Timeout Warnings For Session Expiration?
I am looking for some examples on how to inform the user that their session is about to expire. I would like after some period of user inactivity to display a message that their session will expire and that they will be logged out. I also would like to include in this message asking the user to click a button to stay logged in. I am looking for examples that implement this feature in PHP.

Curl Timeout Vs Socket Timeout
We have two versions of client code, one using curl, and other one using raw sockets via fsockopen(), and we use the following code to set the i/o timeouts:

1) curl:
.
.
curl_setopt( $handle, CURLOPT_TIMEOUT, 1 );
.
.
$resp = curl_exec($handle)

2) sockets:
stream_set_timeout( $sock, 1);
Here we use frwrite() and fread() to send the request and read the...

Session Code
I need to use sessions on a vew pages on my website and I'm just a begginer on PHP so i wanna know if anyone of you knows a good free session code wich can work on register globals off. or a tutorial wich also have a logout page?

Running PHP Code Within Another PHP Session
Is there a way you can run PHP code within another PHP session? I have a form that has some PHP code in it that I would like to protect with authentication. I have the following at the top of my code:

SMS Get Session And Send Code
I'm developing a SMS send script and basing on one provided by my SMS supplier. The problem I have is that I can't get the one provided by my SMS supplier to work. I think it looks all ok, but it keeps displaying "Authentication failure:"

My details are correct, and I can send SMS via a separate script I have made. (not using a session, but directly sending the AUTH info as part of the text message to be sent out)
If the code is ok, the only problem I can think of is if my companies proxy server somehow has a problem with sending / getting url requests if they are not part of the address bar? PHP Code:

Whats Wrong With This Session Code?
im learning about sessions but the book im reading has hit a snag. heres the code for 2 seperate pages.
page1.php

Efficient Session Re-register Code
What I have going is working, but I wonder if there's an easier way to do this. I tried using an associative array but had some problems.

Determining Session Settings In Code
I've been having problems under IE6 with a script that uses cookies, so thought I'd try switching to using sessions instead.
However, while the script works perfectly well on my own site, it doesn't always work on sites where I can't control the session settings in php.ini. I've searched through the manual, and searched previous threads here on the forum, all without success.
Is there any way, through code, that I can tell if php was compiled with the --enable-trans-sid switch, or if session.use_cookies is enabled, or all the myriad other sessions settings?

Is This Code Looking Good To Exchange PHP Session ID Between Flash And PHP
Can some Flash guru tell me if this Flash code is OK to set / retrieve a
cookie for exchange with PHP?

stop();
var ses:string;

//create the local Shared Object
myLocalSO = sharedobject.getLocal("hookie" );

if(_root.destroy) {
myLocalSO.data.name = "destroyed";
}
else {
//if cookie already exists then get ses from cookie
if (myLocalSO.data.name.length == 32) {
ses = myLocalSO.data.name;
getURL("index.php", "_self", "GET");
}
//if cookie does not exist then make it
else {
myLocalSO.data.name = _root.PHPSESSID;
}
ses = myLocalSO.data.name;
getURL("voter.php", "_self", "POST");
}

Code Insert To View Session Variables ?
I am having some challenges using session variables between pages with Dreamveaver MX. Is there a piece of code i can temporarily place into my pages that will print the values of all Session Variables, such that I can see they are definately being passed between the pages?

PHP Not Executing, IIS 6
I'm attempting to run PHP on Microsoft IIS 6.0, and the PHP will
not execute.

For Example:

test.php:

<?
phpinfo();
?>

When I request http://localhost/test.php I get a blank page.
When I view the source, I get:

<?
phpinfo();
?>

Any ideas what I am doing wrong? Any resources that could guide me
through the install process? The .php extensions are setup correctly
(I believe) in IIS.

PHP Executing Twice
I am facing very strange problem When I submit any form using 'POST' method. my script executes twice. Is this a PHP bug or some thing else. I am using PHP4.3.1, MySQL 4.0.1, Apache2.x.x in Windows 2000 professional.

Executing MDL Programs Using PHP
Help to execute MDL Applications by making a call "mdl load <application name>" through PHP.

Executing An SSI Within A Php File.
I have the following line in an old shtml file:

<img src="http://www.domain.com/cgi-bin/logtrack/log.pl?ref=<!--#echo var="HTTP_REFERER"-->" width=1 height=1 border=0>

What this does is execute log.pl with the refererer to increment a logtracking program and find out what their referer is. How would I go about porting this to php?

Executing Scripts...
How do I execute one .php3 script from another. Passing one or two arguments, and then receiving the output? I have tried using the exec and passthru function, with no luck.

Executing Chunk Of SQL
I'm attempting to write an install script, I'm using the ADODB abstraction layer with my script, with that said here is my problem. I've got a large chunk of SQL that I need to execute through PHP, so I put it in a variable like so:

$db_sql = "
DROP TABLE IF EXISTS im_categories;
CREATE TABLE im_categories (
id tinyint(11) NOT NULL auto_increment,
name varchar(100) NOT NULL,
type varchar(100) NOT NULL,
template varchar(200) NOT NULL default 'default',
PRIMARY KEY (id)
) TYPE=MyISAM;";

Then I try to execute it using:

$result = $db->Execute($db_sql) or die(vpError() . $db->ErrorMsg());

I get the following error every single time and I have no idea what is causing it, the SQL data is from a phpMyAdmin export by the way. PHP Code:

Ajax Not Executing Php
When a user clicks a link I have it open up a file in a div using ajax.

my code is

<a href="#Find" onclick="javascript:jah('Find.html','content');">Find</a><br
/>

Where Find.html is an html file on the server. Now when I do this everything
works fine except php code is not being executed.

The jah code is

function jah(url,target) {
// native XMLHttpRequest object
document.getElementById(target).innerHTML = 'sending...'
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {jahDone(target);};
req.open("GET", url, true);
req.send(null);
// IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = function() {jahDone(target);};
req.open("GET", url, true);
req.send();
}
}
}
function jahDone(target) {
// only if req is "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML="jah error:
" +
req.statusText;
}
}
}

Executing Applicaitons
is there any way to execute desktop applications under a web interface using php? I need to get a non-finite amount of users to be able to execute a learning course program and use it remotely using a web interface.

Executing A .bat File With PHP
I have a .bat file that copies certain files across a network and I needed a way to run this file using PHP.  I was looking at exec() but I was not sure exactly how to use it.  I was also using pstools but could not get them to work with PHP.  Can someone give me an example of how to do this or send me somewhere where I can read up on this?

Executing .sql File
how may I execute .sql file using php?

Executing A Variable?
If a variable stores a function, could I execute the function by typing the variable alone? Or maybe by echoing it?

<?php

/* Set variable */
$math = round(23.89);

/* Execute variable? */
$math;

/* Echo variable? */
echo $math;

?>

Executing A Program
I am trying to run a console application which needs to keep running even after the php script has finished executing. I also need the PID or some sort of handle I can use to kill the program at a later stage.

Timeout
Does anyone know how to delay time within loops?

(ie I want to wait 3 seconds for going to the next loop of the database query)....

PHP Timeout
I have a problem. I am trying to make a script that reads my log file and displays it in an HTML page. I got the base code from a book, being that I am still learning PHP and I needed a little help starting out. But the code I am using gives me an error.

The error is :

Fatal error: Maximum execution time of 30 seconds exceeded in /home/sites/home/web/php-site/log-file.php on line 15

It ranges from to line like so :

Fatal error: Maximum execution time of 30 seconds exceeded in /home/sites/home/web/php-site/log-file.php on line 27

I want to know if anyone knows the specific reason or maybe a place to start at to find out the problem and the solution.

CGI Timeout
I keep getting the following error when I try to execute a script.

"CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process."

In my php.ini file I have changed the "timeout" period to "0" which I think means there is no timeout limit. I am connecting to a table in a database that has many records due to which the script is timing out. Could this be an IIS problem?

I have PHP Version 4.0.4pl1 installed and am connecting to a Sybase ASE database. The connection is working fine but I only get this error when I start copying data from the Sybase ASE database to a ".csv" file.

PHP Timeout
I need help adding an if statement to the code below if it times out trying to query the server. I get this error if my game server is offline on my website...

Warning: unpack() [function.unpack]: Type L: not enough input, need 4, have 0 in showserver.php on line 104 Code:

Executing Cgi Scripts Within A PHP Document
Is there a way to execute a CGI script using an include like I do with the SSI includes. I want to just execute my weather cgi file like I do on my page at www.insidemath.com .... whoever can help please do so.

Executing A Shell Command
I try to use the backtick "`" to exacute a shell command from a PHP script. However, `touch file`; doesn't make the file. Neather does exec(), system(), etc. They all work when is used a different command, such as pwd, or ls. So what's a brotha gotta do to creat a file?


Copyright © 2005-08 www.BigResource.com, All rights reserved