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()?
View Complete Forum Thread with Replies
Related Forum Messages:
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.
View Replies !
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?
View Replies !
Session Timeout
I use session ID which is stored in a MySQL database and when the user click on the Logout button, the following is done $db = new DB(); $result = new DB_query($db, "delete from $db_session where session_id = '$sessionID'"); // Unset all of the session variables. session_unset(); // Finally, destroy the session. session_destroy(); The webserver is Apache 1.3.31 (Unix) on Linux (Kernel version 2.4.21-20.ELsmp) and PHP is version 4.3.9. I am wondering is there a way of setting a "session timeout limit", so user would be forced to logon if they leave their web-browser inactive for, say, 15minutes? Or would I have to resort to adding a datecolumn to the session table in MySQL and compare the time everytime a page is loaded?
View Replies !
Session Timeout &
I set a session time out for a specific application. I don't want it to affect the session timeout of say the shoppers on my website, but I have an employee only app that I want to timeout after an hour of being idle, in case someone gets access to their computer. I have a SELECT statement that gives me results as links, and when you click the link it takes you to the detail for that account. How do I make a back button to go back to the results page w/o using the browser back button and re-running the query.
View Replies !
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.
View Replies !
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?
View Replies !
How Long Does It Take For A Session To 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,
View Replies !
Session Timeout Won't Work
I am trying to get my session to automatically end after 30 minutes of inactivity. In my php.ini file I have: session.gc_maxlifetime = 1800 However, even after the 30 minutes is up, the session is still open and active. I've tried testing this with different values (down to 10 seconds), and each time I do a phpInfo() to make sure the change is reflected (it is), but it doesn't ever work. Here's what my phpInfo(): Session section looks like: Code:
View Replies !
Selective Session Timeout
My understanding with session timeouts is that, after a specified period of no activity, the session will end and session data lost. is this correct? I'm currently seeing behaviour that looks like data put into the session 2 pages ago is gone, but data put into the session 1 page ago remains. Just wanted to check my understanding. It's all or nothing, right?
View Replies !
SESSION Timeout Issue
I tried a few code I found on the web but they only appear to work on a Windows environment. I am trying to get this to work within an Apache Server on a Linux box. In my code I detect if a session still exist and if not, they get redirected back to the login page. I want the session to timeout after 20 mins of inactivity. I come from an ASP/ASP.NET and ColdFusion background. It is set easily in those languages. Code examples that worked on Apache Web Servers in a LINUX environment would be awesome.
View Replies !
Session Timeout Parse Error
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 ?
View Replies !
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?
View Replies !
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.
View Replies !
Setting Session Timeout Through .htaccess
I need people to be able to complete long text blocks in my cms before their session times out. From the php documentation I gather that ini directive session.gc_maxlifetime would be the one to adjust here. I am on shared hosting, so I can't change the php_ini settings directly. If I use ini_set, should I do that on every page in my cms, or would it suffice to do it on the login page? Or could I do it in a .htaccess file (which my host permits)?
View Replies !
Session Timeout Takes 2 Clicks
I have read the other articles here related to session timeouts, but this seems weird to me: My session timeouts dont redirect to the login page until the user clicks the second time. Basically it seems like: after the session expires the first page the user goes to does not realize the session has actually expired. I have set my php ini file session.gc_probability to 100% (for testing) and everything else should be default settings.
View Replies !
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.
View Replies !
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...
View Replies !
PHP Sleep()
I've been sitting for quite a while now, reading the sleep() manual and tried to turn the code upside down and inside out but nothing helps... I want the current page to wait a few seconds before it is directed to another ( after a successfull registration ). So i thought the best way to do that is to use sleep(). However, this does work to a certain point ... the current page waits for 5 seconds, but the text I want to show the user in the meantime doesn't show? Why? Without the sleep() and the header() it shows without any problem. Code:
View Replies !
Sleep()
I tried to make a script which would print a line of text at 1 line per second or whatever time i put. So i went ahead and tried this. PHP Code: echo "Passwords match."; sleep(1); echo "Passwords match."; sleep(1); echo "Passwords match."; sleep(1); echo "Passwords match."; This is a example and the text in echo has no meaning. However the sleep waits and waits for all the other sleeps to finish and then prints out all text at once.
View Replies !
PHP Messaging And Sleep
I would like to get my php script to send a message to a user for example to notify that a DB update or insert has been successful or not. After that the script will be redirected to the home page. how can this be done ? I have tried using sleep(5) to delay the script but that does not work the way that I want it to since it simply delays the execution of the ENTIRE script RATHER than a part of it !!
View Replies !
Sleep() In The Background
how much the sleep() which is set to no limit can consume the system resource. Could it cause to hang the server? I tried the following and couldnot see the server got busy. Although the browser seemed to be so, if I access to a different page, it responded very quick as usual. It's not a big deal, is it? sleep.php PHP Code: <?php set_time_limit(0); sleep(0); ?> fork_sleep.php PHP Code: <?php $str = "php -f sleep.php"; exec("$str > /dev/null &"); ?>
View Replies !
Fsocketopen & Sleep
I'm trying to setup a fsocketopen script to ping a site every 15 minutes or so and if the site is down, send an email. I'm thinking of using ignore_user_abort() to run the script in the background and sleep() for the time intervals. I'm not really sure how to script this out.
View Replies !
Sleep And Max_Execution_Time
I have the following code: $i=0; while($i++<15) { mail("rantsh@hotmail.com",date("d m Y H:i:s"),"This is email # $i "); echo "mandado $i <br>"; sleep(60); } Now, I know my server has a 30 second max_execution_time setting... nonetheless, this code runs successfully!!!. Now, this is actually better for me (for the application I need to run)... Yet I'm concerned of why it's being allowed to run for 15 minutes if max_execution_time is set to 30. Code:
View Replies !
Would I Use Sleep To Delay
I am making a site for a friend, but with his PHP it always renders too quick and I would like it to wait a bit for the rest of the page to load, otherwise its a bunch of annoying gaps and whacked alignment as the CSS and images load and it all just looks annoying as it loads. And it takes away from the order of of information outputted as it goes through the PHP when your focused on the tripped out layout.
View Replies !
Sleep Function
I'm playing about with delaying results of a PHP program. I want to print some results then wait for a few seconds and print some more. I have found the php sleep function however have a small problem. <?php echo ("The time in 3 seconds from page loading: "); sleep(3); echo date('h:i:s') . " "; ?> The above script is meant to print the top line, wait 3 seconds and print the bottom line. Infact, it starts, waits 3 seconds and prints all at once. Now from my understand from php.net it should not sleep untill it hits the sleep command in there.
View Replies !
Sleep For 10 Seconds Help
I am trying to run it will load an iframe for every entry found in my DB, I am trying to make it sleep for 10 seconds between each iframe with: PHP Code: sleep(10); PHP Code: $train = "<table width=800 bgcolor=F0F0F0 aling=center><tr><td colspan=4> $pages<br></td></tr>"; $i=0; while ($addall = mysql_fetch_assoc($res)) { Â Â Â Â if ($i/2 == ceil($i/2)) $train .= "<tr>"; Â Â Â Â $i++; $train .= "<td width=120 valign=top><BR><iframe src="potspace.php?u=$addall[intId]" width="400"></iframe>"; } $train .= "<tr><td colspan=4><br><br> $pages<br><br></td></tr></table>";
View Replies !
Sleep() Affects The Variables?
could it be that the sleep() function affects my variables? When I set a very long delay time (1-3 hours) in my CronJob PHP4 script (of couse with a big set_time_limit) some of my variables go lost! But there's no problem with short times in the sleep-function (1-5 min). set_time_limit(86400); for($x=1;$x<5;$x++) { echo $x; //$x will be shown only one time sleep(7200);}
View Replies !
Need To Flush Before Sleep But I'm Blank.
I'm new to php and am converting a bunch of asp pages to php. Current problem : I am using a Submit button on a form to POST ( send the database variables ) to a php page that will send a personalised e-mail to each client. On the php page, I am looping through a database, compiling a message ( html format ), and mailing the message to my client. After the mail has been sent, I need to wait for 4 seconds before continuing with the next database record. I am using this code after the mail has been sent : echo "Mail Sent to : " . $row['CliName']; ob_flush(); flush(); sleep(4); Problem is, that nothing appears after I click on the Submit button on the first page's form ( the first page just remains on the screen ). Once the database has been looped, the entire (correct) output appears on my screen - but I need to see some sort of progress as it works it's way through the database.
View Replies !
Sleep(900) ? Delayed Query... ?
Trying to set a marker in a MySQL table on our Primary host (WAMP stack) indicating whether or not there is current User Activity -- ON THAT SERVER -- as a signal to remote Secondary -- tablet pc based servers to skip scheduled database synchronization with the Primary. Code:
View Replies !
Sleep() And Browser Load.
is there a way to get around the browser continually acting like they are loading when using sleep()? It says the page is still loading but it really isn't because we are causing a delay for some data on purpose with php. So it is for an intentional reason that we cause it. Many of us like using sleep(). Anyway to do it without the browsers showing the page is still loading? There must be a way, so many programmers for intense programming use sleep(), I can't imagine they have to deal with the browsers loading prompts whenever they do.
View Replies !
Staggering Execution With Sleep()
For my site, currently in development, I will be hosting some latest RSS picks from friend websites. To start with there will only be a couple, but eventually I hope to be sourcing from up to 50 partner blogs. Obviously, i dont want to make a request on every page load, so I would instead cache data from the past half hour/hour. I will be using CRON to schedule an update every so often, but having a single script making 50 requests one after the other then processing and storing the data may be taxing, especially if the outside server is slow. I thought about using sleep() to leave gaps between each request so that a sudden hogging of resources doesnt happen every hour. What are your views on this method? Is it feasable (and possibly even a good idea), or should I just get it all to execute in one go?
View Replies !
Resources Used When Using The Sleep() Function
I want to use the Sleep() function in a script that may run multiple times, but i dont want hte system to crash or be overloaded with scripts in memory. When the script enters a sleep mode, what happens to the script? is it resident in memory? if so could i experience the system bogging down if there were 100+ scripts resident in memory or are they just sitting there doing nothing until they run again?
View Replies !
SLEEP + Header Problem
I'm running a community website where I send out weekly newsletters to all of my clients. However, I'm sure my hosting provider wouldn't be so happy if I just FOR LOOP and send it all out at once. SO what I did was I just a SLEEP and a header mthod that triggers after every second, where the header sends out GET variables for the next iteration to fetch at which account I am currently at to send the next newsletter. Code:
View Replies !
Insert Sleep Every X Rows
i am trying to insert a sleep command in my loop every 100 rows, the below works for every 2 but if i try to sleep every 100 rows it will not work. if($i % 2) { sleep(5); } does not work [php] if($i % 100) { sleep(5); } [/php
View Replies !
Long Sleep() And Time-out's
The script I'm writing needs to wait a random amount of time (1-300s) between each iteration of a loop, eg. while(condition) { do something //wait between 1s and 5 minutes sleep(rand(1,300)); } Problem is, a browser times out if it doesn't get an answer within about 30 seconds. Is the idea of having a PHP script sleep for a longer amount of time incompatible with web applications? Any work-around?
View Replies !
Putty Processlist Command Sleep
I'm using php with mysql. I am connecting through putty and I run the command for processlist. Lately I am seeing many threads with the command "sleep" in them. My site and the database are running smoothly, but I am seeing up to 200-300 threads like this with the command "sleep". Can anyone tell me what may be causing this and how do I resolve it? Or is it normal to see this when your site grows to a certain size? Code: ......
View Replies !
Require_once And Fatal Errors... Automatic Sleep And Try Again Anyone?
I have a PHP page which loads OK 80% of the time. However the rest of the time I get the following error: Fatal error: Failed opening required 'DB.php' This really bugs me, especially since the only reason this is happeneing seems to be due to server load. I would like to add code so that instead of displaying the given error, the PHP code makes the HTTP response thread simply sleep a little bit (say 4 seconds), and then retry, and repeat until the file can be opened. It seems strange to me that server load would prevent the file from being opened. Anyhow, any ideas on how I can improve the situation?
View Replies !
SHOW PROCESSLIST "sleep"
when i view SHOW PROCESSLIST i always see command sleeps with some large times behind them.. can somone please tell me what that is and what that might be caused by? "Command" Sleep "time" 1585
View Replies !
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)....
View Replies !
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.
View Replies !
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:
View Replies !
|