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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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>&nbsp;&nbsp;&nbsp;$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>&nbsp;&nbsp;&nbsp;$pages<br><br></td></tr></table>";




View Complete Forum Thread with Replies

Related Forum Messages:
Php.ini Sets Max Time To 90 Seconds, Yet I Get A "Max Execution Time Of 30 Seconds Exceeded"
This is weird. When I use getId3 to try to read meta tags out of
multimedia files, I get this error:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/
httpd/vhosts/bluewallmultimedia.com/httpdocs/getid3/getid3/
getid3.lib.php on line 54

But if I run phpinfo(), I get this:

max_execution_time9595

and if I ssh to the server and look in php.ini, this is confirmed:

max_execution_time = 95 ; Maximum execution time of each script,
in seconds

This is on a RackSpace server, running RedHat. It's got Plesk
installed.

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 !
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 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 Function Or Any Thing Like?
i wanna make search page when you submit the search form it will direct you to search page but before the search starts i wanna make it waiting how can i make this.

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(), Exec() And MySQL
How to create dynamically generated table .....

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 !
Processlist Sleep Command
a couple times i have notice the command sleep, with times like 200 or even 1700, what might be the cause of this? anyone know?


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 !
Loop Every Ten Seconds
Is it possible to get something to repeat every x number of seconds, like cron but i need it as a function of the actual script.

View Replies !
Converting Seconds
i need a way to convert seconds into a thing like MySQL server has been up 1 day 34 min and 34 seconds. does anyone have any code or idea on how i would start this.

View Replies !
Time To Seconds
I am writting a script that uses a flash player to tell the user what time the song is at. Well not being good with flash i finaly found a player I llike. The only prpblem is it uses 100 seconds for actually 60 seconds. Listed is an example of code below
PHP Code:

View Replies !
Php Time() In Seconds..
I want to create a flood protection for my forum, but I need to know how to set a cookie with the time()+ , lets say 30 secondes.

View Replies !
Re Run An Include Every 5 Seconds?
Is there a way to refresh an include every 5 seconds?

View Replies !
Is The $exptime Really In Seconds?
I came across a script that has the following: PHP Code:

$utime=time();
$exptime=$utime-10; // (in seconds)

Is the $exptime really in seconds?

View Replies !
Mysql_data_seek Takes...0.15 Seconds
On my testing machine (P4 2ghz, WinXP, Apache, PHP 4, mysql 4.1), when I do
a mysql_data_seek it takes up to 0.15 seconds.

My query that returns all results takes an average of 0.05 seconds on my
machine. The mysql_data_seek on this query result takes 0.15.

How it is possible ? It's there any bug ? I know my ISP is much faster, and
I can't compare with my computer, but this let me thing that I should better
execute a query for the desired records instead of doing a data_seek.

They are about 170 records in the result, taken from 20 tables of an average
of 10 fields each, with around 3000 records in each table. I do show only 10
results on my page, and when I do click on next or previous page, I then
"seek" the 10 next records.

Also I've 2 possibilites to improve performances:

1: Execute 2 queries: one that count the result's ID and an the same wich
returns the result of 10 records

2: Execute the complete query and count from there. Also use seek to show
the correct results.

for now I use the second choice, but performances are very poor.

Since I can't pass the query result from a page to another, at any time I
change the page, I 've to execute the query again....

View Replies !
Page Loaded In X.x_ Seconds
how can i make something saying: this page was loaded in x.xxxx seconds?

View Replies !
Redirecting After N Seconds With Header()
I'm using header("Location: member_cp.php");

to send the browser back to a page - however, I would like to set a delay of, say, 2 seconds before redirecting. Is this possible with the header() function, or will I need to do this in a different way? If so, how?

View Replies !
Session Expire After 30 Seconds?
Can anyone tell me how can I do to a
session expire aftetr 30 seconds?
And where can I find a working demo?

View Replies !
Seconds To Minutes Conversion
I have a form where a user enters a value that will always be a number which represents minutes. I have the column that receives these values in the mysql table set to time format.

the problem that I'm having is when I send the value form the form to the mysql table the number is treated as seconds. how do I change it so that the value is treated as minutes and not seconds.

View Replies !
Convert Seconds To Milliseconds
I am trying to mimic the Javascript new Date().getTime(); function with php
and retrieve # of milliseconds since 1970
php's time() function however calculates # of seconds not milliseconds since 1970

I tried multipying by 1 million but then the timestamp turns into 12342434 E + 3243....

It makes it into E's...

So basically how can I mathematically make this string:
 PHP timestamp: 1188186747
equal to this string:
Javascript timestamp: 1188186747328

and without the annoying "E's"

