[PHP] Re: Wait/Timeout
Hi! I've been using PHP to write shell scripts and was wondering how to implement the following: - I have a menuing system - If a user does not give an input within a certain amount of time, I want it to go to a default value I checked the PHP functions page and the closest thing I found was sleep which isn't quite right. I'm sure this is a common thing, so does anyone have any suggestions? Again, this is a terminal program and not a web CGI. *MAYBE*, I say just *MAYBE* http://php.net/fgetc will time out and return false if nothing is typed for long enough... But that's probably too long for what you need, and you have no control over it. If you can somehow use fsockopen instead of a fopen, and fool that socket into being a file using named pipes and redirect, you could *probably* do much better by then setting the time-out on the socket... While I have your attention, I also wanted to create one of those spinners while users wait for longer tasks to complete. I tried using the ncurses stuff to print and erase characters, but it didn't seem to work. What is a good way to create a spinner so that users know that the program is working. For those who don't know what I mean, I'm thinking of something like... - (backspace) \ (backspace) | (backspace) / (backspace) etc. etc. Wild Guess: ?php $beach_ball = array('-', '\', '|', '/'); $file = fopen('php://stdout', 'w') or die(Could not open stdout); for ($i = 0; $i 80; $i++){ echo $i, chr(8); # 8 is ^H, right? } ? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Wait/Timeout
Well, the problem is this. I work for an all-Microsoft company that is currently being forced to take on a number of Linux servers. They have this framework that allows for the automated installation and configuration of servers based on a number of Windows 2000 staging servers and a SQL server. The problem? They want the same framework to build out Linux servers as well. So basically I had to find a way to get these Linux servers to talk to the existing framework. It didn't seem so bad at first, but I had a hell of a time getting the Linux box to talk to the MS SQL server. ODBC didn't seem to work nor did the variety of Perl modules that I tried. The only thing I got to work was PHP (Sybase) and FreeTDS. I really wanted to do this in Perl, but alas, I'm forced to do it in PHP. That's the story. ;-) Michael - Original Message - From: Taylor York [EMAIL PROTECTED] To: Michael [EMAIL PROTECTED] Sent: Tuesday, July 09, 2002 9:47 AM Subject: Re: Wait/Timeout Hum. Im kindof curious about the shell... I really know next to nothing about them, but anyway..just wondering why you are making one? and just little details or something...sounds like an interesting project. - Original Message - From: Michael [EMAIL PROTECTED] Newsgroups: php.general To: PHP General [EMAIL PROTECTED] Sent: Tuesday, July 09, 2002 11:14 AM Subject: Wait/Timeout Hi! I've been using PHP to write shell scripts and was wondering how to implement the following: - I have a menuing system - If a user does not give an input within a certain amount of time, I want it to go to a default value I checked the PHP functions page and the closest thing I found was sleep which isn't quite right. I'm sure this is a common thing, so does anyone have any suggestions? Again, this is a terminal program and not a web CGI. While I have your attention, I also wanted to create one of those spinners while users wait for longer tasks to complete. I tried using the ncurses stuff to print and erase characters, but it didn't seem to work. What is a good way to create a spinner so that users know that the program is working. For those who don't know what I mean, I'm thinking of something like... - (backspace) \ (backspace) | (backspace) / (backspace) etc. etc. Thanks in advance! Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php