';
$maybenone='none';
if (isset($_GET['debug'])) {
$maybenone='block';
}
if (isset($_GET['inwords'])) {
if (isset($_GET['curc'])) {
if ($_GET['curc'] != '1') {
$tabbit=" if (window.parent) { if (parent.document.getElementById('trtdtd" . $_GET['curc'] . "')) { parent.appendthenfill(); } } ";
} else {
$tabbit='';
}
} else {
$tabbit='';
}
if (isset($_GET['chr'])) {
$suff=' -c "' . str_replace('+',' ',urldecode($_GET['chr'])) . '" ';
}
if (!file_exists('/tmp/cowsay.wds')) {
$serious=true;
file_put_contents('/tmp/cowsay.wds', $_GET['inwords']);
} else if (substr(file_get_contents('/tmp/cowsay.wds'),0,strlen($_GET['inwords'])) == $_GET['inwords']) {
$serious=false;
} else {
$serious=true;
file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);
}
if (isset($_GET['and']) && file_exists('/tmp/cowsay.txt')) {
if (isset($_GET['outdrawing'])) {
file_put_contents('/tmp/cowsay.txt', str_replace('+',' ',urldecode($_GET['outdrawing'])));
}
if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt'); }
if (file_exists('/tmp/cowsaythree.txt')) { unlink('/tmp/cowsaythree.txt'); }
if (file_exists('/tmp/cowsayzero.txt')) { unlink('/tmp/cowsayzero.txt'); }
exec("awk '{print length}' /tmp/cowsay.txt |sort -nr|head -1 | sed 's/[^0-9]//g' > /tmp/cowsayzn.txt");
if (isset($_GET['maxl'])) {
exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-" . $_GET['maxl'] . "s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
} else {
exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-`cat /tmp/cowsayzn.txt | sed 's/[^0-9]//g'`s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
}
exec("cat /tmp/cowsayzero.txt | head -1 | sed 's/[^\ ]/\ /g' > /tmp/cowsaynone.txt");
for ($i=0; $i<=100; $i++) {
exec("cat /tmp/cowsaynone.txt >> /tmp/cowsayzero.txt");
}
if ($serious) {
$three='three';
exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt'); // ; cp -f /tmp/cowsaythree.txt /tmp/cowsay.txt');
if ($tabbit != '') { $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
} else {
exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt');
if ($tabbit != '') { $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
}
//if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt'); }
echo "Cow Says ... thanks to https://pypi.org/project/cowsay";
} else {
exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_GET['inwords'])) . '" > /tmp/cowsay.txt');
echo "Cow Says ... thanks to https://pypi.org/project/cowsay";
}
exit;
} else if (isset($_POST['inwords'])) {
if (isset($_POST['curc'])) {
if ($_POST['curc'] != '1') {
$tabbit=" if (window.parent) { if (parent.document.getElementById('trtdtd" . $_POST['curc'] . "')) { parent.appendthenfill(); } } ";
} else {
$tabbit='';
}
} else {
$tabbit='';
}
if (isset($_POST['chr'])) {
$suff=' -c "' . str_replace('+',' ',urldecode($_POST['chr'])) . '" ';
}
if (!file_exists('/tmp/cowsay.wds')) {
$serious=true;
file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);
} else if (substr(file_get_contents('/tmp/cowsay.wds'),0,strlen($_POST['inwords'])) == $_POST['inwords']) {
$serious=false;
} else {
$serious=true;
file_put_contents('/tmp/cowsay.wds', $_POST['inwords']);
}
if (isset($_POST['and']) && file_exists('/tmp/cowsay.txt')) {
if (isset($_POST['outdrawing'])) {
file_put_contents('/tmp/cowsay.txt', str_replace('+',' ',urldecode($_POST['outdrawing'])));
}
if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt'); }
if (file_exists('/tmp/cowsaythree.txt')) { unlink('/tmp/cowsaythree.txt'); }
if (file_exists('/tmp/cowsayzero.txt')) { unlink('/tmp/cowsayzero.txt'); }
exec("awk '{print length}' /tmp/cowsay.txt |sort -nr|head -1 | sed 's/[^0-9]//g' > /tmp/cowsayzn.txt");
if (isset($_POST['maxl'])) {
exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-" . $_POST['maxl'] . "s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
} else {
exec("cat /tmp/cowsay.txt | sed 's/ /:/g' | awk '{printf \"%-`cat /tmp/cowsayzn.txt | sed 's/[^0-9]//g'`s\n\", $1}' | sed 's/:/ /g' > /tmp/cowsayzero.txt");
}
exec("cat /tmp/cowsayzero.txt | head -1 | sed 's/[^\ ]/\ /g' > /tmp/cowsaynone.txt");
for ($i=0; $i<=100; $i++) {
exec("cat /tmp/cowsaynone.txt >> /tmp/cowsayzero.txt");
}
if ($serious) {
$three='three';
exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt'); // ; cp -f /tmp/cowsaythree.txt /tmp/cowsay.txt');
if ($tabbit != '') { $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
} else {
exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsaytwo.txt ; pr -m -t -w 500 /tmp/cowsayzero.txt /tmp/cowsaytwo.txt > /tmp/cowsaythree.txt');
if ($tabbit != '') { $tabbit=str_replace('()', "('" . urlencode(file_get_contents('/tmp/cowsaytwo.txt')) . "')", $tabbit); }
}
//if (file_exists('/tmp/cowsaytwo.txt')) { unlink('/tmp/cowsaytwo.txt'); }
echo "Cow Says ... thanks to https://pypi.org/project/cowsay";
} else {
exec('cowsay' . $suff . ' -t "' . str_replace('+',' ',urldecode($_POST['inwords'])) . '" > /tmp/cowsay.txt');
echo "Cow Says ... thanks to https://pypi.org/project/cowsay";
}
exit;
}
echo "Cow Says ... thanks to https://pypi.org/project/cowsay
Cow Says ...
RJM Programming - February, 2025 - Cartoon💬 Speak🗣 Email📧 SMS📟
";
?>