|
|
|
#! /usr/bin/php
<HTML>
<HEAD>
<TITLE>Unix Manual</TITLE>
</HEAD>
<BODY>
<b><font face=arial size=+1>Unix Manual</font></b>
<?php
/*
by Marcus S. xenakis 5/2/99
marcus@xenakis.net
This script calls the UNIX man command.
It is usefull for sites that have access to FTP
but not Telnet. This script makes it easier to
read man pages even on those sites with Telnet.
Many man entries are lengthy and require you to
use more or pg filters, and you can't page back.
It was developed and tested at communitech.net that
runs SunOS, please note the code that removes the
headings you may have delete or modify those lines.
It also removes blank lines. There is no error
trap so missing man pages are retunred blank.
*/
echo "<font face=arial><br>";
print(date("m/d/y h:i"));
echo "<sp>CST<br>";
// --- add promter and recursive call
echo "<form action=\"manual.php\">";
echo "Command: ";
echo "<input type=\"text\" size=30 name=\"parm\"> ";
echo "<input value=\" Submit \" type=submit>";
echo "<hr><br>";
echo "</font><pre>";
$blank = 0;
$prior = 0;
$semi = strpos($parm,";");
if ($semi > 1) {
$parm = substr($parm,0,$semi);
}
exec("man $parm",$lines,$rc);
$count = count($lines);
for ($i = 1; $i <= $count; $i++) {
// DELETE ATTRIBUTE CHARACTERS
$lines[$i] = str_replace(chr(8),"",$lines[$i]);
$lines[$i] = str_replace("_","",$lines[$i]);
// reset print flags
$print = 1;
if (strlen($lines[$i]) > 1) {
$blank = 0;
$prior = 0;
} else {
$blank = 1;
}
// SURPRESS A HEADER LINE - MODIFY FOR YOUR SIT
if (substr($lines[$i],0,6) == "SunOS ") {
$print = 0;
$prior = 1;
}
// SURPRESS A HEADER LINE - MODIFY FOR YOUR SITE
if (substr($lines[$i],0,13) == "User Commands") {
$print = 0;
$prior = 1;
}
// SURPRESS MULTIPLE BLANK LINES
if ($blank == 1 and $prior == 1) {
$print = 0;
}
if ($print == 1) {
echo "$lines[$i]<br>";
}
// SET FLAG -BLANK LINE PRINTED
if ($blank == 1) {
$prior = 1;
}
}
echo "</pre>";
?>
<hr>
<br>
</body>
</html>
|
|
| phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | Searches through a local INN server's discussions Categories : Search, Complete Programs, PHP | | | Parses HTTP_USER_AGENT so that you can customize your site to different browsers Categories : HTML, PHP, Complete Programs | | | File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection. Categories : Complete Programs, Content Management, Filesystem, PHP | | | PHPCatalog Categories : Ecommerce, PHP, Complete Programs | | | GuestBook Light - a plug and play application for any website. Categories : PHP, Complete Programs, Filesystem, Sessions | | | fforum fumanchi forum MySQL treestructure Categories : Complete Programs, PHP, MySQL | | | A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed. Categories : Date Time, PHP, Complete Programs, Calendar | | | A set of functions sitting on top of the abstraction layer that makes it a little easier to do SQL stuff. Documentation is within Categories : Databases, ODBC, Complete Programs, PHP | | | This is a script that list all image files on a given directory, and displays
the thumbnails nicely formated within an HTML table. It also make use of
JavScript to open pop up windows when the users want to see the full photo. Categories : Graphics, PHP, Complete Programs, Java Script | | | Builds JavaScript that updates the contents of one selector based on another. Categories : HTML, Java Script, PHP, Complete Programs, General | | | Look for the *position* of the first occurence of string2
in string1, beginning at position start.
Categories : Complete Programs, PHP, Strings | | | Simple Mini Poll class library (SimPoll) Categories : PHP, PHP Classes, Databases, MySQL, Complete Programs | |
| | | | strange eh! wrote : 246
Where`s the manual?
| | | | Marcus Xenakis wrote : 247
Reply to the above comment:
The man, or manual pages must be installed on the
UNIX server. They are optional although most systems
have them installed for basic commands. The script only
provides access and reformatting via HTTP.
| | | | Kelvin Lee wrote : 335
I think replace the "manual.php3" to "$PHP_SELF" in
the <FORM ACTION ... > tag will be better.
| | | | Mathias Eriksson wrote :418
I changed the DETELE ATTR.... part to this
------------------------------------------------------------------
// DELETE ATTRIBUTE CHARACTERS
$ake = strpos ($lines[$i], chr(8));
while ($ake > 0) {
$lines[$i][$ake - 1] = "ã";
$lines[$i][$ake] = $lines[$i][$ake + 1];
$lines[$i][$ake + 1] = "Ã";
$ake = strpos ($lines[$i], chr(8));
}
$lines[$i] = str_replace("ã","<b>",$lines[$i]);
$lines[$i] = str_replace("Ã","</b>",$lines[$i]);
------------------------------------------------------------------
This makes the BOLD text bold and does not repeat
chars....
// Mathias
(not the best way probobly but it works... =)
| |
|
|
|