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 Complete Forum Thread with Replies
Related Forum Messages:
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 !
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(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 !
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 !
Header() Function - Warning: Cannot Modify Header Information
I have attempted using the code provided, but I consistantly get an error concerning the header() function found on the bottom on the script. What am I not understanding about header information? I always get this error: Warning: Cannot modify header information - headers already sent by (output started at C:apacheApache2htdocsPHPupdateupdate.php:9) in C:apacheApache2htdocsPHPupdateupdate.php on line 71 Is the tutorial not correct? Because I've seen similar tutorials that put the header() function in similar places too. Here is the code:....
View Replies !
Header Problem - Parse Error For The Header Line
Below is the extract of the problem part of the else loop. It gives me a parse error for the header line, the url is send from the previous page and is available as $_POST['url'] in general throughout the processing script. else { header( refresh: 2; url=$_POST['url'] ); echo 'Message has been sent.' }
View Replies !
Header Location - Cannot Modify Header Information Headers Already Sent By
I am trying to do a header location. but it is messing up. it is giving me the following error Cannot modify header information headers already sent by (output started at /home/content/i/n/n/****/html/***/connect2.php:19) I am using the following code if($_SERVER['HTTP_REFERER'] =="http://profileawareness.com/forums"){ }else{ header("location: http://profileawareness.com/denied.html"); }
View Replies !
Problem Setting A Received Header Using Header ()
I am reposting this as it wasn't very clear last time - and i still haven't made any progress with the code... i am sending a header(1) to page.html from sender.php using a socket connection. I would then like to read that page's response, and set that response as a header for sender.php (header2- parsed from the response of page.html in order to set any cookies etc.... that page.html might want to set) Whilst i have no trouble sending header(1) and retrieving the response, I don't seem to be able to set header(2) as a new header for sender.php or for any other page- I get a message from IE saying "the requested header has not been found on this site". Right now I am using the header () to set that header, as in the following code:
View Replies !
Header Error - Cannot Modify Header Information
I have read the sections refering to the following error message "Cannot modify header information - headers already sent by " and have tried to follow their suggestions. The first part of the program returns the required data and populates the form, but after changes are made to the data and an attempt to process the form is made the error message is produced I believe from the start of the php code. Code:
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 !
Header Error - Not Sure Where To Put The Header Line
I am getting the following error: Warning: Cannot modify header information - headers already sent by (output started at /home/forsa7/public_html/functions.php:155) in /home/forsa7/public_html/uploadform.php on line 228 I don't understand what is happening here, and am including part of the code, to see if you can tell me what I need to change. Code:
View Replies !
Header Error - Add A Header Command
I have some code that works fine until I add a header command. The code is: if ($_SERVER['QUERY_STRING'] == NULL) { print "No Query String"; } if ($_SERVER['QUERY_STRING'] == NULL) { header( "Location: http://mysite.com" ); exit; }
View Replies !
Use Of Header()
can anybody please briefly tell wht are all the use of header() function i just used it only for redirecting the page to some other page ie. header("Location: index.php"); and i noticed its coming in mail function also..
View Replies !
Header ()
If i wanted to make the following header load into a blank html page what would i need to do inorder for this to work? PHP Code:
View Replies !
Header
I have this problem <?php $doc = "name"; $result = "code"; header('Location: content2.php?docCode= $doc + resultCode=$result'); ?> I have two variabeles (doc and result) i want to pass to content2.php There i will get them $doc_n = $_GET('docCode'); $result_n=$_GET('resultCode'); What's wrong with my header?
View Replies !
Header()
header('Location: blah.php'); php doesnt seem to like this - am I doing something wrong and if not is there a fix . All the examples i've seen so far use http://www .
View Replies !
Php Header()
I use the following code to redirect the browser on an error, header("location:error.php"); exit; Is it possible to pass POST variables on as if a form was submitted, using header()?
View Replies !
Header...
i insert the header in the name.php file that a basic form use to go to a specific page if something happen, but it does not work... Here is the code i use: <?php if ($_POST[name]) { header ("Location: http://www.XXXXYYYY.com/home.html"); exit; } ?>
View Replies !
How Use Header() ?
I had a problem that my form reposted the data into the database if I reloaded the page with the script. I got help here and put the script for inserting to the database in a separate file, and using the header(Location:???) to get me back to the first page. It's a good soultion to the problem, but now when I tried it, it doesn't seem like I make it right, I get this error all the time, so if someone could help me with the correct way to code this I'd be grateful. The file with the form PHP Code:
View Replies !
Header() In IE 5
I have been having a problem with the header function in IE 5. Can I include a file (for the purpose of adding global variables) using include() or require() before using the header() function in IE 5? If I can't, does anyone know how to bypass this problem?
View Replies !
Header();
I asked a question about redirects a week ago or so but have run into a problem. I realise headers can only be written to http before anything else and as a consequence must be the first thing outputted by the php. But if I submit a form to a processing page which basically enters the data into a mysql db what would be the solution to then forward that script nack to the index.html page after db work is done? My code writes something to the http if an error occurs else it simply INSERTS the data, builds a url and emails this to a user and should forward the user to index.html but I get the usual header error regarding the fact that header info has already been written. But if I forward before db work I am not going to be able to do the db INSERT.
View Replies !
Header Already Sent?
Warning: Cannot modify header information - headers already sent by (output started at C:Program Filesxampphtdocsitraphpdesigner_tmp.php:1) in C:Program Filesxampphtdocsitraphpdesigner_tmp.php on line 87I want to know that i copy a script login script from a site and running it for my pages but even after doing everything as directed the message above is returned in browser.
View Replies !
Header.php
have created a header image for our site but cant seem to get this central, have removed the images from header.php and replaced them with 1 image but cant seem to get this image central. Code:
View Replies !
A Var In A Header
In this main php page, i want it to direct to a new header. I have an include file with variables in that file. now i'd like to have this: header(Location: "$var.php"); exit; What's the proper format to make this work? i could swear it's this: header(Location: "{$var}.php"); exit; but nope.
View Replies !
Using Header
I was wondering if you use, for example: header("Location: index.php"); will the code AFTER the redirect still be executed; or will the script terminate once it hits the redirect?
View Replies !
CGI Header
I am having trouble with a CGI enabled version of PHP at the server I work in. This requires the line below at the beginning of the script: #!/usr/local/bin/php -q The problem is that i cannot put any header() functions because #!/usr/local/bin/php -q is assumed to be an output already. Therefore returning me the error: Warning: Cannot add header information - headers already sent by (...url... I have looked everywhere, but the closest thing I found was something about output_buffering, which I ini_set it but didn't do any good.
View Replies !
Php Header
<body> <?php header("Location: http://example.com"); /* Redirect browser */ ?> </body> This page is suppose to redirect to another page right? Anyone knows why doesn't it work?
View Replies !
@header
In wordpress I saw several command @header ('bla bla') Why @header? Why not just header? For example: if ( version_compare(phpversion(), Ɗ.3.0', '>=') ) @header("HTTP/1.1 $header $text", true, $header); else @header("HTTP/1.1 $header $text"); Why @header? Why not just header?
View Replies !
Header Already Sent
I am working with site development with PHP. My problem is I have made a header file of header.inc. I use php function for session start but I when I to to php file for some validation and come to same page the error is come that Header already sent. "Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent ...." I don't know how can I handle with this error.
View Replies !
Header?
From a product page before making an order the buyer has to fill out the billing and the delivery address. For this reason he has to be logged to the system if he isn't he has to loggin and redirect to the product page again. The problem is how to keep the information from a product page ?
View Replies !
Using Header.tpl
The site all of my php/.tpl based pages use the file header.tpl, which is where I put my navigation for the site. There is one page, the login page, where I do not wish to have this header show up.
View Replies !
|