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 Complete Forum Thread with Replies
Related Forum Messages:
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 !
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 !
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 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 !
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 !
Str_replace Thing..?
Anyone know HOW i can do like when someone post with this guestbook script, they can just press enter and then it enable a linespace or something?
View Replies !
PHP String Thing
Say I've got this: <?php $string = "Bill,Martin,Joe"; $name1 $name2 $name3 ?> How do I make the $name1 equal to the first name in the list of strings, $name2 the second and so on?
View Replies !
Is Var And Public The Same Thing?
I know var in Javascript is to declare a variable. But why var in a PHP class? class blah {var $a; public $b;} Aren't they both public? I dont' see what's the point of having a 'var' in a class. Wouldn't it make sense to have only public, private, and protected in front your variable delcaration? Why 'var'?
View Replies !
CSV Export Thing
I am looking at the fputcsv function for something that I need. In summary, this is what I want to do: 1. Go through a table 2. Get all the columns and put them into an array 3. write the array to a CSV file 4. Go to the next row 5. Append the table row into the CSV file 6. Repeat for each row in the table The php site shows this: <?php $list = array ( 'aaa,bbb,ccc,dddd', ì«,456,789', '"aaa","bbb"' ); $fp = fopen('file.csv', 'w'); foreach ($list as $line) { fputcsv($fp, split(',', $line)); } fclose($fp); ?> I'm assuming that I need the 'a+' mode for opening the file and not 'w'? I'm ashamed to say that I have no idea how to loop through the table and put the columns into the array. What I'm coming up with at the moment is this: <?php do { $list = array ( ' $row_Recordset1['firstname'], $row_Recordset1['lastname'], $row_Recordset1['email'], $row_Recordset1['telephone']' ' ); $fp = fopen('/path/to/the/file.csv', 'a+'); foreach ($list as $line) { fputcsv($fp, split(',', $line)); } fclose($fp);
View Replies !
Such A Thing As PHP/SQL Templates?
My company uses the open source "osCommerce" to build our website. I really like how the site is organized. I have been thinking about designing my own website, and I would love to have it organized much like the osCommerce sites are organized, but I don't need the e-commerce functions. My site would just be an informative site with lots of downloads. If you go to their website www.oscommerce.com, you'll see that their website, an informative website without e-commerce, is organized basically the same way that the commerce sites are organized. I mentioned this on one of their forums and was told that, because of the difficulty of removing the commerce components, I would be much better off to just design my own database and website using PHP and MySQL. I am new to PHP and MySQL, and have only learned so far to make minor changes to an already-existing site/database. I don't feel that I could build one from scratch by myself. So, my question is... Is there such a thing as "templates" that I could download (much like the osCommerce open source is a template) to use and modify to make my own?
View Replies !
Login Thing
i am trying to get this login system to work phpauth_v1 to work but dont know how to use it anyone want to help me ?
View Replies !
Securty Thing
we just installed apache and php and mysql in our small office and we are using a contacts system over the LAN using php and apache every one can access the computer that has the contact system on it from the IE freely. the quistion is ( when we are using the internet can anyone access the contacts system on the lan ? someobe told me yes as long as apache is running the computer is like a web site).
View Replies !
Form Thing
I need a shoutbox sort of thing (but not a shout box) so a user fills out a form, with the fields: field1 field2 field3 field4 Then it addds to the top of a page, above all the previous ones in the form of for example. Field1 said field2 and then field3... so it forms part like that ^ Also if possible i want it to be easy for me to add fields. I made one but it is rubbish and allways writes over the previous form submition
View Replies !
Listing Thing!!
How do i make a listing which in my case will list bands dynamicly. so like a A list will be listed from a text file preferably not a SQLserver. but also so that it can be formated and will create table cells for each band name which also has to be made a link....
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 !
Php/mysql Echoing Same Thing Twice--help!
I'm just learning php and set up a sample mysql db to practice with. I have the following script and cannot for the life of me figure out why it is printing each field of the row twice? I checked my db and it only contains the entries once. What is causing this?! ----------------------------------------------------------------------- <?php $con_id = mysql_connect('localhost','dboard_mbr','pa1ss2wo3r d'); mysql_select_db('kp_dboard',$con_id); echo join(mysql_fetch_array($thequery=mysql_query('sele ct * from threads',$con_id)),' --- ') . '<br>' echo join(mysql_fetch_array($thequery),' --- ') . '<br>' echo join(mysql_fetch_array($thequery),' --- '); ?> -----------------------------------------------------------------------
View Replies !
There Is Such A Thing As A Dumb Question!
I am totally new to the whole php/web programming thing. I am trying to set a php script named test.php to run from "http://localhost". I am running a Windows XP box and I have installed php. Now that you have my little bio, where is the directory located on my hard drive that would be the root directory of "http://localhost/"?
View Replies !
Timer Type Thing
I am making a script that will allow members to try to claim something using a button. I want the script to look like this: Have the name and remaining time left to try to claim it. Once the time remaining is at 0 I want the button to disappear but I'm not too sure on how to go about putting how much time is left... I know I'm supposed to have code that has the problem but I'm not sure how to go about it.
View Replies !
Trying To Create A Match Thing
I have been trying to get an apartment exchanging site going. In Sweden it is common to rent your apartment and people often swap apartments with each other. Im trying to create a script (site) where people can do this. But I am a lousy programmer. I basically only know how to alter php since working many years with phpbb-forums. What I need to learn is how to create a match like this: 1.) Person adds his appartment. He puts in info like how many rooms, how much rent and the size of the apartment. 2.) After this he fills in a form with the exact same fields but this time what he wants to have 3.) Another person puts in an ad that meets the first persons needs and there is a match. I have no clue how to even start. Would be even more amazing if there could be a 3-part-match like "No1 wants No2 who wants No3 who wants No1". Is this complicated to do? I have asked on one too many forums now and always been ignored so I hope this active forum can help me. I can concider paying someone for writing a script like this and helping me integrate it into my site.
View Replies !
Sig Thing Type Maker
I want to take this image for my forums and add a few diffrent things to it. I want it to add a text box in the uppper left corner and add the username from a mysql database to it. Then i want it to add another text from the sql db in the left. How is this possibale?
View Replies !
Simple ORDER By Thing
I have a table 'actu_mail' that contains a list of users that have signed-up for a newsletter. they also have a region id 'reg_id' so we know roughly where they are. I want to do a simple "SELECT * FROM 'actu_mail' ORDER BY 'reg_id' " but i would like to order it so that the the 'reg_id' that has most occurrences in the table comes out first and the 'reg_id' that has least occurrences in the table comes out last in the order. is it possible to do this with 1 query ? if not it doesn't matter because i can get round it but it would be great to do it all in 1 go.
View Replies !
Easy String Thing
I can get to figure it our something I know should be really easy to deal with, but I dont remeber some of the str functions. I need a function that will take out part of a string but not substr. And not knowing the position. Lets explain it with an example, lets say i have this: Blah 1 blah 2 blah 3 [START] Blah 456 [END] Im figuring out to do a function that the last text i have is for example $content. And i can output an string like $output to be "Blah 456" So i want to take the text between [START] and [END].
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 !
Is Loading Unused Constants A Bad Thing?
I'm creating a language system for my script, and I was wondering: When I look at large scripts like PHP-Nuke, or phpBB, I see that they're calling a file with 100's, if not thousands of lang constants in it, to load a page that may only use 20 of the definitions. Does the script only load the definitions it needs? Is there any ill impact at all when loading a page that large just to use a couple of them? I'm considering using separate lang files(like I've seen in Zen-Cart) so the lang file being loaded is smaller. My script is pretty tiny to begin with, but I'm trying to do these things to learn how to code smart.
View Replies !
Users Online Type Thing
I am creating a forum and I was wondering how I could create a users online legend at the bottom of the index. I tried something like echo "$myusername" and it will only display your username. How could I accomplish this?
View Replies !
Page History String Thing?
I would like to be able to have a root of the pages visited appear at the top of my pages so visitors can easily return to an earlier visited page. There is one at the top of this page saying: CodingForums.com > :: Server side development > PHP I am not even sure what this is called in order to google for it. Any points in the right direction would be great.
View Replies !
Am Trying To Ask For One Thing Or The Other To Be True, In A Mysql Query.
In my form, I have a ID field, and if users enter that, then they need not enter any other data. So, I want my php to match propertys where, the ID matches the posted ID (which it does)or else where the ID is a blank field and the rest of the fields (rent, postcode etc) match up. (which it doesnt) it just finds nothing if I enter a invalid ID. Why? Code:
View Replies !
Fopen Is Giving Errors Any Thing I Could Replace It With.
My website gets a PHP error as below. main(): php_network_getaddresses: getaddrinfo failed: Name or service not known in .... And after an hour or two Everything becomes OK automatically. Please let me know why above errors comes sometimes. I use a php function fopen() to reuse other webpages at different places. This error does not come always but sometimes randomly. And my error_log gets completely full of this error daily. Any one knows how to rectify this problem. Is there any alternative I should try. I use fopen() function a lot to reduce the file sizes.
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 !
The Old "compare Dates" Thing
I've been looking all over the place for a compare dates script that will work in my instance. I can't find one. This shouldn't be difficult, unless you're like me and get nose bleeds when trying to do anything related to numbers. I'm having a hell of a time wrapping my head around strtotime() and the epoch. Plus, I can't see straight right now Here's what I want to do. 1. user joins. 2. thank you email is sent 3. if account is not activated within 3 days, send a reminder email // i think it's like this $today $date_joined $cutoff_date = ($today + 30 days) if($date_joined >= ($cutoff_date - 3 days)) { //do something } 1. user joins 2. user has 30 days to try account 3. 3 days before account is to be deleted, reminder email is sent // again, I'm "thinking" $date_joined $reminder_date = ($today + 3 days) if($date_joined >= $reminder_date) { do something }
View Replies !
The "dot Dot Dot" Thing?
You know when your displaying info on a page from the DB and you want to limit it to a certain number of characters . . . ie. "This is an example text to show you" but you want to limit it to say 20 characters "This is an example text..." Just like the subject in this form is displayed! It limits the amount of text it displays in your subject!
View Replies !
|