View Replies !
Submit A Form Every X Seconds
i want to let a form submit ever 2 seconds to test a thing with my server.
how would i go about doing it?

View Replies !
Display Code After Some Many Seconds
I dont know if I should post this in JavaScript or PHP and other codes because I dont know what suits this. I want make a code, which after some many seconds it will disply the code. Example:

<html>
<? After 3 seconds disply ?>
Hello
else
null
<end>

You know, something like that .

View Replies !
Difference Of Two Dates In Seconds ?
How can i find the difference of two dates in seconds ?

View Replies !
Generate The Amount Of Seconds
I have a date formated, which has had seconds added

$newtime = date('Y/m/d H:i:s', strtotime("+$sec seconds"));

How do i generate the amount of seconds after the from the $newtime?

View Replies !
Howto: Please Wait, This May Take A Few Seconds...
what if i have a webpage that displays the text "please wait, this may take a few seconds..." and it now waits until some event on the server happens.

whatever this is, this can be quick, but it could also be slow, or it can even fail. but once this event has happened, i want the webpage to reload and display a different message, like "the process completed successfully". Code:

View Replies !
Pausing Script For X Seconds.
I have seen a way to pause a php script for X number of seconds then once that time has past it carry's on! I have been searching and searching but cannot find it.

View Replies !
Make A Cookie Last For Ten Seconds
I'm experimenting with cookies but have come accross a problem. I'm trying to make a cookie last for ten seconds, it won't let me. When I try for an hour though, it does work. PHP Code:

setcookie($id, "set", time()+3600);

My script only seems to work with numbers higher than 3600. Anyone know what is wrong?

View Replies !
Small Script Uses To Much CPU Seconds
My host made me move to a dedicated server and I discovered that the only thing using so much CPU was this script. does anyone know how I can optimize this to use less server resources, I want it to look the same but just use less resources, this code gets the job done but it uses so much CPU seconds.

View Replies !
Session_start() Takes 10-25 Seconds
I'm running a php/mysql database application that stores a database description structure in a session variable. The database schema is on the large side, so this structure can probably be as big as 500kb. Recently, I've begun having a problem where on some pages, the session_start() function call takes a really long time to return, as long as 25 seconds.  This happens in both a single-user and multi-user environment, but it is inconsistent - on some pages it happens every second or third reload, on some pages it doesn't happen at all.

I'm not sure that its related to the size of my structure in a session variable, because the structure has been this big for a long time, but the session_start() problem is relatively new. Does anyone have any suggestions for why this could be taking so long?  Is it a bad idea to store a 500kb structure in a session variable?

View Replies !
Finding The Seconds Since Last Thursday At 5PM
I have been trying to come up with the logic to calculate the # of seconds since the last occuring thursday at 5PM.  I have not worked with PHP or really any programming in a while, and I am not fully familiar with all of the different date functions. 

I did some research and I came up with some really really messy and probably incorrect logic to try to come up with this. Code:

View Replies !
Code Doesn't Finish In 3 Seconds
I'm trying to execute a portion of code within a specific number of seconds. If it fails, I need to break out and do something else. To give you an idea of what I mean, take a look at the pseudo code below:

--------
try to complete the code below for 3 seconds { do something that could take a long time. if it doesn't complete within 3 seconds, generate an error which will abort the processing of further instructions in this try } catch (Exception $e) { Execute some different commands since the code above didn't finish quickly enough.}
---------

View Replies !
File Download Within 5 Seconds
I need to create a download.php file which will provide any file download within 5 seconds. In addition, I would like to log their Ip address and stuff.

View Replies !
Making Seconds Change
ive added a time () function to my web site but the seconds dont seem to change, ive seen other site doin it. How do you make the seconds change without refreshing the page.

View Replies !
Page Generated In XXX Seconds
I was reading a post here and toplay referred someone to the http://theomega.org/ for captcha info. I went to checkit out and noticed that on the bottom of the page it said:

Page Generated In: 0.1911 seconds.

View Replies !
Convert Filemtime To Seconds
Now that I made my ElapsedSecondstoString function, it seems that the value I'm getting back from filemtime is not seconds based (is this right?) According to the docs, it is a Unix timestamp (I'm not familiar with this).

Is there a way to convert the value that is returned from Filemtime so that it is in seconds so I can do:

> $iFiletime - time()

...to get back the number of elapsed seconds?

View Replies !
Cookie Expiration ... Something Other Then Seconds?
I'm making my first cookie but I don't want it to expire for say 30 days. Now by default I think it does the expiration time by seconds.... 2592000 would be 30 days?

60secx60minx24x30=2592000 .... Anyway thats my understanding at least.

View Replies !

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