"; function get_line($inidea, $j) { global $things_to_ask; $suffix=""; if ($j == 1) $suffix=""; if ($j == (-1 + sizeof($things_to_ask))) $suffix=""; return "\n" . '' . $suffix . "\n"; } function webdisplay($h) { global $fullname, $sn; if ($h != '') { if (file_exists(dirname(__FILE__) . "/interactive_becomes_web.htm")) unlink(dirname(__FILE__) . "/interactive_becomes_web.htm"); file_put_contents(dirname(__FILE__) . "/interactive_becomes_web.htm", $h); if (file_exists(dirname(__FILE__) . "/interactive_becomes_web.html")) unlink(dirname(__FILE__) . "/interactive_becomes_web.html"); //sleep(1); exec("ksh -c \"perl -p -e 's/ /Profile for " . $fullname . "/g' " . dirname(__FILE__) . "/interactive_becomes_web.htm\" > " . dirname(__FILE__) . "/interactive_becomes_web.html"); //sleep(1); exec("python -mwebbrowser http://" . $sn . "/interactive_becomes_web.html"); //exec("python -mwebbrowser http://" . $sn . "/interactive_becomes_web.htm"); } } if (strlen($_SERVER['QUERY_STRING']) > 0 || !isset($argv[0])) { if (strpos($_SERVER['QUERY_STRING'], "reask=") !== false || strlen($_SERVER['QUERY_STRING']) == 0) { for ($i=0; $iReask"; $html="" . $idea . "

 


" . get_line($things_to_ask[$i], $i) . "
ParameterValue
" . $astr . "
"; } else { $html=str_replace("", "" . get_line($things_to_ask[$i], $i) . "", $html); } } if ($html != "") { if (!$sc) { webdisplay($html); } else if ($sc == "") { webdisplay($html); } else { echo $html; } } } else { $bits=explode("&", $_SERVER['QUERY_STRING']); for ($i=0; $iReask

Refresh

Email"; $html="" . $idea . "

 


ParameterValue
" . $things_to_askithing . "" . str_replace("\n","",$line) . "
" . $astr . "
"; } else { $astr="

Reask

Refresh

Email
"; $html="" . $idea . "

 


ParameterValue
" . $things_to_askithing . "" . str_replace("\n","",$line) . "
" . $astr . "
"; } } else { if ($fullname == $lastline) $fullname.=(" " . str_replace("\n","",$line)); if (strpos($subbits[1], "%20") === false) { $html=str_replace("'>Refresh", "&" . str_replace(" ","_",$things_to_askithing) . "=" . urlencode(str_replace("\n","",$line)) . "'>Refresh", str_replace("'>Email", urlencode("&" . str_replace(" ","_",$things_to_askithing) . "=") . urlencode(str_replace("\n","",$line)) . "'>Email", str_replace("", "" . $things_to_askithing . "" . str_replace("\n","",$line) . "", $html))); } else { $html=str_replace("'>Refresh", "&" . str_replace(" ","_",$things_to_askithing) . "=" . $subbits[1] . "'>Refresh", str_replace("'>Email", urlencode("&" . str_replace(" ","_",$things_to_askithing) . "=") . $subbits[1] . "'>Email", str_replace("", "" . $things_to_askithing . "" . str_replace("\n","",$line) . "", $html))); } } $lastline=str_replace("\n","",$line); } if ($html != "") { if ($_SERVER['SERVER_NAME'] == "www.rjmprogramming.com.au" || $_SERVER['SERVER_NAME'] != '') { echo str_replace(" ","Profile for " . $fullname, $html); } else { webdisplay($html); } } } } else if (isset($argv[0])) { $lastline=""; $html=""; echo "PHP Interactive Input becomes Web Output\n\n"; while ($ithing < sizeof($things_to_ask)) { echo "What is your " . $things_to_ask[$ithing] . "? Type nothing to stop, else we present this information to you on a web page: "; $handle = fopen ("php://stdin","r"); $line = fgets($handle); if (trim($line) == '') { echo "Bye now\n"; if ($html != "") { webdisplay($html); } exit; } else if ($html == "") { $fullname.=str_replace("\n","",$line); $astr="

Reask

Refresh

Email
"; $html="" . $idea . "

 


ParameterValue
" . $things_to_ask[$ithing] . "" . $line . "
" . $astr . "
"; } else { if ($fullname == $lastline) $fullname.=(" " . str_replace("\n","",$line)); $html=str_replace("'>Refresh", "&" . str_replace(" ","_",$things_to_ask[$ithing]) . "=" . urlencode(str_replace("\n","",$line)) . "'>Refresh", str_replace("'>Email", urlencode("&" . str_replace(" ","_",$things_to_ask[$ithing]) . "=") . urlencode(str_replace("\n","",$line)) . "'>Email", str_replace("", "" . $things_to_ask[$ithing] . "" . str_replace("\n","",$line) . "", $html))); } $lastline=str_replace("\n","",$line); echo "\n"; echo "Thank you, continuing...\n"; $ithing++; } if ($html != "") { webdisplay($html); } } ?>