[PHP]
function &getResponse () {
/*----------------------------------------------------------------------------------------------
New 7/29/2005: Windows can use STDIN, however, the 'con' input data
stream, i.e. 'console',
is built into DOS functionality and produces a better data input
stream result. Use that
for Windows. If this stream is not available or if you are using
UNIX, you will simply
open using STDIN by default
-----------------------------------------------------------------------------------------------*/
if ($_ENV['windir'] || $_SERVER['windir']) $responseID =
@fopen('con', 'rb');
echo "111test111 \n";
if (!$responseID) $responseID = @fopen('php://stdin', 'r') or
die('Cannot read stdin: ' . STDERR);
echo "\nresponse ID = $responseID 222test222\n";
while (($response = @fgets($respons eID, 1024)) !== false) {
echo "333test333 \n";
@fclose($respon seID);
return $response;
}
}
[/PHP]
This is what you get upon running:
php -q /home/phillip/docs/mu-spin/image_catalog/install.php
Is this your first time creating the tables into the database "ivc"?
(y/n Enter = n)111test111
responseID = Resource id #22 222test222
333test333
1where am I?
Do you want to repopulate the usernames table (y/n Enter = n)111test111
responseID = Resource id #25 222test222
[Just sits there until you hit CTRL-C and break out]
Environment: PHP 5.0.4 using Fedora Core 4
The purpose of getResponse() is simply to wait for user response from
STDIN and return whatever the user sends back.
Thanx
Phil
function &getResponse () {
/*----------------------------------------------------------------------------------------------
New 7/29/2005: Windows can use STDIN, however, the 'con' input data
stream, i.e. 'console',
is built into DOS functionality and produces a better data input
stream result. Use that
for Windows. If this stream is not available or if you are using
UNIX, you will simply
open using STDIN by default
-----------------------------------------------------------------------------------------------*/
if ($_ENV['windir'] || $_SERVER['windir']) $responseID =
@fopen('con', 'rb');
echo "111test111 \n";
if (!$responseID) $responseID = @fopen('php://stdin', 'r') or
die('Cannot read stdin: ' . STDERR);
echo "\nresponse ID = $responseID 222test222\n";
while (($response = @fgets($respons eID, 1024)) !== false) {
echo "333test333 \n";
@fclose($respon seID);
return $response;
}
}
[/PHP]
This is what you get upon running:
php -q /home/phillip/docs/mu-spin/image_catalog/install.php
Is this your first time creating the tables into the database "ivc"?
(y/n Enter = n)111test111
responseID = Resource id #22 222test222
333test333
1where am I?
Do you want to repopulate the usernames table (y/n Enter = n)111test111
responseID = Resource id #25 222test222
[Just sits there until you hit CTRL-C and break out]
The purpose of getResponse() is simply to wait for user response from
STDIN and return whatever the user sends back.
Thanx
Phil
Comment